Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix NettyInputStream ByteBuf leak #4222

Merged
merged 5 commits into from
Aug 13, 2019
Merged

Conversation

Gbillou
Copy link
Contributor

@Gbillou Gbillou commented Aug 10, 2019

If not closed here take goes unreferenced leading to a leak of the underlying ByteBuf.
LEAK: ByteBuf.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information.

@jansupol
Copy link
Contributor

Please follow the WIKI

Signed-off-by: Franck Séhédic <franck.sehedic@ledger.fr>
Signed-off-by: Franck Séhédic <franck.sehedic@ledger.fr>
@@ -87,6 +87,8 @@ public int read(byte[] b, int off, int len) throws IOException {

Copy link
Contributor

Choose a reason for hiding this comment

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

could you please update copyright year in both files (to 2019) - copyright header at the top of each file?

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you for changes, and a question - you are changing method read(byte[] b, int off, int len) but immediately under this method there is method read() without any parameters, but inner logic looks very similar, except the very reading. So, the question - shall InputStream take be closed as well in the read() method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I refactored the code a bit to avoid this mistake in the future.

Signed-off-by: Franck Séhédic <franck.sehedic@ledger.fr>
Signed-off-by: Franck Séhédic <franck.sehedic@ledger.fr>
Signed-off-by: Franck Séhédic <franck.sehedic@ledger.fr>
@senivam senivam merged commit 14e8f18 into eclipse-ee4j:master Aug 13, 2019
pa314159 pushed a commit to pa314159/jersey that referenced this pull request Aug 28, 2019
* Fix NettyInputStream ByteBuf leak in jersey/netty HTTP2 Handler

Signed-off-by: Franck Séhédic <franck.sehedic@ledger.fr>
@jansupol jansupol added this to the 2.29.1 milestone Sep 5, 2019
This was referenced Oct 21, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants