Avoid holding references to SearchExecutionContext in SourceConfirmedTextQuery#134887
Merged
elasticsearchmachine merged 5 commits intoelastic:mainfrom Sep 17, 2025
Merged
Conversation
Collaborator
|
Hi @romseygeek, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Contributor
Author
|
I'm not really sure how to test this one, other than running a bunch of queries against a match_only_text field and then checking a heap dump on the server - suggestions welcome! |
martijnvg
approved these changes
Sep 17, 2025
Member
martijnvg
left a comment
There was a problem hiding this comment.
LGTM 👍
Agreed, this is difficult to test. The other way to make this unlikely to happen again is to not pass down the context to getValueFetcherProvider(...). But it is used there and that would require a bit more work.
Collaborator
romseygeek
added a commit
to romseygeek/elasticsearch
that referenced
this pull request
Sep 17, 2025
…TextQuery (elastic#134887) Lucene Query objects can hang around for longer than a single search, for example as the key in a Query cache. This means that they should not hold references to anything that is only expected to exist for the duration of a single search request. SourceConfirmedTextQuery holds a lambda to load data during query execution. This commit changes one of the constructor calls to avoid capturing unnecessary references to the SearchExecutionContext, an object which is expected to be short-lived.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 17, 2025
…TextQuery (#134887) (#134913) Lucene Query objects can hang around for longer than a single search, for example as the key in a Query cache. This means that they should not hold references to anything that is only expected to exist for the duration of a single search request. SourceConfirmedTextQuery holds a lambda to load data during query execution. This commit changes one of the constructor calls to avoid capturing unnecessary references to the SearchExecutionContext, an object which is expected to be short-lived.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 17, 2025
…TextQuery (#134887) (#134914) Lucene Query objects can hang around for longer than a single search, for example as the key in a Query cache. This means that they should not hold references to anything that is only expected to exist for the duration of a single search request. SourceConfirmedTextQuery holds a lambda to load data during query execution. This commit changes one of the constructor calls to avoid capturing unnecessary references to the SearchExecutionContext, an object which is expected to be short-lived.
gmjehovich
pushed a commit
to gmjehovich/elasticsearch
that referenced
this pull request
Sep 18, 2025
…TextQuery (elastic#134887) Lucene Query objects can hang around for longer than a single search, for example as the key in a Query cache. This means that they should not hold references to anything that is only expected to exist for the duration of a single search request. SourceConfirmedTextQuery holds a lambda to load data during query execution. This commit changes one of the constructor calls to avoid capturing unnecessary references to the SearchExecutionContext, an object which is expected to be short-lived.
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.
Lucene Query objects can hang around for longer than a single search, for example as
the key in a Query cache. This means that they should not hold references to anything
that is only expected to exist for the duration of a single search request.
SourceConfirmedTextQuery holds a lambda to load data during query execution. This
commit changes one of the constructor calls to avoid capturing unnecessary references
to the SearchExecutionContext, an object which is expected to be short-lived.