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

fix: Fix ByteBuf leak in remoting transport. #1635

Closed
wants to merge 1 commit into from

Conversation

He-Pin
Copy link
Member

@He-Pin He-Pin commented Dec 28, 2024

Motivation:
refs: #1634

Modification:
Call byteBuf.release after bytes read.

Result:
No leaks.

Sorry for everyone.

It's using retainedSlice in LengthFieldBasedFrameDecoder

    protected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length) {
        return buffer.retainedSlice(index, length);
    }

@He-Pin He-Pin marked this pull request as draft December 28, 2024 15:26
log.warning("Error while handling message from [{}]: {}", ctx.channel().remoteAddress(), e)
onException(ctx, e)
} finally {
msg.release()
Copy link
Member Author

Choose a reason for hiding this comment

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

I can't call release, because it's a retainedSlice not a readRetainedSlice, will dig it deeper

@pjfanning
Copy link
Contributor

I would prefer if the exception handling changes were tracked separately - separate issue with a description of why the existing exception handling is wrong - and separate PR.

I think this PR should just add the finally block with the buffer release. That is all that highlighted as wrong in the issue.

@He-Pin
Copy link
Member Author

He-Pin commented Dec 28, 2024

OK, Will split

@He-Pin He-Pin closed this Dec 28, 2024
@He-Pin He-Pin removed bug Something isn't working backport labels Dec 28, 2024
@He-Pin He-Pin removed this from the 1.2.0 milestone Dec 28, 2024
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.

3 participants