Bug 1196228 - [GSS] (6.4.z) ConsoleAppenders can deadlock if included in application log4j configs
Summary: [GSS] (6.4.z) ConsoleAppenders can deadlock if included in application log4j ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Logging
Version: 6.4.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.4.2
Assignee: Lin Gao
QA Contact: Nikoleta Hlavickova
URL:
Whiteboard:
Depends On:
Blocks: 1211155 1219165
TreeView+ depends on / blocked
 
Reported: 2015-02-25 14:24 UTC by Aaron Ogburn
Modified: 2019-07-11 08:42 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker LOGMGR-117 0 Major Resolved Fork Log4J ConosleAppender to simply handling of calls to System.out 2019-10-17 23:22:06 UTC
Red Hat Knowledge Base (Solution) 375273 0 None None None Never

Description Aaron Ogburn 2015-02-25 14:24:18 UTC
Description of problem:

While the use of ConsoleAppender in Log4J application logging configurations is discouraged, JBoss could probably do a better job of managing its use.

Currently it's possible to encounter a deadlock if thread A invokes System.out.println() and thread B invokes Logger.info(). Thread A will get the lock on System.out (a java.io.PrintWriter), but then thread B will get the lock on the org.apache.log4j.ConsoleAppender. Then each thread is waiting on the other's lock.

Comment 1 Aaron Ogburn 2015-02-25 14:25:27 UTC
Work around is to not use ConsoleAppenders in app log4js or them in async appender/handlers.

Comment 2 James Perkins 2015-02-25 18:32:40 UTC
We'd have to fork the ConsoleAppender to make this work properly since each append invocation uses System.xxx.write(). We'd need to update it to capture System.out and System.err in a static variable to ensure it would work correctly.

Comment 4 Aaron Ogburn 2015-03-06 15:36:05 UTC
If we don't want to go for a ConsoleAppender fork to resolve the deadlock, perhaps we can at least add a warn to notify that a deadlock is likely with the application level ConsoleAppender?

Comment 19 Nikoleta Hlavickova 2015-06-23 10:54:52 UTC
Verified with EAP 6.4.2.CP.CR1 using attached reproducer.

Comment 20 Petr Penicka 2017-01-17 10:17:07 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

Comment 21 Petr Penicka 2017-01-17 10:17:13 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.


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