Bug #8227
ConcurrentModificationException when attempting to use two StrongOkHttpClientBuilders at the same time
Status: | New | Start date: | 03/31/2017 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | - | |||
Target version: | - | |||
Component: |
Description
I was using Dagger to @Provides/@Singleton two different @Named StrongOkHttpClientBuilder instances - one withTorValidation and one without.
During app startup, it would crash:
03-30 18:25:29.917 E/AndroidRuntime(20836): Process: org.eoti.android.sandbox.orbot, PID: 20836 03-30 18:25:29.917 E/AndroidRuntime(20836): java.lang.RuntimeException: Error receiving broadcast Intent { act=org.torproject.android.intent.action.STATUS flg=0x10 (has extras) } in info.guardianproject.netcipher.proxy.OrbotHelper$1@23b0d67 03-30 18:25:29.917 E/AndroidRuntime(20836): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1172) 03-30 18:25:29.917 E/AndroidRuntime(20836): at android.os.Handler.handleCallback(Handler.java:751) 03-30 18:25:29.917 E/AndroidRuntime(20836): at android.os.Handler.dispatchMessage(Handler.java:95) 03-30 18:25:29.917 E/AndroidRuntime(20836): at android.os.Looper.loop(Looper.java:154) 03-30 18:25:29.917 E/AndroidRuntime(20836): at android.app.ActivityThread.main(ActivityThread.java:6247) 03-30 18:25:29.917 E/AndroidRuntime(20836): at java.lang.reflect.Method.invoke(Native Method) 03-30 18:25:29.917 E/AndroidRuntime(20836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) 03-30 18:25:29.917 E/AndroidRuntime(20836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) 03-30 18:25:29.917 E/AndroidRuntime(20836): Caused by: java.util.ConcurrentModificationException 03-30 18:25:29.917 E/AndroidRuntime(20836): at java.util.WeakHashMap$HashIterator.nextEntry(WeakHashMap.java:789) 03-30 18:25:29.917 E/AndroidRuntime(20836): at java.util.WeakHashMap$KeyIterator.next(WeakHashMap.java:822) 03-30 18:25:29.917 E/AndroidRuntime(20836): at info.guardianproject.netcipher.proxy.OrbotHelper$1.onReceive(OrbotHelper.java:611) 03-30 18:25:29.917 E/AndroidRuntime(20836): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1162) 03-30 18:25:29.917 E/AndroidRuntime(20836): ... 7 more
While my use case is a bit arbitrary, many production apps do use a separate client per 3rd party server they are talking to.
Looking at the code, it appears that it is probably a problem with statusCallbacks.