open-telemetry / opentelemetry-java

OpenTelemetry Java SDK
https://opentelemetry.io
Apache License 2.0
2.02k stars 841 forks source link

Exchange$ResponseBodySource.read java.lang.IllegalStateException - closed #6916

Open happysiddharth opened 1 day ago

happysiddharth commented 1 day ago

Describe the bug A clear and concise description of what the bug is.

Fatal Exception: java.lang.IllegalStateException
closed
okhttp3.internal.connection.Exchange$ResponseBodySource.read (Exchange.kt:289)
okio.internal.-Buffer.commonWriteAll (-Buffer.java:1117)
okio.Buffer.writeAll (Buffer.kt:439)
okio.internal.-RealBufferedSource.commonReadByteArray (-RealBufferedSource.java:107)
okio.RealBufferedSource.readByteArray (RealBufferedSource.kt:75)
okhttp3.internal._ResponseBodyCommonKt.commonBytes (-ResponseBodyCommon.kt:29)
okhttp3.ResponseBody.bytes (ResponseBody.kt:128)
io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSender$1$1.responseBody (OkHttpHttpSender.java:161)
io.opentelemetry.exporter.internal.http.HttpExporter.onResponse (HttpExporter.java:86)
io.opentelemetry.exporter.internal.http.HttpExporter.lambda$export$0 (HttpExporter.java:66)
io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSender$1.onResponse (OkHttpHttpSender.java:144)
com.google.firebase.perf.network.InstrumentOkHttpEnqueueCallback.onResponse (InstrumentOkHttpEnqueueCallback.java:71)
okhttp3.internal.connection.RealCall$AsyncCall.run (RealCall.kt:529)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)

Steps to Reproduce

Initialize the app and configure OpenTelemetry with an OkHttp-based HTTP exporter. Trigger an HTTP export process (e.g., by sending telemetry data). Observe the application crash. What Did You Expect to See? The application should process the HTTP response body successfully without throwing exceptions or crashing.

What Did You See Instead?

The application crashes with the exception mentioned above.

What Version and What Artifacts Are You Using?

Artifacts:

opentelemetry-api opentelemetry-sdk opentelemetry-exporter-http (OkHttp-based HTTP exporter) Version: 1.43.0 Environment

Compiler: Java OS (build): Ubuntu 20.04 Runtime: OpenJDK 11 OS (runtime): Ubuntu 20.04

jkwatson commented 1 day ago

I see firebase in the stacktrace that you posted. That seems like it could be relevant. Can you provide a repository with a minimal example that reproduces this issue?