Conflicts between JVM application and j.u.l logging shutdown hooks
Laurent Bourgès
bourges.laurent at gmail.com
Thu Dec 12 17:38:51 UTC 2013
Alan,
Thanks for creating the bug 9005822 !
As I spotted in my initial email, both shutdown hook problems (JavaWS and
JUL) are due to the concurrent execution of shutdown hooks :
com.sun.imageio.stream.StreamCloser.java
101: Runtime.getRuntime().addShutdownHook(streamCloser);
java.util.logging.LogManager.java
255: Runtime.getRuntime().addShutdownHook(new Cleaner());
For example, the JavaWS bug is caused by a closed jar file (unable to load
an class during shutdown) because (I guess) the StreamCloser closed all
opened jar files or JUL Streams.
As I said, these 2 important hooks (StreamCloser and jul.Cleaner) should be
executed "later" and the StreamCloser as last.
As jul.Handlers can use sockets or files, it is important to flush / close
first handlers (Cleaner) and then close any remaining opened stream ...
I think this bug should be converted into a more general shutdown hook
issue:
- execute first application hooks (not JVM ones)
- fix priorities / order between all JVM hooks (~ 20 now)
Regards,
Laurent
More information about the core-libs-dev
mailing list