square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
https://square.github.io/okhttp/
Apache License 2.0
45.87k stars 9.16k forks source link

Firebase report NullPointerException inside okhttp library line 573(networkInterceptors += interceptor) #7177

Closed mackwu828 closed 2 years ago

mackwu828 commented 2 years ago

Fatal Exception: java.lang.NullPointerException Attempt to read from field 'java.util.List okhttp3.OkHttpClient$Builder.networkInterceptors' on a null object reference okhttp3.OkHttpClient$Builder.addNetworkInterceptor (OkHttpClient.kt:573) com.ondoyant.gde.ob. com.ondoyant.gde.ov.u com.ondoyant.gde.jo. com.ondoyant.gde.bp. com.ondoyant.gde.jo.c com.ondoyant.gde.hn.run java.lang.Thread.run (Thread.java:818)

okhttp version: 'com.squareup.okhttp3:okhttp:4.9.0' please help!

yschimke commented 2 years ago

We can't help with this, particularly with an obfuscated stack trace.

But networkInterceptors can't be null at this point. Any chance it's some unsafe concurrency in your code?

https://github.com/square/okhttp/blob/parent-4.9.0/okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt#L573

Please reopen with a bug reproduction otherwise we can't take any action.

mackwu828 commented 2 years ago

498953192068353791-20220328204143.txt

@yschimke Can you help analyze this log? in line 1540

says java.lang.NullPointerException: Attempt to read from field 'java.util.List okhttp3.OkHttpClient$Builder.networkInterceptors' on a null object reference

yschimke commented 2 years ago

Sorry, It's still the same obfuscated stacktrace, and there are other similar errors which are concerning.

java.lang.NullPointerException: The mapper function returned a null value.
    at java.util.Objects.requireNonNull(Objects.java:109)
    at io.reactivex.rxjava3.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:58)
    at retrofit2.adapter.rxjava3.BodyObservable$BodyObserver.onNext(BodyObservable.java:54)
    at retrofit2.adapter.rxjava3.BodyObservable$BodyObserver.onNext(BodyObservable.java:38)
    at retrofit2.adapter.rxjava3.CallEnqueueObservable$CallCallback.onResponse(CallEnqueueObservable.java:62)
    at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:161)
    at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)

I'm sorry, but we can't provide 1:1 support. And would need a reproduction of the bug we can investigate.