New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly close okhttp response body, avoiding leak connection warning #2811

Merged
merged 1 commit into from Sep 12, 2016

Conversation

Projects
None yet
3 participants
@chainkite
Contributor

chainkite commented Sep 12, 2016

Description

As title

Motivation and Context

I got warning below sometimes after I upgrade to 2.1.0 (around once per day)

WARN : okhttp3.OkHttpClient - A connection to https://versioncheck.graylog.com/ was leaked. Did you forget to close a response body?

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
@CLAassistant

This comment has been minimized.

CLAassistant commented Sep 12, 2016

CLA assistant check
All committers have signed the CLA.

@joschi joschi added this to the 2.1.1 milestone Sep 12, 2016

@joschi joschi self-assigned this Sep 12, 2016

@joschi

This comment has been minimized.

Contributor

joschi commented Sep 12, 2016

Good catch. Thank you very much!

This change only closes the Response object in case of a successful reply from the server, but I'll address that in a separate PR.

@joschi joschi merged commit 6e21d43 into Graylog2:master Sep 12, 2016

4 checks passed

ci-server-integration Jenkins build graylog2-server-integration-pr 1357 has succeeded
Details
ci-web-linter Jenkins build graylog-pr-linter-check 840 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details

joschi added a commit that referenced this pull request Sep 12, 2016

edmundoa added a commit that referenced this pull request Sep 12, 2016

Properly close OkHttp Response objects to avoid resource leaks (#2812)
* Guard OkHttp response in VersionCheckResponse with try-with-resources

Refs #2811

* Properly close OkHttp Response objects

* Fix invalid URL handling in HTTPAlarmCallback

edmundoa added a commit that referenced this pull request Sep 12, 2016

Properly close OkHttp Response objects to avoid resource leaks (#2812)
* Guard OkHttp response in VersionCheckResponse with try-with-resources

Refs #2811

* Properly close OkHttp Response objects

* Fix invalid URL handling in HTTPAlarmCallback

(cherry picked from commit 46e84c5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment