connect-kotlin icon indicating copy to clipboard operation
connect-kotlin copied to clipboard

Leaked OkHttp connection

Open jonavos opened this issue 7 months ago • 10 comments

I see this occurring sporadically in my logs.

Mar 18, 2025 5:17:52 PM okhttp3.internal.platform.Platform log
WARNING: A connection to https://connectrpc.example.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient
logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);

I can't currently produce answers as suggested by the log line. I can only produce this issue when running many thousands of connections in a single process (with different OkHttp clients). Which makes tracing a single instance tricky. However I will keep trying.

Some Googling suggests that the response body should be closed even in the even of an exception. I assume that the issue here. Although it's worth noting that I don't see an exception propagating to my client code in these instances.

Thank you.

jonavos avatar Mar 18 '25 17:03 jonavos