Bug 56082 - ConcurrentModificationException with org.apache.juli.ClassLoaderLogManager
ConcurrentModificationException with org.apache.juli.ClassLoaderLogManager
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
PC Windows XP
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2014-01-29 00:11 UTC by evernat
Modified: 2014-03-18 09:42 UTC (History)
1 user (show)

Source to reproduce (2.11 KB, application/empty)
2014-01-29 00:11 UTC, evernat

Note You need to log in before you can comment on or make changes to this bug.
Description evernat 2014-01-29 00:11:33 UTC
Created attachment 31267 [details]
Source to reproduce

In Tomcat, java.util.logging.LogManager.getLogManager() is in general an instance of org.apache.juli.ClassLoaderLogManager.

In a webapp, when iterating over the result of LogManager.getLogManager().getLoggerNames(), a ConcurrentModification can sometimes occur.

To reproduce :
- download attached test-1.0.zip
- run "mvn clean package" using Maven
- copy "target/test-1.0.war" into tomcat/webapps
- start Tomcat
- see a lot of "Issue reproduced: java.util.ConcurrentModificationException" in the System output

This webapp uses simple Logger.getLogger(String) and LogManager.getLoggerNames() in threads.
I my case, this is reproduced using Tomcat 7.0.42 and JDK 1.7. 

I suppose that a copy of the result could be made in org.apache.juli.ClassLoaderLogManager.getLoggerNames()
Comment 1 evernat 2014-01-29 00:14:10 UTC
This issue was first reported here:
Comment 2 Mark Thomas 2014-01-30 09:19:43 UTC
This has been fixed in 8.0.x for 8.0.2 onwards and in 7.0.x for 7.0.51 onwards. It has also been proposed for 6.0.x.
Comment 3 Mark Thomas 2014-03-18 09:42:52 UTC
Fixed in 6.0.x for 6.0.40 onwards.