Repository navigation
PYTHON-6194 Fix SpecRunnerThread lost wakeup race - #3152
Merged
Merged
Conversation
NoahStapp
requested review from
sleepyStick
and
a balanced review from Copilot
October 27, 2026 13:58
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Deterministic regression coverage is needed to verify prompt scheduling and shutdown without relying on the wait timeout.
1 open issue
What changed in this PR
This PR fixes the lost-wakeup race in the specification test runners by protecting queue and shutdown state with the condition lock.
Changes:
- Move queue updates and shutdown-state changes inside the lock.
- Check the wait predicate and dequeue work under the lock, while executing work outside it.
- Apply matching changes to the asynchronous runner and its generated synchronous counterpart.
| File | Description |
|---|---|
test/utils_spec_runner.py |
Updates condition locking in the generated synchronous runner. |
test/asynchronous/utils_spec_runner.py |
Updates condition locking and the wait loop in the asynchronous source. |
Review effort: Balanced
sleepyStick
approved these changes
Oct 27, 2026
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.

PYTHON-6194
Changes in this PR
Make
SpecRunnerTask/SpecRunnerThreadhold the lock when modifying any state to ensure no wakeup calls are missed by waiters.Test Plan
Existing test suite.
Checklist
Checklist for Author
Checklist for Reviewer