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 a buffer memory leak in NettyReadHandlerStateMachine #18323

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Contributor Author

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?

Copy link
Contributor

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.

return;
}
requestContext.increaseReadProgress(packet.readableBytes());
Expand Down