Bug 56082

Summary: ConcurrentModificationException with org.apache.juli.ClassLoaderLogManager
Product: Tomcat 6 Reporter: evernat <evernat>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal CC: evernat
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   
Attachments: Source to reproduce

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.