fix: treat killpg EPERM on reported provider groups as exited - #26
Merged
Conversation
A reported provider pgid outlives the group: once every member is dead, the id can be recycled by another user's process, and killpg then returns EPERM. The probe spawns provider groups under its own uid, so a group it still owns is always signalable; EPERM therefore means the id no longer names that group. Raising provider-termination-failed here made collector-cleanup tests flake on the macOS CI runner, where pid randomization recycles ids quickly. The Popen-based provider path keeps its EPERM failure: its leader pid is held un-reaped, so it cannot be recycled. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy
Merged
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.
Problem
test_provider_probecollector-cleanup tests flake on the macOS CI runner (twice:main08-28 run 33147669569, PR #25 run 33362589984) with:A reported provider pgid outlives the group it names: once every member is dead, the id can be recycled by another user's process, and
killpgon it returnsEPERM. macOS pid randomization makes that reuse fast on a busy runner; Linux's sequential pids explain why only macOS hits it.Change
The probe spawns provider groups under its own uid, so a group it still owns is always signalable. In the three raw-pgid helpers (
_process_group_exists,_signal_process_group, and through them_wait_for_process_group_exit),EPERMnow means "the id no longer names our group" — exited — instead of raisingprovider-termination-failed. The Popen-based_terminate_provider_groupkeeps itsEPERMfailure: its leader pid is held un-reaped, so it cannot be recycled.Verification
python3 -m unittest tests.test_provider_probe: 18 OK × 3 runs; full unit group 122 OKos.killpgmocked to raiseEPERM: all three helpers report the group as gone;ESRCHbehavior unchanged🤖 Generated with Claude Code
https://claude.ai/code/session_01GJRuZLJk4cT5dvakGL1Wgy