-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
JUnit 1.20, Jenkins 2.46.1
We have a Pipeline job which uses the parallel step to run a few test tasks in parallel (~11 tasks) and as part of that we call the junit() step to record the results. In the end, we end up with ~9500 tests. We've been running fine for a couple of months but today we just got this exception during a junit() step in one of the threads which failed our build:
[Pipeline] End of Pipeline java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at hudson.tasks.junit.SuiteResult.casesByName(SuiteResult.java:95) at hudson.tasks.junit.SuiteResult.getCase(SuiteResult.java:317) at hudson.tasks.junit.CaseResult.getPreviousResult(CaseResult.java:449) at hudson.tasks.junit.CaseResult.freeze(CaseResult.java:576) at hudson.tasks.junit.SuiteResult.freeze(SuiteResult.java:344) at hudson.tasks.junit.TestResult.freeze(TestResult.java:673) at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:160) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:78) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:65) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49) at hudson.security.ACL.impersonate(ACL.java:260) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Finished: FAILURE
Interestingly, I have noticed that in this same pipeline, the test results can change by large amounts (100s of tests go missing typically) and in the past I've chalked it up to likely some bug in my Pipeline which I haven't investigated yet but it may be related to the above if there is some race in the junit() step. If the junit() step isn't designed to work in parallel() branches, that would be unfortunate but I could work around it by stashing the .xml files and extracting them in a non parallel stage to run junit() on.