Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3549

The printed thread blocked

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Information Provided
    • 2.17.2
    • None
    • Log4j 1.2 bridge
    • None

    Description

      When we were printing the log, the printed thread was blocked, causing the service to go down. The following is the exception information:

      [arthas@1]$ thread -b
      "http-nio-8080-exec-5" Id=97 RUNNABLE (in native)
          at java.base@11.0.8-ga/java.io.FileOutputStream.writeBytes(Native Method)
          at java.base@11.0.8-ga/java.io.FileOutputStream.write(FileOutputStream.java:354)
          at java.base@11.0.8-ga/java.io.BufferedOutputStream.write(BufferedOutputStream.java:123)
          -  locked java.io.BufferedOutputStream@ea9396a
          at java.base@11.0.8-ga/java.io.PrintStream.write(PrintStream.java:559)
          -  locked java.io.PrintStream@3ff1e46c
          at org.apache.logging.log4j.core.util.CloseShieldOutputStream.write(CloseShieldOutputStream.java:53)
          at org.apache.logging.log4j.core.appender.OutputStreamManager.writeToDestination(OutputStreamManager.java:250)
          at org.apache.logging.log4j.core.appender.OutputStreamManager.flushBuffer(OutputStreamManager.java:283)
          -  locked org.apache.logging.log4j.core.appender.OutputStreamManager@7ba4158c <---- but blocks 236 other threads!
          at org.apache.logging.log4j.core.appender.OutputStreamManager.flush(OutputStreamManager.java:294)
          -  locked org.apache.logging.log4j.core.appender.OutputStreamManager@7ba4158c <---- but blocks 236 other threads!
          at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputStreamAppender.java:199)
          at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppender.java:190)
          at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:181)
          at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:161)
          at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:134)
          at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:125)
          at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:89)
          at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:542)
          at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:500)
          at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:483)
          at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
          at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:82)
          at org.apache.logging.log4j.core.Logger.log(Logger.java:161)
          at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2205)
          at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
          at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
          at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2028)
          at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1891)
          at org.apache.logging.slf4j.Log4jLogger.info(Log4jLogger.java:194) 

       

      I don't know what the solution is now. I would be very grateful if you could reply.

      Attachments

        Activity

          People

            Unassigned Unassigned
            yimiluo yimiluo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: