Fixes memory leak in BytesRefLongBlockHash#137050
Merged
ncordon merged 5 commits intoelastic:mainfrom Oct 24, 2025
Merged
Conversation
Collaborator
|
Hi @ncordon, I've created a changelog YAML for you. |
ncordon
commented
Oct 23, 2025
| var dict = blockFactory.newBytesRefArrayVector(bytes, Math.toIntExact(bytes.size())); | ||
| dict = blockFactory.newBytesRefArrayVector(bytes, Math.toIntExact(bytes.size())); | ||
| bytes = null; // transfer ownership to dict | ||
| k1 = new OrdinalBytesRefBlock(ordinals.build(), dict); |
Contributor
Author
There was a problem hiding this comment.
A circuit breaker could kick in here, in the ordinals.build() call and we would not release dict
Member
There was a problem hiding this comment.
Our normal way to do this is to set dict to null after you give it to k1 and then:
Releasables.closeExpectNoException(bytes, dict);
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
Contributor
Author
|
No need to backport this, it seems this bug was introduced only for 9.3 |
fzowl
pushed a commit
to voyage-ai/elasticsearch
that referenced
this pull request
Nov 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #137021.
Repro:
The test
BlockHashRandomizedTests#testWithCrankywas failing in theafterphase when we were checking all of the allocated arrays had been released. That test only failed once every 20 times (the frequencyCrankyCircuitBreakerServicekicks in).