Repository navigation
Description
Problem
The authoritative procfs membership scan recognises ENOENT but not ESRCH as the same confirmed process-exit condition.
ProcessIdentity::enumerate_group_with fails closed by design and whitelists exactly one skip:
Err(err) if err.kind() == std::io::ErrorKind::NotFound => continue,
Err(err) => return Err(err),Linux procfs reports the same vanished PID two different ways depending on when the task dies relative to the access, and only one of them reaches that arm:
PID vanished before the procfs access completes
│
├── ENOENT → ErrorKind::NotFound → classified GONE (correct)
└── ESRCH → ErrorKind::Uncategorized → classified UNKNOWN/ERROR (defect)
The policy is not wrong and does not need widening. The classifier is incomplete for its authority: one semantic class — "the PID is gone" — has two raw representations, and only one is recognised.
Observed as a CI flake on an unrelated docs PR (#136), where the second representation surfaced as CleanupFailure("membership query failed: No such process (os error 3)") from supervisor_detects_and_cleans_remaining_grandchild.
Authority
Documentation/filesystems/proc.rst, torvalds/linux @ f5bbbfec59b4e2fb7520a91de3df8a6174325d6a, blob 2ccd5b2dfdd33a98f4491b0b9f48c6877370c309, lines 124–127:
Operations on open
/proc/<pid>file descriptors corresponding to dead processes never act on any new process that the kernel may, through chance, have also assigned the process ID<pid>. Instead, operations on these FDs usually fail withESRCH.
The second sentence documents the outcome; the first is what makes classifying it as gone sound rather than merely convenient — it rules out the PID-reuse hazard that would otherwise be the reason to fail closed here.
Reproduced directly, both representations, on this exact boundary:
open while alive, kill, reap, then read → errno 3 (No such process)
open after the PID is already gone → errno 2 (No such file or directory)
The neighbouring signalling path already treats ESRCH from killpg as "the group is already gone, that is success" (host_boundary.rs:117-121). Consistent, though on its own that is about kill(2) and not evidence about procfs — the kernel documentation above is.
Invariant
Only evidence that the PID is gone may be skipped; unresolved I/O remains fail-closed.
Acceptance
ENOENTremains a benign exit race.ESRCHis classified as the same exit race.EIO,EACCES, and a readable-but-malformedstatstill fail closed.- The predicate is a named, narrow classifier over the procfs exit race — matched on
raw_os_error() == ESRCH, never onErrorKind::Uncategorized, which is a bucket for unmapped errnos and carries no "the process is gone" meaning. Its name should say proc and exit so it cannot be reused for arbitrary filesystem I/O later. ProcSource::stat's documented contract names the Linux procfs semantics —ENOENT/ESRCHas two representations of a vanished PID — rather than implyingstd::io::ErrorKindis itself the authority.- Deterministic injected regression coverage, not a timing-dependent test:
ENOENTskipped,ESRCHskipped,EIO/EACCESpropagated, malformed-readablestatpropagated as a membership failure. The last three are the ones that prove the fail-closed policy was not weakened.
Scope
o7-worker only. Deliberately not fixed in #136, which is one document with no implementation changes; the failure is in unmodified worker code and does not belong on that branch.
Activity