Conflicts between JVM application and j.u.l logging shutdown hooks

Laurent Bourgès bourges.laurent at
Thu Dec 12 17:38:51 UTC 2013


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 :
101:  Runtime.getRuntime().addShutdownHook(streamCloser);
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
- execute first application hooks (not JVM ones)
- fix priorities / order between all JVM hooks (~ 20 now)


More information about the core-libs-dev mailing list