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 38137] New: - Monitor deadlock in AsyncAppender
Date Thu, 05 Jan 2006 14:04:10 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38137>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38137

           Summary: Monitor deadlock in AsyncAppender
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: boris@folgmann.de


I've got a multi-threaded web application running on a heavily loaded server.
Monitor deadlocks occured in log4j 1.2.13, which seem to be caused by improper
use of wait() and notify(). See the thread trace that shows the logging thread
and the dispatcher thread waiting on each other on the same BoundedFIFO.

"TP-Processor163" daemon prio=1 tid=0x08b564b0 nid=0x6369 in Object.wait()
[0x6cee2000..0x6cee3558]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x4a854cf8> (a org.apache.log4j.helpers.BoundedFIFO)
        at java.lang.Object.wait(Object.java:474)
        at org.apache.log4j.AsyncAppender.append(AsyncAppender.java:104)
        - locked <0x4a854cf8> (a org.apache.log4j.helpers.BoundedFIFO)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        - locked <0x4b41d5f8> (a org.apache.log4j.AsyncAppender)
        at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.Category.callAppenders(Category.java:203)
        - locked <0x4b407ac0> (a org.apache.log4j.spi.RootLogger)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.info(Category.java:663)
[...]

"Dispatcher-Thread-17" daemon prio=1 tid=0x69d6ce80 nid=0x4a83 in Object.wait()
[0x6b4af000..0x6b4af7d8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x4a854cf8> (a org.apache.log4j.helpers.BoundedFIFO)
        at java.lang.Object.wait(Object.java:474)
        at org.apache.log4j.Dispatcher.run(AsyncAppender.java:312)
        - locked <0x4a854cf8> (a org.apache.log4j.helpers.BoundedFIFO)
[...]

And lots of other threads blocked by the deadlocked logger, e.g.:
"TP-Processor3" daemon prio=1 tid=0x6a628430 nid=0x4ba4 waiting for monitor
entry [0x6c957000..0x6c958458]
        at org.apache.log4j.Category.callAppenders(Category.java:202)
        - waiting to lock <0x4b407ac0> (a org.apache.log4j.spi.RootLogger)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.info(Category.java:663)
[...]

Please study again the producer and consumer pattern regarding monitors. See
this and the following pages:
http://java.sun.com/docs/books/tutorial/essential/threads/waitAndNotify.html

Having a quick look at the AsyncAppender source code I suggest to remove the
checks wasEmpty() and wasFull() before sending the notify, so a notify is always
sent.

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

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


Mime
View raw message