react-native-ssl-pinning icon indicating copy to clipboard operation
react-native-ssl-pinning copied to clipboard

Fatal Exception: java.util.ConcurrentModificationException

Open joelpereda opened this issue 3 years ago • 6 comments

Hi guys, we have a crash in crashlytics with this lib.

The log:

Fatal Exception: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.next(ArrayList.java:860) at okhttp3.internal.http.BridgeInterceptor.cookieHeader(BridgeInterceptor.java:16) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:141) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:118) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:28) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:118) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:9) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:119) at okhttp3.RealCall$AsyncCall.run(RealCall.java:51) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)

 If you have any solution is welcome!

joelpereda avatar Feb 17 '21 15:02 joelpereda

hi, same error happened to me, it seem randomly occurs and cause the app crashed and close.

Try all these method but still failed. https://stackoverflow.com/questions/65094922/error-e-androidruntime-fatal-exception-okhttp-dispatcher-in-using-react-nat

2021-06-01 19:07:24.108 30957-31111/id.myapp E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    Process: id.myapp, PID: 30957
    java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.next(ArrayList.java:860)
        at okhttp3.internal.http.BridgeInterceptor.cookieHeader(BridgeInterceptor.kt:120)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:77)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:71)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:215)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:136)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

EugeneFoo avatar Jun 01 '21 11:06 EugeneFoo

2021-06-02 21:03:56.300 10079-10237/id.myapp W/id.myapp: Long monitor contention with owner OkHttp https://myapi.org/... (10232) at void org.chromium.android_webview.AwCookieManager.nativeFlushCookieStore()(PG:-2) waiters=2 in void com.toyberman.RNSslPinningModule$1.saveFromResponse(okhttp3.HttpUrl, java.util.List) for 151ms

2021-06-02 21:03:56.369 10079-10255/id.myapp W/id.myapp: Long monitor contention with owner OkHttp Dispatcher (10233) at void com.toyberman.RNSslPinningModule$1.saveFromResponse(okhttp3.HttpUrl, java.util.List)(RNSslPinningModule.java:-1) waiters=2 in java.util.List com.toyberman.RNSslPinningModule$1.loadForRequest(okhttp3.HttpUrl) for 110ms

warning message before hit the FATAL EXCEPTION error, hope this help.

EugeneFoo avatar Jun 02 '21 13:06 EugeneFoo

+1

akimabs avatar Jun 16 '21 02:06 akimabs

+1 Got the same crash in crashlytics. @EugeneFoo @joelpereda @akimabs or anyone Any solution to this crash?

Spark-Cybel avatar Sep 05 '21 10:09 Spark-Cybel

@Spark-Cybel

In the end I didn't use this plugin, and manually put public key directly in native code.

iOS - https://itnext.io/react-native-security-ssl-pinning-cde086210d58 Android - https://medium.com/@jaedmuva/react-native-ssl-pinning-is-back-e317e6682642

Hope this helps.

EugeneFoo avatar Sep 06 '21 02:09 EugeneFoo

Cools Thanks.🙌 I will try this method...

Spark-Cybel avatar Sep 06 '21 04:09 Spark-Cybel