Bug 969126 - Prevent possible deadlock in logging handlers when two threads invoke the error handler
Summary: Prevent possible deadlock in logging handlers when two threads invoke the err...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Logging
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: James Perkins
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-30 17:32 UTC by Kyle Lape
Modified: 2018-12-01 16:44 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-19 16:19:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.