ConcurrentModificationException in SimpleReport #303

Closed
ken-p opened this Issue Mar 8, 2016 · 10 comments

Projects

None yet

3 participants

@ken-p
ken-p commented Mar 8, 2016

java.util.ConcurrentModificationException: null at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at java.util.Collections$UnmodifiableCollection$1.next(Unknown Source) at com.codeborne.selenide.logevents.SimpleReport.finish(SimpleReport.java:32) at com.codeborne.selenide.testng.TextReport.onTestSuccess(TextReport.java:31) at org.testng.internal.Invoker.runTestListeners(Invoker.java:1695) at org.testng.internal.Invoker.runTestListeners(Invoker.java:1675) at org.testng.internal.Invoker.invokeMethod(Invoker.java:700) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.access$000(SuiteRunner.java:39) at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400) at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Sorry I don't have a reproducible test case, but I can see about working on one if the problem isn't obvious to you. Thanks!

@asolntsev
Member

Wow, cool!
Thank you for reporting, I will investigate it.
On Mar 8, 2016 9:25 PM, "Ken P" notifications@github.com wrote:

java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at java.util.Collections$UnmodifiableCollection$1.next(Unknown Source)
at
com.codeborne.selenide.logevents.SimpleReport.finish(SimpleReport.java:32)
at
com.codeborne.selenide.testng.TextReport.onTestSuccess(TextReport.java:31)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1695)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1675)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:700)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Sorry I don't have a reproducible test case, but I can see about working
on one if the problem isn't obvious to you. Thanks!


Reply to this email directly or view it on GitHub
#303.

@djangofan

@ken-p Are you forking threads by 'methods' or by 'classes' ? IT appears to me that Selenide TextReport class is only designed for fork by class, not by method.

@ken-p
ken-p commented Apr 25, 2016

@djangofan yes, by method.

@asolntsev
Member

@ken-p it's kind of concurrency issue. Two threads are changing the same list at the same time.
But I cannot see how is it possible.
Please do your best to provide a working example, so that I could reproduce the issue.

@ken-p
ken-p commented May 17, 2016

I haven't seen it since! I'll try to reproduce. Thanks.

@asolntsev
Member

@ken-p I got it! The problem may happen when you run tests in parallel by TestNG.
See issue #364

@asolntsev asolntsev added this to the 3.8 milestone Jul 31, 2016
@asolntsev asolntsev self-assigned this Jul 31, 2016
@djangofan

JUnit5 has removed the @Rule notation. I wonder how that might affect this?

@asolntsev
Member

@djangofan I havn't researched JUnit5 yet. I guess they will provide some migration guide.

@asolntsev asolntsev added a commit that referenced this issue Aug 3, 2016
@asolntsev asolntsev Fixes #364 #303 class SimpleReport is now thread-safe
it doesn't hold a single instance of EventsCollector, but creates a new one for every thread
09f1e16
@asolntsev asolntsev added a commit that referenced this issue Aug 3, 2016
@asolntsev asolntsev Fixes #364 #303 class SoftAsserts is now thread-safe
it doesn't hold a single instance of ErrorsCollector, but creates a new one for every test
566022e
@asolntsev
Member

@ken-p It should be fixed now. Will release version 3.8 soon.

@asolntsev asolntsev closed this Aug 3, 2016
@asolntsev asolntsev added a commit that referenced this issue Aug 4, 2016
@asolntsev asolntsev Fixes #364 #303 JUnit implementation of SoftAsserts uses the same pat…
…tern as TestNG's one.
07e79bf
@ken-p
ken-p commented Aug 16, 2016

Thanks!!

@BorisOsipov BorisOsipov added a commit to BorisOsipov/selenide that referenced this issue Nov 23, 2016
@asolntsev @BorisOsipov asolntsev + BorisOsipov Fixes #364 #303 class SimpleReport is now thread-safe
it doesn't hold a single instance of EventsCollector, but creates a new one for every thread
b4064b4
@BorisOsipov BorisOsipov added a commit to BorisOsipov/selenide that referenced this issue Nov 23, 2016
@asolntsev @BorisOsipov asolntsev + BorisOsipov Fixes #364 #303 class SoftAsserts is now thread-safe
it doesn't hold a single instance of ErrorsCollector, but creates a new one for every test
d58b6ee
@BorisOsipov BorisOsipov added a commit to BorisOsipov/selenide that referenced this issue Nov 23, 2016
@asolntsev @BorisOsipov asolntsev + BorisOsipov Fixes #364 #303 JUnit implementation of SoftAsserts uses the same pat…
…tern as TestNG's one.
994fbd1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment