You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/06/04 15:18:00 UTC
[jira] [Commented] (LOG4J2-3103) ComodificationException in
concurrent access to LoggerContext::stop
[ https://issues.apache.org/jira/browse/LOG4J2-3103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17357418#comment-17357418 ]
ASF subversion and git services commented on LOG4J2-3103:
---------------------------------------------------------
Commit fc4f66334d7b046ba0f2058c4e4aa122bacf92a8 in logging-log4j2's branch refs/heads/master from Mike Glazer
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=fc4f663 ]
LOG4J2-3103: Make listeners in LoggerContext a CopyOnWriteArrayList (#508)
This particular case fails quite often in integration tests
where you have multiple separate threads potentially creating
and destroying the singleton LoggerContext independently.
Since this is a Listener List, it makes sense to just make
it a CopyOnWriteArrayList, since the frequency of both
occurring is going to be roughly equivalent.
Co-authored-by: Mike Glazer <mg...@palantir.com>
> ComodificationException in concurrent access to LoggerContext::stop
> -------------------------------------------------------------------
>
> Key: LOG4J2-3103
> URL: https://issues.apache.org/jira/browse/LOG4J2-3103
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.14.1
> Reporter: Mike
> Assignee: Carter Kozak
> Priority: Major
>
> 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:
> {code}
> 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)
> {code}
> Proposed fix: https://github.com/apache/logging-log4j2/pull/508
--
This message was sent by Atlassian Jira
(v8.3.4#803005)