Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentModificationException #46

Open
christopherperry opened this issue Jun 26, 2017 · 7 comments
Open

ConcurrentModificationException #46

christopherperry opened this issue Jun 26, 2017 · 7 comments

Comments

@christopherperry
Copy link

Here's the stack trace:

java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at org.yaml.snakeyaml.representer.BaseRepresenter.representSequence(BaseRepresenter.java:132)
at org.yaml.snakeyaml.representer.SafeRepresenter$RepresentList.representData(SafeRepresenter.java:173)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:94)
at org.yaml.snakeyaml.representer.Representer.representJavaBeanProperty(Representer.java:125)
at okreplay.TapeRepresenter.representJavaBeanProperty(TapeRepresenter.java:40)
at org.yaml.snakeyaml.representer.Representer.representJavaBean(Representer.java:83)
at org.yaml.snakeyaml.representer.Representer$RepresentJavaBean.representData(Representer.java:49)
at org.yaml.snakeyaml.representer.BaseRepresenter.representData(BaseRepresenter.java:105)
at org.yaml.snakeyaml.representer.BaseRepresenter.represent(BaseRepresenter.java:64)
at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:242)
at org.yaml.snakeyaml.Yaml.dump(Yaml.java:221)
at okreplay.YamlTapeLoader.writeTo(YamlTapeLoader.java:75)
at okreplay.YamlTapeLoader.writeTape(YamlTapeLoader.java:52)
at okreplay.Recorder.stop(Recorder.java:68)
at okreplay.RecorderRule$apply$1.evaluate(RecorderRule.kt:44)
at okreplay.PermissionRule$apply$1.evaluate(PermissionRule.kt:18)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)

@felipecsl
Copy link
Collaborator

Hmm interesting. Are you running tests in parallel or something like that?

@christopherperry
Copy link
Author

I don't believe that's what triggered this because it happened when I was testing a class with a single test, but we do run our tests in parallel.

@slavasav
Copy link

slavasav commented Mar 9, 2018

I am experiencing the same issue, just 2 tests, one after the other.

@balachandarlinks
Copy link

I am facing the same issue as well when running a single test or multiple tests. Did you guys figure out any reason?

@balachandarlinks
Copy link

I have observed that it fails only when I record more than one test cases under the same instrumentation instance. If I enabled androidTestOrchestrator and record each test case under a new instrumentation instance then I don't get the exception anymore.

@pilho1
Copy link

pilho1 commented Apr 26, 2019

Setup:

  • Orchestrator enabled
  • Single UI test

Observations:
RECORDING PHASE (TapeModes: READ_WRITE ,WRITE_SEQUENTIAL, WRITE_ONLY)

  • Takes about 2-3 minutes for that single test to start recording
  • Tapes recording fail with ConcurrentModificationException occasionally while for others they fail most of the time

TESTING PHASE (TapeModes: READ_WRITE)

  • Takes about 2-3 minutes for that single test to start running
  • GC is running non-stop for @OkReplay annotation tests
  • Sometimes getting java.lang.RuntimeException: android.os.DeadObjectException FATAL EXCEPTION: AndroidTestOrchestrator but sometimes the tests pass

@technoir42
Copy link
Contributor

technoir42 commented Nov 15, 2019

ConcurrentModificationException can be thrown because your app is still making network requests after UI test has finished executing. You can work around it by using an Espresso idling resource for OkHttp like this one or writing your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants