Repository navigation
fix(runtime): retain one owner for worker process reaping - #2171
Merged
Merged
Conversation
Share the blocking Process join across waiting and termination. Shield its completion from individual waiter cancellation, preserve SIGTERM grace and SIGKILL escalation, and close resources only after exit status is published. Constraint: shutdown budgets and unconfirmed-exit failures remain unchanged. Scope-risk: this fixes the reproduced POSIX race, not a proven CI root cause. Tested: Linux real-spawn lifecycle 10 passed; Windows lifecycle 8 passed and 2 POSIX skips; Ruff lint/format; full Linux/Python 3.11 Ty; changed-file Ty for Linux and Windows. Other pre-commit hooks pass; native full Windows Ty retains its existing POSIX diagnostics. Refs #2167, #2084.
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This was referenced Oct 21, 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.
Which issue or RFC does this PR close?
Closes #2167. Refs #2084.
Rationale for this change
Cancelling the async worker waiter does not stop its executor thread from
joining the child Process. Termination can start another join against the same
PID. On POSIX, the original thread can reap the child and pause before
publishing
returncode; the competing join then cannot collect that status,and
Process.close()incorrectly reports an already reaped child as running.This is an independently reproduced existing defect. The original #2162 CI
failure did not retain its underlying cause, so this PR does not attribute that
failure to the race or claim it was introduced by HTTP admission.
What changes are included in this PR?
and termination.
cancelled termination attempt followed by retry.
reaping/result-publication boundary. Parameterize cancellation of the
termination attempt; verify cleanup and an actually reaped PID.
Are there any user-facing changes?
Worker shutdown avoids an incorrect unconfirmed-exit failure in this schedule.
SIGTERM grace, SIGKILL escalation, the supervisor's five-second shutdown budget,
and errors for genuinely unconfirmed exits remain unchanged.
No API, persisted format, domain cursor, authorization, Provider or lease
ownership changes are included.
How was this change tested?
ValueError: Cannot close a process while it is still running.pytest tests/builtin/runtime/test_artifact_processing.py -q:10 passed, including both POSIX publication/cancellation cases and the
supervisor SIGTERM-ignore / SIGKILL / stale-fence checks.
8 passed, 2 skipped. Only the POSIX waitpid cases skip; Windows spawn,
shutdown and stale-fence tests execute.
targets passed. Full Linux/Python 3.11 Ty passed.
same 32 pre-existing POSIX/platform diagnostics in unchanged files.
git diff --checkpassed.The regression uses real process and OS boundaries. Its short negative wait
asserts that termination stays pending while the publication gate is held; it
does not impose a subsecond startup or database success budget. Remote CI
matrix results are not claimed by these local runs.
AI usage statement
Implemented and reviewed with OpenAI Codex. Linux/Windows lifecycle results
come from actual spawned-process tests described above.