WARNING [com.squareup.okhttp.OkHttpClient] (OkHttp ConnectionPool) A connection to https://api.github.com/ was leaked. Did you forget to close a response body?
See original GitHub issueWARNING [com.squareup.okhttp.OkHttpClient] (OkHttp ConnectionPool) A connection to https://api.github.com/ was leaked. Did you forget to close a response body?
I am using version 1.116. I sometimes see this warning message in my server log, there is no real occurrence pattern. I am not sure why that happened, but it seems it relates to bad network connection.
In my code, I have a static GitHub instance and use it periodically to communicate with Github.
protected static GitHub github;
...
// create the github instance from initialization like below
...
github = new GitHubBuilder()
.withOAuthToken(config.getPassword(), config.getUsername())
.withConnector(new OkHttpConnector(new OkUrlFactory(new OkHttpClient().setCache(cache))))
.build();
I can see similar message mentioned in a previous pull request #346 on Feb 23, 2017 trying to ignore the warning from okhttp.
Does this really a harmful messages ? How should I prevent this in github-api since I don’t use okhttp directly.
Thank you.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
A connection to https://... was leaked. Did you forget to close a ...
`[OkHttp ConnectionPool] WARN okhttp3.OkHttpClient - A connection to some_site was leaked. Did you forget to close a response body? To see where this...
Read more >java - A connection to (...) was leaked. Did you forget to close ...
It is an error to close a response that is not eligible for a body. This includes the responses returned from cacheResponse ...
Read more >okHttp client reports leaking connection : UP-10647 - YouTrack
WARN kHttp ConnectionPool zoom-sdkwrap okhttp3.OkHttpClient - A connection to http://localhost:8888/ was leaked. Did you forget to close a response body?
Read more >Jenkins Jira
Platform#log: A connection to https://api.github.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the...
Read more >3.x Change Log - OkHttp
Prior to 3.14, OkHttp would silently leak connections when an interceptor retries without closing the response body. With 3.14 we detect this problem...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, I have tried with okhttp3, the warning seems gone.
@soul2zimate Try switching to okhttp3 v3.14.x. It should be a drop in replacement if all you’re doing is using URLConnection. I’m deprecating support for 2.x.