Skip to content

Conversation

@drempapis
Copy link
Contributor

Reviewing the class, I noticed that the onShardDone method has a potential leak on the exception path.

If writeSuccessfulResponse(out) or writeReductionFailureResponse(...) throws, the code enters the catch (IOException e) block and returns without releasing out.

In the success path, ownership of the buffer is correctly transferred via out.moveToBytesReference() and ActionListener.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.

@drempapis drempapis requested a review from benchaplin November 10, 2025 08:02
@drempapis drempapis added >refactoring auto-backport Automatically create backport pull requests when merged Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/Search Catch all for Search Foundations v9.1.0 v9.2.0 v9.3.0 labels Nov 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@drempapis
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/part-2

Copy link
Contributor

@benchaplin benchaplin left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >refactoring :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.1.0 v9.2.0 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants