Repository navigation
test(code-index): wait for the worker's permit, not its phase - #4250
Merged
Merged
Conversation
The source-hint attribution test queued its own admission request once the worker reported AwaitingAdmission, then held the granted permit while waiting for the seat. The worker sets that phase before it first polls its permit request, on another runtime thread. When the test's request queued first it took the permit, and the worker that must seat the generation waited on the test: a deadlock, 5 of 40 runs under load. Release the only permit and wait until it is gone, which only the worker holding it can cause, then queue behind that source pass. Refs #4238
|
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.
Refs #4238
What was broken
source_hint_interrupts_attribution_and_owned_noop_retries_same_generationhung to the test timeout under parallel load.Cause
The test waited for
AwaitingAdmission, assumed the worker's permit request was then queued, and queued its own request behind it. The worker sets that phase before it first pollsacquire_owned, and it runs on a native runtime thread, not the test's current-thread runtime. Traces from a hung run show the test's request polled and granted before the worker's first poll. The test then held that permit while waiting for the seat, and the seat needs the worker's pass, which needs the permit.Fix
Release the test's permit and wait until
available_permits()reads 0. Only the worker holding the permit can cause that, so the test's request then queues behind the source pass and ahead of the optional preparation, as the test intends. Test-only change.Evidence
Same command before and after, 20 parallel jobs pinned to 8 cores:
bazel test //crates/tracedecay-code-index-runtime:unit_test --test_arg=<module path>::source_hint_interrupts_attribution_and_owned_noop_retries_same_generation --test_arg=--exact --runs_per_test=40 --local_test_jobs=20 --test_timeout=60 --run_under=taskset -c 0-7rustfmt_check_2024and--config=clippyon the crate pass.