Repository navigation
fix(failure-memory): stop the lock's liveness probe sending Ctrl-C on windows - #41
Merged
Merged
Conversation
… Windows ProjectLock._pid_alive probed the lock owner with os.kill(pid, 0). On Windows signal 0 is signal.CTRL_C_EVENT, so CPython calls GenerateConsoleCtrlEvent and delivers Ctrl-C to every process on the console, and the call "succeeds" whether or not the pid exists. acquire() polls it every 20 ms under contention, so a held lock produced a stream of KeyboardInterrupts, and a dead owner was never detected, so stale-lock recovery never worked on Windows. Windows now probes with OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION) and GetExitCodeProcess == STILL_ACTIVE, treating access denied as alive and failing safe (alive) when the exit code cannot be read. POSIX is unchanged. New probe tests cover self/finished/unknown pids and assert no SIGINT arrives while probing; a Windows CI job runs them. Reported by the Logic-Loom Windows CI (run 40683210571). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
ProjectLock._pid_alive used os.kill(pid, 0). On Windows signal 0 is CTRL_C_EVENT, so every probe sent Ctrl-C to every process on the console. Under lock contention it polls every 20 ms, and a dead owner was never detected. Windows now probes with OpenProcess/GetExitCodeProcess; POSIX is unchanged. Adds probe tests and a Windows CI job that runs them. Found by Logic-Loom’s Windows CI (run 40683210571).