Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-915

AsyncAppender in logback 1.1.3 swallows interrupted flag, cannot shutdown partition threads

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 7.5.0.Final
    • 7.3.0.Final
    • optaplanner-core
    • None
    • NEW
    • NEW

      Due to a LOGBACK-910 bug in AsyncAppender, a logging call statement may clear current thread's interrupted flag. As a result, when Solver is running in a thread started through an ExecutorService and the executor is shutdown, the Solver may miss the interruption and continue working.

      This can happen in OptaPlanner when using AsyncAppender and a logging level of DEBUG or lower. Example of logback.xml:

        <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
          ...
        </appender>
      
        <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
          <appender-ref ref="consoleAppender" />
        </appender>
      
        <logger name="org.optaplanner" level="debug"/>
      
        <root level="warn">
          <appender-ref ref="ASYNC" />
        </root>
      

      This can only be solved by upgrading to Logback 1.1.4 or higher.

      I think the issue is not very important for OptaPlanner users since the purpose of asynchronous logging is to improve performance by avoiding I/O operations on the logging thread. This is usually the case for production environment where performance matters and low logging thresholds (DEBUG and lower) are not used. When INFO level is used, OptaPlanner logging is so infrequent that it's very unlikely that logback would swallow the interrupted flag.

              jlocker Jiří Locker (Inactive)
              jlocker Jiří Locker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: