mads1980 commented on issue #246: OpenSSLEngine improvements to guard against 
multiple shutdown() calls triggered by construction exception and finalize() 
later
URL: https://github.com/apache/tomcat/pull/246#issuecomment-588286325
 
 
   > Well, personally I don't approve until there's an explanation.
   > 
   > * I still don't see what the atomic boolean brings
   
   OpenSSLContext has a very similar protection (this is were I got the idea 
for this solution), but it uses AtomicInteger instead of AtomicBoolean (not 
sure why, since AtomicBoolean is more semantically "readable", and both 
implementations internally use a volatile int for storage, so memory usage is 
the same).
   
   >  all relevant code is already synchronized and the check on the boolean 
flag should be identical.
   
   The fact that shutdown() is synchronized does not prevent it from executing 
concurrently with a failed constructor. There is no synchronization within the 
constructor, while shutdown() is being concurrently execute as a result from 
finalize() being invoked by the JVM GC concurrently with the failed constructor.
   
   > I suppose the actual "fix" is the check if (networkBIO != 0).
   
   Actually the HotStop error log shows the stack trace on freeSSL() but I 
guess that it does not hurt protecting both networkBIO and ssl from null 
pointer frees.
   
   > * "This can happen if there are uncaught exceptions within the 
OpenSSLEngine constructor, as finalization can execute concurrently with object 
construction": ok, so what is the uncaught exception ?
   
   This is not being captured by the HotSpot error logs, since a SIGSEGV crash 
occurs before any useful logging. However, it must be some kind of exception 
arising from the JNI calls within the OpenSSLEngine constructor.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to