Skip to content
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

Call close() on closeable ClientHttpResponse within BufferingClientHttpResponseWrapper.java #1665

Closed
wants to merge 2 commits into from

Conversation

bobross-pg
Copy link

@bobross-pg bobross-pg commented Nov 7, 2023

Clear resources

Description

On exception and close operation, only 1 of 2 close-able resources are closed.

Motivation and Context

It looks like it could lead to memory leak.

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 change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@@ -48,7 +48,9 @@ public void close() {
} catch (IOException e){
throw new RuntimeException(e);
}
delegate.close();
finally {
delegate.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really nice catch, @bobross-pg ! Would you also add a test for this scenario? So that we don't hit regression in future.

@bobross-pg
Copy link
Author

I will use a different github account, redo PR with with signed commits, how can I refuse/close this PR ?

@bobross-pg bobross-pg closed this Nov 9, 2023
@bobross-pg
Copy link
Author

Found the button to close :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants