jvarenina commented on PR #7725:
URL: https://github.com/apache/geode/pull/7725#issuecomment-1156398017

   When created in the same VM, all cache instances use the same 
LogWriterAppender service. Therefore all tests that create multiple caches and 
try to close them will fail with `NullpointerExecption `(the `stopSession()` 
method will be executed more than once for the same `LogWriterAppender`).
   
   For example check MultipleCacheJUnitTest.cacheCreateTwoPeerCaches test case:
   
   ```
   Jale create cache1
   Jale LOGWRITER with instance 
org.apache.geode.logging.log4j.internal.impl.LogWriterAppender@49925e47:LOGWRITER
 {eagerMemberName=null, lazyMemberName=appendLog=true, security=false, 
paused=false, 
loggingSessionRegistry=org.apache.geode.logging.internal.LoggingSessionRegistryProvider@4ae90315,
 logWriter=org.apache.geode.logging.log4j.internal.impl.NullLogWriter@6b0572fa, 
debug=false} has logWriter object: 
org.apache.geode.logging.log4j.internal.impl.NullLogWriter@6b0572fa
   Jale SECURITYLOGWRITER with instance 
org.apache.geode.logging.log4j.internal.impl.LogWriterAppender@7ed478ab:SECURITYLOGWRITER
 {eagerMemberName=null, lazyMemberName=appendLog=true, security=true, 
paused=false, 
loggingSessionRegistry=org.apache.geode.logging.internal.LoggingSessionRegistryProvider@4ae90315,
 logWriter=org.apache.geode.logging.log4j.internal.impl.NullLogWriter@3a981478, 
debug=false} has logWriter object: 
org.apache.geode.logging.log4j.internal.impl.NullLogWriter@3a981478
   Jale create cache2
   Jale LOGWRITER with instance 
org.apache.geode.logging.log4j.internal.impl.LogWriterAppender@49925e47:LOGWRITER
 {eagerMemberName=null, lazyMemberName=appendLog=true, security=false, 
paused=false, 
loggingSessionRegistry=org.apache.geode.logging.internal.LoggingSessionRegistryProvider@4ae90315,
 logWriter=org.apache.geode.logging.log4j.internal.impl.NullLogWriter@78cc6db3, 
debug=false} has logWriter object: 
org.apache.geode.logging.log4j.internal.impl.NullLogWriter@78cc6db3
   Jale SECURITYLOGWRITER with instance 
org.apache.geode.logging.log4j.internal.impl.LogWriterAppender@7ed478ab:SECURITYLOGWRITER
 {eagerMemberName=null, lazyMemberName=appendLog=true, security=true, 
paused=false, 
loggingSessionRegistry=org.apache.geode.logging.internal.LoggingSessionRegistryProvider@4ae90315,
 logWriter=org.apache.geode.logging.log4j.internal.impl.NullLogWriter@3839a6d9, 
debug=false} has logWriter object: 
org.apache.geode.logging.log4j.internal.impl.NullLogWriter@3839a6d9
   Jale closing: cache1
   Jale stopSession: 
org.apache.geode.logging.log4j.internal.impl.NullLogWriter@78cc6db3
   Jale stopSession: 
org.apache.geode.logging.log4j.internal.impl.NullLogWriter@3839a6d9
   Jale closing: cache2
   Jale stopSession: null
   
   java.lang.NullPointerException
   ```
   I think it would be best to return the check whether `logWriter` is null at 
the beginning of `stopSession()` method for these test cases to work. 
@kirklund, what do you think?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to