Skip to content

okhttp3.OkHttpClient - A connection was leaked. Did you forget to close a response body? #3813

Description

@swartzkevinPFG

We are using the OpenTelemetry Java Agent 1.7.1. We are continually getting the below warning when our spans are exported to our collector. Is there any way to determine what is causing this warning? When we run the agent in debug mode, we do not get any additional details of root cause. This issue consumes all available threads until we stop the process to reclaim them.

[otel.javaagent 2021-11-01 20:04:28:616 -0500] [OkHttp ConnectionPool] WARN okhttp3.OkHttpClient - A connection to https://somehost.com:9999/ was leaked. Did you forget to close a response body?
java.lang.Throwable: response.body().close()
at okhttp3.internal.platform.Platform.getStackTraceForCloseable(Platform.java:149)
at okhttp3.internal.connection.Transmitter.callStart(Transmitter.java:116)
at okhttp3.RealCall.enqueue(RealCall.java:92)
at io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter.export(OtlpHttpSpanExporter.java:107)
at io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker.exportCurrentBatch(BatchSpanProcessor.java:305)
at io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker.run(BatchSpanProcessor.java:222)
at java.base/java.lang.Thread.run(Unknown Source)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions