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

Dead lock observed in BlockingWaitStrategy in Log4J

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.6
    • Component/s: Core
    • Labels:
    • Environment:

      Description

      We have seen this behavior in during high load. Where Logging Got Stropped and Application Went to not responsive state.
      log4J Version : 2.2 Disruptor Version : 3.3.2
      Ring Buffer Size : 128
      Producer(Multiples Threads) and Consumer Threads(Single Thread As per Log 4J Configuration) Started Waiting on each other.

      Here is the one of the Trace from Thread Dump:

      Producer :
      "[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'" TIMED_WAITING
      sun.misc.Unsafe.park(Native Method)
      java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:349)
      com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:136)
      com.lmax.disruptor.MultiProducerSequencer.next(MultiProducerSequencer.java:105)
      com.lmax.disruptor.RingBuffer.publishEvent(RingBuffer.java:444)
      com.lmax.disruptor.dsl.Disruptor.publishEvent(Disruptor.java:256)
      org.apache.logging.log4j.core.async.AsyncLogger.logMessage(AsyncLogger.java:285)
      org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:722)
      org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:693)
      org.apache.logging.log4j.jcl.Log4jLog.debug(Log4jLog.java:81)

      Consumer Thread :

      "AsyncLogger-1" waiting for lock java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@5d972983 WAITING
      sun.misc.Unsafe.park(Native Method)
      java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
      java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
      com.lmax.disruptor.BlockingWaitStrategy.waitFor(BlockingWaitStrategy.java:45)
      com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)
      com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:123)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      java.lang.Thread.run(Thread.java:744)

      Is this is known issue which got already fixed in recent build ?

        Attachments

        1. log4j2-test.xml
          1 kB
          Sampath Kumar
        2. timeout_wait_strategy.patch
          5 kB
          Michael Barker
        3. timeout_wait_strategy2.patch
          5 kB
          Michael Barker

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sakumar Sampath Kumar
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: