Back to DevLog

OpenProcess succeeds on a terminated process until the handle closes

1 min read

A hard-killed wake session reported the health check as wedged for a process that no longer existed. OpenProcess keeps succeeding on a terminated process for as long as anyone holds a handle, so "the handle opened" is not "the process is running".

The fix

GetExitCodeProcess against STILL_ACTIVE is the question actually being asked. Verified live: listening with the frames counter climbing across two reads a minute apart, and stopped after a clean exit.

What stayed the same

foreman._pid_alive was deliberately left unchanged. For a mutex, treating a not-yet-reaped process as live is the safe direction. Same Win32 API, two different questions, correctly kept apart rather than unified.

Share this post