Bug 969126

Summary: Prevent possible deadlock in logging handlers when two threads invoke the error handler
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Kyle Lape <klape>
Component: LoggingAssignee: James Perkins <jperkins>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: jperkins, nziakova
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-19 16:19:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kyle Lape 2013-05-30 17:32:42 UTC
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

Comment 2 James Perkins 2013-08-27 17:42:13 UTC
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.