firebase/firebase-android-sdk

ClassCastException java.io.InterruptedIOException cannot be cast to java.lang.Void

Closed this issue · 4 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general
question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the
    firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories,
    reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Narwhal 3 Feature Drop | 2025.1.3 / Build #AI-251.26094.121.2513.14007798, built on August 28, 2025
  • Firebase Component: Performance
  • Component version: 22.0.1 (via bom 34.2.0)

[REQUIRED] Step 3: Describe the problem

Got some reports on Firebase Crashlytics:

Fatal Exception: java.lang.ClassCastException
java.io.InterruptedIOException cannot be cast to java.lang.Void
  okhttp3.internal.connection.Exchange$ResponseBodySource.close (Exchange.kt:347)
  okio.internal.-RealBufferedSource.commonClose (-RealBufferedSource.java:465)
  okio.RealBufferedSource.close (RealBufferedSource.kt:203)
  okhttp3.internal._UtilCommonKt.closeQuietly (-UtilCommon.kt:284)
  okhttp3.ResponseBody.close (ResponseBody.kt:195)
  io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSender$1.onResponse (OkHttpHttpSender.java:171)
  com.google.firebase.perf.network.InstrumentOkHttpEnqueueCallback.onResponse (InstrumentOkHttpEnqueueCallback.java:71)
  okhttp3.internal.connection.RealCall$AsyncCall.run (RealCall.kt:532)
  java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1156)

Is it a compatibility Issue with OkHttp and OpenTelemetry?

  • OkHttp 5.1.0
  • OpenTelemetry 1.53.0 (via another 3rd party lib)
  • okio 3.15.0 (via OpenTelemetry)

Steps to reproduce:

Haven't found a way to reproduce.

Relevant Code:

n/a

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Hi @Kane-Shih, thank you for reaching out. From what I gather, it's possible that;

  • Race condition:
  • Compatibility issue
    * Firebase Performance uses OkHttp 3.12.13. Have you tried downgrading or upgrading the OkHttp/OpenTelemetry/okio versions to a known compatible set if possible?

By any chance, can you share the third party library you're using?

Hi @lehcar09
It's a private ads SDK and it uses OpenTelemetry for some logging.
I've tried to find a compatible set and have no luck.

Thank you for that information @Kane-Shih. I tried reproducing the issue by using the opentelemetry-android, however, I still wasn't able to reproduce the issue. I believe this is caused by race condition and incompatibility in the OkHttp version used by Firebase Performance and OpenTelemetry.

I'll file a feature request to our engineers update the version of OkHttp dependency. Unfortunately, we are unable to promise any timeline for this, but we'll definitely keep this under our radar. Thanks!