question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

WARNING [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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
soul2zimatecommented, Dec 16, 2020

Thanks, I have tried with okhttp3, the warning seems gone.

0reactions
bitwisemancommented, Dec 12, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found