bluelinelabs / bluelinelabs/Conductor

ConcurrentModificationException iterating Backstack

Open
#389 9 comments 6 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.9k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

Hi! I'm seeing the following. The flow is from a conductor activity, to a dialog, the calling out to the SMS app, and then when the user hits the back button from the native SMS app, we get the following:

```
java.util.ConcurrentModificationException
at java.util.ArrayDeque$DeqIterator.next(ArrayDeque.java:608)
at com.bluelinelabs.conductor.Router.onActivityStarted(Router.java:532)
at com.bluelinelabs.conductor.internal.LifecycleHandler.onActivityStarted(LifecycleHandler.java:334)
at android.app.Application.dispatchActivityStarted(Application.java:205)
at android.app.Activity.onStart(Activity.java:1150)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:564)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177)
at com.locationlabs.cni.mvp.BaseControlsActivity.onStart(BaseControlsActivity.java:51)
at com.locationlabs.cni.contentfiltering.AppControlsActivity.onStart(AppControlsActivity.java:117)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
at android.app.Activity.performStart(Activity.java:6268)
at android.app.Activity.performRestart(Activity.java:6314)
at android.app.Activity.performResume(Activity.java:6319)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
```

can you make the Router's Backstack iterator thread-safe, or, provide any other advice? as a workaround, I'm simply catching it and moving on...

```
@Override
protected void onStart() {
try {
super.onStart();
getPresenter().onViewStarted();
} catch (RuntimeException e) {
Log.dw("we still need a proper fix for ");
}
}
```

tried
conductor_version=2.1.4
and
conductor_version=2.1.5-SNAPSHOT

Contributor guide

Open the contributing guide

Research direction

Start in Router.java at onActivityStarted around line 532 and trace the Backstack iteration alongside lifecycle callbacks in LifecycleHandler.java around line 334. Reproduce the activity return from the native SMS app if possible, then verify that backstack changes during this lifecycle path no longer produce ConcurrentModificationException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.