Adrian Nistor created MNG-5304:
----------------------------------
Summary: maven-surefire-report-plugin fails some times with
ConcurrentModificationException when running parallel TestNG
Key: MNG-5304
URL: https://jira.codehaus.org/browse/MNG-5304
Project: Maven 2 & 3
Issue Type: Bug
Components: Sites & Reporting
Affects Versions: 3.0.4
Environment: Java version: 1.6.0_32
Maven version: 3.0.4
maven-surefire-report-plugin: 2.12
TestNG: 5.14.10
Reporter: Adrian Nistor
I'm running TestNG tests in parallel and get this exception
ConcurrentModificationException.
My quick analysis is that at the end of the test the method
TestSetRunListener.getAsString is accessing the list of captured output while
another thread (a stray thread spawned by the test or a completely different
concurrent test) generates some more console output causing an append to the
list which results in ConcurrentModificationException.
To fix this we need to ensure getAsString accesses the list atomically. A
possible solution is to copy/clone the list before iterating over it.
Here is the stakctrace I get.
java.util.ConcurrentModificationException
at
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at
org.apache.maven.plugin.surefire.report.TestSetRunListener.getAsString(TestSetRunListener.java:209)
at
org.apache.maven.plugin.surefire.report.TestSetRunListener.testFailed(TestSetRunListener.java:168)
at
org.apache.maven.surefire.testng.TestNGReporter.onTestFailure(TestNGReporter.java:104)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1796)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1780)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:749)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
at org.testng.TestRunner.privateRun(TestRunner.java:749)
at org.testng.TestRunner.run(TestRunner.java:600)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:34)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:351)
at
org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:147)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira