-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 a buffer memory leak in NettyReadHandlerStateMachine #18323
Conversation
@@ -672,6 +672,8 @@ private void readData(RequestContext requestContext, Transition<State, TriggerEv | |||
requestContext.getRequest()); | |||
} | |||
fireNext(mTriggerEventsWithParam.mOutputLengthFulfilled, requestContext); | |||
// Release the packet as there is nothing more to read | |||
packet.release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not really sure if it's best to release here or actually before the fireNext()
. The fireNext()
might throw an exception somehow? And I figure fireNext()
is not using this packet anyways.
Or would there be a better place than here, to release the packetReader.getDataBuffer()
instead of releasing on the temp variable like what I'm doing? Who cleans up the resources in the context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is OK for this case, but I am concerning if there are other Bytebuf memory leak scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot for finding out the leak!
alluxio-bot, merge this please |
### What changes are proposed in this pull request? resolves Alluxio#18324 Disclaimer: I might have monkey-typed this fix but I still do not know anything about buffer ref counting. This fix does NOT make me the owner of this state machine. pr-link: Alluxio#18323 change-id: cid-eb5bde353c08d3d9bdd39da5b9caf13681bae495
What changes are proposed in this pull request?
resolves #18324
Disclaimer: I might have monkey-typed this fix but I still do not know anything about buffer ref counting. This fix does NOT make me the owner of this state machine.