Red Hat Bugzilla – Bug 969126
Prevent possible deadlock in logging handlers when two threads invoke the error handler
Last modified: 2014-08-19 12:19:00 EDT
There is a potential to have a deadlock if two threads are invoking logging handlers and both threads end up invoking the error handler for their logging handler.
The way the deadlock works is
- Thread 1 invokes the error handler
- The error handler writes to System.out.println
- This is routed back into the logging subsystem via jboss-stdio
- As usual, JBoss LogManager will send the message to all appropriate handlers
- The thread halts, waiting on a lock for the handler locked by thread 2
- Thread 2 is running in a different handler for which it has a lock
- This lock must have been obtained after thread 1 invoked this handler but before the error handler from thread 1 tried to invoke the same handler
- This handler also invokes its error handler
- The error handler halts, waiting on the lock for System.out, held by thread 1
I think this relates to https://bugzilla.redhat.com/show_bug.cgi?id=961702 and has been fixed in the LogManager by using the org.jboss.logmanager.errormanager.OnlyOnceErrorManager. The JIRA was LOGMGR-65 and the LogManager PR was https://github.com/jboss-logging/jboss-logmanager/pull/18. This fix made it into jboss-logmanager-1.4.3.Final which made it into EAP 6.1.1.