-
Notifications
You must be signed in to change notification settings - Fork 25.6k
SearchQueryThenFetchAsyncAction - close properly byte stream on failure #137810
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
SearchQueryThenFetchAsyncAction - close properly byte stream on failure #137810
Conversation
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
|
@elasticmachine run elasticsearch-ci/part-2 |
benchaplin
left a comment
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.
Looks good thanks Dimi, I missed this piece in my recent change.
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
Reviewing the class, I noticed that the
onShardDonemethod has a potential leak on the exception path.If
writeSuccessfulResponse(out)orwriteReductionFailureResponse(...)throws, the code enters thecatch (IOException e)block and returns without releasingout.In the success path, ownership of the buffer is correctly transferred via
out.moveToBytesReference()andActionListener.respondAndRelease(...), which ensures the bytes are released. However, in the failure path, the stream remains open and its underlying buffer is never returned to the recycler.