[ 
https://issues.apache.org/jira/browse/LOG4J2-2239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16352045#comment-16352045
 ] 

Ralph Goers commented on LOG4J2-2239:
-------------------------------------

This is not a deadlock. Thread "updateTask-1" is runnable and owns the lock all 
the other threads are waiting on. I am not sure what you are writing to but 
clearly it cannot keep up with the volume of logging being performed. Note that 
synchronization is necessary when writing or else the file will be corrupted 
with multiple threads writing at the same time.

{code}
"updateTask-1" #134 prio=5 os_prio=0 tid=0x000055ce3be3d800 nid=0x92 runnable 
[0x00007fd3b682b000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:326)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
        - locked <0x000000064b0b5aa0> (a java.io.BufferedOutputStream)
        at java.io.PrintStream.write(PrintStream.java:480)
        - locked <0x000000064b087ce0> (a java.io.PrintStream)
        at 
org.apache.logging.log4j.core.util.CloseShieldOutputStream.write(CloseShieldOutputStream.java:53)
        at 
org.apache.logging.log4j.core.appender.OutputStreamManager.writeToDestination(OutputStreamManager.java:262)
        - eliminated <0x000000064b228490> (a 
org.apache.logging.log4j.core.appender.OutputStreamManager)
        at 
org.apache.logging.log4j.core.appender.OutputStreamManager.flushBuffer(OutputStreamManager.java:294)
        - eliminated <0x000000064b228490> (a 
org.apache.logging.log4j.core.appender.OutputStreamManager)
        at 
org.apache.logging.log4j.core.appender.OutputStreamManager.drain(OutputStreamManager.java:351)
        at 
org.apache.logging.log4j.core.layout.TextEncoderHelper.drainIfByteBufferFull(TextEncoderHelper.java:260)
        - locked <0x000000064b228490> (a 
org.apache.logging.log4j.core.appender.OutputStreamManager)
        at 
org.apache.logging.log4j.core.layout.TextEncoderHelper.writeAndEncodeAsMuchAsPossible(TextEncoderHelper.java:199)
        at 
org.apache.logging.log4j.core.layout.TextEncoderHelper.encodeChunkedText(TextEncoderHelper.java:159)
        - locked <0x000000064b228490> (a 
org.apache.logging.log4j.core.appender.OutputStreamManager)
        at 
org.apache.logging.log4j.core.layout.TextEncoderHelper.encodeText(TextEncoderHelper.java:58)
        at 
org.apache.logging.log4j.core.layout.StringBuilderEncoder.encode(StringBuilderEncoder.java:68)
        at 
org.apache.logging.log4j.core.layout.StringBuilderEncoder.encode(StringBuilderEncoder.java:32)
        at 
org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:220)
        at 
org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:58)
        at 
org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputStreamAppender.java:177)
        at 
org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppender.java:170)
        at 
org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:161)
        at 
org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
        at 
org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
        at 
org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
        at 
org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403)
        at 
org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
        at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
        at 
org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2163)
        at 
org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2118)
        at 
org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2101)
        at 
org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2036)
        at 
org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1915)
        at 
org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1449)
        at 
com.orderufo.service.CloverPosServices.getBaseRequest(CloverPosServices.java:360)
        at 
com.orderufo.service.CloverPosServices.getBaseRequest(CloverPosServices.java:315)
        at 
com.orderufo.service.CloverPosServices.getBaseRequest(CloverPosServices.java:184)
        at 
com.orderufo.service.CloverPosServices.forceUpdateMerchantItemList(CloverPosServices.java:895)
        at 
com.orderufo.service.CloverPosServices.forceUpdateMerchantExtendedData(CloverPosServices.java:1433)
        at com.orderufo.core.DataManager.lambda$null$8(DataManager.java:501)
        at com.orderufo.core.DataManager$$Lambda$58/1642576652.accept(Unknown 
Source)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at 
com.orderufo.core.DataManager.lambda$checkMerchaneMenuChanged$9(DataManager.java:477)
        at com.orderufo.core.DataManager$$Lambda$56/577602849.accept(Unknown 
Source)
        at com.orderufo.util.TaskManager$Task.run(TaskManager.java:128)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
{code}

> Deadlock in log4j 2.10.0
> ------------------------
>
>                 Key: LOG4J2-2239
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2239
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.10.0
>         Environment: OpenJDK 64-Bit Server VM (25.121-b13 mixed mode) in 
> docker
>            Reporter: Ramon Li
>            Priority: Major
>         Attachments: deadlock_stack.txt
>
>
> I got a problem on our server, seems the log4j dead locked, I just attached 
> the thread stack in this email.
> 550 threads blocked in this line:
> java.lang.Thread.State: BLOCKED (on object monitor)
>  at 
> org.apache.logging.log4j.core.appender.OutputStreamManager.writeBytes(OutputStreamManager.java:360)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to