Bug #8227

ConcurrentModificationException when attempting to use two StrongOkHttpClientBuilders at the same time

Added by malachid 10 months ago. Updated 10 months ago.

Status:NewStart date:03/31/2017
Priority:NormalDue 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.

History

#1 Updated by malachid 10 months ago

Oh, I was using:
compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
compile 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1'
compile 'com.squareup.okhttp3:okhttp:3.4.2'

Also available in: Atom PDF