Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-618

File appender stucks in the native method FileOutputStream.write

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      Version:  2.10.0 (Jira says Version with id ' 2.10.0' does not exist.)
       
      In one of our production environments, the Thread which asynchronously processes log events ( Log4j2-TF-1-AsyncLogger)  sometimes freezes in the native method FileOutputStream.write. The AsyncLogger is using RollingFileAppender, which is using old blocking IO access. Since we are unable to reproduce it anywhere else, we assume it's connected to this particular virtual environment setup. 
       
      However, we would like to try NIO file appender. Unfortunately, I wasn't lucky to find any. Does any NIO file appender exists? Maybe unofficial?  Is it planned to rewrite File appenders to use NIO approach when dealing with files?
       
      Bellow is a stacktrace of the async thread. It stays in the native method FileOutputStream.write forever but no new byte is written into the log folder. 
       
      "Log4j2-TF-1-AsyncLogger[AsyncContext@77556fd]-1" #18 daemon prio=5 os_prio=0 cpu=468.75ms elapsed=594.01s tid=0x000001c3a17b9000 nid=0x34a0 at breakpoint [0x0000008fefdfe000]
         java.lang.Thread.State: RUNNABLE
              at java.io.FileOutputStream.write(java.base@11.0.1/FileOutputStream.java:354)
              at org.apache.logging.log4j.core.appender.OutputStreamManager.writeToDestination(OutputStreamManager.java:262)
              - locked <0x000000070317f580> (a org.apache.logging.log4j.core.appender.rolling.RollingFileManager)
              at org.apache.logging.log4j.core.appender.FileManager.writeToDestination(FileManager.java:261)
              - locked <0x000000070317f580> (a org.apache.logging.log4j.core.appender.rolling.RollingFileManager)
              at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.writeToDestination(RollingFileManager.java:219)
              - locked <0x000000070317f580> (a org.apache.logging.log4j.core.appender.rolling.RollingFileManager)
              at org.apache.logging.log4j.core.appender.OutputStreamManager.flushBuffer(OutputStreamManager.java:294)
              - locked <0x000000070317f580> (a org.apache.logging.log4j.core.appender.rolling.RollingFileManager)
              at org.apache.logging.log4j.core.appender.OutputStreamManager.flush(OutputStreamManager.java:303)
              - locked <0x000000070317f580> (a org.apache.logging.log4j.core.appender.rolling.RollingFileManager)
              at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputStreamAppender.java:179)
              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.appender.RollingFileAppender.append(RollingFileAppender.java:308)
              at cz.sw.upis.logging.UpisAppender.append(UpisAppender.java:27)
              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.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:79)
              at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:380)
              at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:152)
              at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:45)
              at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:29)
              at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:129)
              at java.lang.Thread.run(java.base@11.0.1/Thread.java:834)
       
         Locked ownable synchronizers:
              - None

        Attachments

          Activity

            People

            • Assignee:
              nachbarslumpi Dominik Psenner
              Reporter:
              kadledav David Kadleček
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: