Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1548

Race condition in the AsyncAppenderBase#Worker thread during shutdown

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.2.3
    • logback-core

    Description

      The AsyncAppenderBase#Worker thread may not clear interrupt flag here:  https://github.com/qos-ch/logback/blob/master/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java#L289 (when it exits loop by parent.isStarted() condition). As a result, in our projects it fails to properly flush queue and properly stop appenders.

      This is what we can see in the logs:

      13:06:59,188 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC-KAFKA] - Worker thread will flush remaining events before exiting. 
      13:06:59,189 |-ERROR in com.opentable.logging.KafkaAppender[KAFKA] - Appender [KAFKA] failed to append. org.apache.kafka.common.errors.InterruptException: java.lang.InterruptedException
      	at org.apache.kafka.common.errors.InterruptException: java.lang.InterruptedException
      	at 	at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:967)
      	at 	at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:865)
      	at 	at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:752)
      	at 	at com.opentable.logging.KafkaAppender.append(KafkaAppender.java:82)
      	at 	at com.opentable.logging.KafkaAppender.append(KafkaAppender.java:32)
      	at 	at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
      	at 	at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
      	at 	at ch.qos.logback.core.AsyncAppenderBase$Worker.run(AsyncAppenderBase.java:299)
      

      Attachments

        Activity

          People

            logback-dev Logback dev list
            dkaukov Dmitry Kaukov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: