logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50463] New: AsyncAppender causing deadlock when dispatcher thread dies
Date Mon, 13 Dec 2010 08:17:14 GMT

           Summary: AsyncAppender causing deadlock when dispatcher thread
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: ljacomet@gmail.com

I recently investigated a deadlock happening inside our JBoss AS.
I tracked down the root cause to the AsyncAppender of log4j.
We use it in blocking mode, with the default buffer size of 128. I was able to
reproduce the deadlock live even when increasing the buffer size to 512.

The problem comes from a race condition when the dispatcher thread dies from an
exception. When that happens, if the buffer has been filled up by other threads
doing logging, the thread currently waiting on the buffer to be emptied will
never be notified and wait there forever.
As a category lock is held to access the appender, this lead other threads to
block forever.

We are using log4j 1.2.14 and JBoss AS 4.3.0.
The latest trunk version of AsyncAppender still suffers from the race

I attached a test case, using JUnit 4 and Java5 constructs, and a patch for the
This code is contributed so that it can be included in log4j code base if

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message