Skip to content

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

Merged
joschi merged 1 commit into
Graylog2:masterfrom
chainkite:master
Sep 12, 2016
Merged

explicitly close okhttp response body, avoiding leak connection warning#2811
joschi merged 1 commit into
Graylog2:masterfrom
chainkite:master

Conversation

@chainkite

@chainkite chainkite commented Sep 12, 2016

Copy link
Copy Markdown
Contributor

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

CLAassistant commented Sep 12, 2016

Copy link
Copy Markdown

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

joschi commented Sep 12, 2016

Copy link
Copy Markdown
Contributor

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
edmundoa pushed a commit that referenced this pull request Sep 12, 2016
* Guard OkHttp response in VersionCheckResponse with try-with-resources

Refs #2811

* Properly close OkHttp Response objects

* Fix invalid URL handling in HTTPAlarmCallback
edmundoa pushed a commit that referenced this pull request Sep 12, 2016
* 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants