You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pidState: count an unreaped Linux zombie as gone, so a mail lock held by an exited owner is reclaimable #713
Follow-up from #705 (Closes #693), noted out of scope by its builder.
What the fix does
pidState in packages/agent/src/lib/mail-lock.ts treats a pid as running when process.kill(pid, 0) succeeds. On Linux an exited process that has not been reaped yet (state Z in /proc/<pid>/stat) also passes that probe. #705 taught the test helper to count a zombie as gone. The production classifier still counts it as alive, so a mail lock whose owner exited but was never reaped stays held. That happens, for example, under a PID 1 that does not reap, such as a container started without an init process.
On Linux, pidState (and so processIsGone / the lock-owner check) reads /proc/<pid>/stat after a successful probe and classifies state Z as gone. EPERM and the non-Linux path are unchanged, and an unreadable stat file keeps today's answer.
A test spawns a child that exits without being reaped and asserts pidState returns gone on Linux. A second test asserts that a live child is still alive.
The doc comment on pidState states the zombie rule.
Priority: low. It only matters where the lock owner's parent does not reap its children.
Activity