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

AsyncAppender may come up without Worker resulting in a Deadlock

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.4
    • Fix Version/s: 1.0.7
    • Component/s: logback-core
    • Labels:
      None
    • Environment:

      Linux 64bit - Debian Squeeze
      java version "1.6.0_33"
      Java(TM) SE Runtime Environment (build 1.6.0_33-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)

      tomcat6

      Description

      During a clean tomcat startup (tomcat was stopped before) and initialization of logback we observed that an AsyncAppender may come up without worker thread resulting in a deadlock of the application, because the queue will never be emptied.

      We use a lot of AsyncAppenders in our setup, and this Error seldomly happens, so this might be hard to trigger. I suspect a Race condition somewhere?

      Here is some logback output with debug turned on:
      You see the Worker Thread dies immediately after initialization and nonetheless the initializian continues and the Appender gets added to the ROOT logger.

      12:07:07,295 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
      12:07:07,295 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [XXX-log-error]
      12:07:07,295 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [XXX-sync-log-error] to ch.qos.logback.classic.AsyncAppender[XXX-log-error]
      12:07:07,295 |-INFO in ch.qos.logback.classic.AsyncAppender[XXX-log-error] - Attaching appender named [XXX-sync-log-error] to AsyncAppender.
      12:07:07,295 |-INFO in ch.qos.logback.classic.AsyncAppender[XXX-log-error] - Setting discardingThreshold to 51
      12:07:07,296 |-INFO in ch.qos.logback.classic.AsyncAppender[XXX-log-error] - Worker thread will flush remaining events before exiting.

      ...
      a lot of successfull appender initialization cut out
      ...

      12:07:07,338 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [XXX-log-error] to Logger[ROOT]

        Attachments

          Activity

            People

            • Assignee:
              ceki Ceki Gülcü
              Reporter:
              arndh Arnd Hannemann
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: