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

ComodificationException in concurrent access to LoggerContext::stop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.14.1
    • 2.15.0
    • Appenders
    • None

    Description

      Mostly just happens in integration tests, but if two concurrent processes both attempt to stop and add new shutdown listeners at the same time, you can see the following exception:

      Caused by: java.util.ConcurrentModificationException
      	at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1043)
      	at java.base/java.util.ArrayList$Itr.next(ArrayList.java:997)
      	at org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:405)
      	at org.apache.logging.log4j.core.async.AsyncLoggerContext.stop(AsyncLoggerContext.java:106)
      	at com.palantir.sls.logging.log4j.service.Log4jServiceLogging.shutdown(Log4jServiceLogging.java:152)
      	at com.palantir.witchcraft.logging.log4j.Log4jLoggingFramework.shutdown(Log4jLoggingFramework.java:124)
      	at com.palantir.witchcraft.logging.log4j.Log4jLoggingFramework.initialize(Log4jLoggingFramework.java:59)
      	at com.palantir.witchcraft.logging.LoggingFrameworks.initialize(LoggingFrameworks.java:41)
      	at com.palantir.witchcraft.logging.Logging.configureDefault(Logging.java:76)
      

      Proposed fix: https://github.com/apache/logging-log4j2/pull/508

      Attachments

        Issue Links

          Activity

            People

              ckozak Carter Kozak
              mglazer Mike
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: