Skip to content

fix(failure-memory): stop the lock's liveness probe sending Ctrl-C on windows - #41

Merged
SOSOVSKI merged 1 commit into
mainfrom
fix/windows-lock-pid-probe
Oct 29, 2026
Merged

SOSOVSKI merged 1 commit into
mainfrom
fix/windows-lock-pid-probe

Conversation

@SOSOVSKI

Copy link
Copy Markdown
Contributor

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).

… 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>
@SOSOVSKI
SOSOVSKI merged commit e8f8bd0 into main Oct 29, 2026
14 checks passed
@SOSOVSKI
SOSOVSKI deleted the fix/windows-lock-pid-probe branch October 29, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant