Skip to content

Prevent concurrent access to local breaker in rerank (#128162) #128945

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

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Jun 5, 2025

When an async operator receives a response, we can't create new blocks on the responding thread because multiple threads may adjust the local breaker simultaneously, leading to a data race. To address this, we can either use the global breaker or delay block creation in getOutput. While using the global block factory is simpler, I prefer the second option to use the local breaker when possible. Therefore, I opted to keep the results in the queue and create new blocks in getOutput. Our tests didn't catch this issue because: (1) only one block is created in the test, and (2) there is no delay when simulating the inference service.

Closes #127638
Closes #127051

When an async operator receives a response, we can't create new blocks
on the responding thread because multiple threads may adjust the local
breaker simultaneously, leading to a data race. To address this, we can
either use the global breaker or delay block creation in getOutput.
While using the global block factory is simpler, I prefer the second
option to use the local breaker when possible. Therefore, I opted to
keep the results in the queue and create new blocks in getOutput. Our
tests didn't catch this issue because: (1) only one block is created in
the test, and (2) there is no delay when simulating the inference
service.

Closes elastic#127638
Closes elastic#127051
@dnhatn dnhatn added >non-issue backport auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Analytics/ES|QL AKA ESQL v8.19.0 labels Jun 5, 2025
@dnhatn dnhatn marked this pull request as ready for review June 5, 2025 15:12
@dnhatn dnhatn merged commit 41137a3 into elastic:8.19 Jun 5, 2025
15 checks passed
@dnhatn dnhatn deleted the 8.19-local-breaker branch June 5, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >non-issue v8.19.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant