Skip to content

pidState: count an unreaped Linux zombie as gone, so a mail lock held by an exited owner is reclaimable #713

Closed

Description

@tps-flint

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.

  1. 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.
  2. 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.
  3. 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

  1. moved this to Triage in Office queueon Nov 3, 2026
  2. self-assigned this
    on Nov 10, 2026
  3. moved this from Triage to In review in Office queueon Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions