Repository navigation
Conversation
Where PID 1 does not reap orphans (a container started without an init process), a killed descendant stays a zombie. Signal 0 still reaches a zombie and every process group that holds one, and a raw process table still lists it. Twelve boundary tests used one of those to decide that a stopped process or group was gone, so they failed in such containers although cleanup had worked: - desktopTaskReaderRunner: the cancelled reader's PID check (1). - mcpDoctor: waitForExit in both outliving-descendant cases (2). - kunaVersionProbeOwnership: five cases through the test launcher's ownedGroupCleanup, which reported "group remains live" for a group that held only zombies (5). The cause is this test-owned cleanup authority, not product cleanup confirmation. - desktopBuildOwnedCommand: the packing and setup family PID checks (2). - artifactVerifierCleanupOwner: the protocol process and descendant (1). - ownedCommand: the run-token sweep read the raw process table instead of the product's own liveProcesses view, which drops zombie rows (1). The first eight are the cases reported in morluto#11819; the last four were found by running every suite with a signal-0 stop assertion in the same container. Add observePosixProcessGroup, which lists a group's members from one ps table and keeps zombies apart from live members, and processHasStopped, which treats a POSIX zombie as stopped and keeps signal 0 on Windows, where no zombie state exists. Use them, the existing observePosixProcess, or the product's liveProcesses filter at each site. The testing guide now names these helpers for stop assertions. Validation: - Linux arm64 container without an init (npm as PID 1, uid 1000), Node 24.22.1. On main, the four originally reported files fail exactly the 8 reported cases (8 failed, 55 passed). A sweep of the 31 files that hold a signal-0 stop assertion (21 passed, including jadxIntegration and jadxJavaLifecycle; 5 skipped entirely) found the 4 further failures above plus 3 firmware resource-limit failures with a different cause (ProviderAdapterError instead of AnalysisResourceConstraintError), which this change does not address. With this change, the 7 affected files pass in the container. - macOS arm64: the 7 affected files pass (101 tests); format, typecheck, lint and architecture guards pass. - The real-zombie regression fails at its group assertion when the fixture reaps its child. Not run: the javascript-recovery suites (wakaruIntegration, wakaruFileOwnership, javascriptRecoveryMcp) skipped in the container, so the signal-0 group check in tests/fixtures/javascript-recovery/provider.ts is unverified there; firmwarePublicationDeadline and the macOS-only dmgCancellationReason also skipped. Fixes morluto#11819 Co-Authored-By: Claude Opus 5.5 <[email protected]>
[Low impact] The PR appears safe to merge, with the existing non-blocking fixture cleanup concern still open. Findings
Fix with agent prompt### Issue 1
tests/boundary/providers/posixProcessObservation.test.ts:186-192
If the container's PID 1 does not reap children, this test leaves one zombie behind on every run. The Python parent never calls `os.waitpid()`, and teardown kills it with `SIGKILL`. Waiting for the parent's `exit` event does not reap its child. Repeated runs consume process slots until the container stops.
Keep the child unreaped during the assertions, then ask the Python parent to reap it and exit. Reserve `SIGKILL` for fallback cleanup.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryUpdates test cleanup checks so exited zombies count as stopped instead of requiring their process-table rows to disappear.
Reviews (3) · Last reviewed commit: "test(process): count zombie descendants ..." · Reviewed by Greptile |
| const exited = once(parent, "exit"); | ||
| try { | ||
| process.kill(-group, "SIGKILL"); | ||
| } catch { | ||
| // The group is already gone. | ||
| } | ||
| if (parent.exitCode === null && parent.signalCode === null) await exited; |
There was a problem hiding this comment.
The fixture leaves zombies behind
If the container's PID 1 does not reap children, this test leaves one zombie behind on every run. The Python parent never calls os.waitpid(), and teardown kills it with SIGKILL. Waiting for the parent's exit event does not reap its child. Repeated runs consume process slots until the container stops.
Keep the child unreaped during the assertions, then ask the Python parent to reap it and exit. Reserve SIGKILL for fallback cleanup.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/boundary/providers/posixProcessObservation.test.ts
Line: 186-192
Comment:
**The fixture leaves zombies behind**
If the container's PID 1 does not reap children, this test leaves one zombie behind on every run. The Python parent never calls `os.waitpid()`, and teardown kills it with `SIGKILL`. Waiting for the parent's `exit` event does not reap its child. Repeated runs consume process slots until the container stops.
Keep the child unreaped during the assertions, then ask the Python parent to reap it and exit. Reserve `SIGKILL` for fallback cleanup.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
This still matters after #12034, and it now conflicts with What is left on
They fail on every run, also alone on an idle machine. Reading The port. Branch
Checked in that container. The three files run 35 of 35 with the port. To take it into this PR: git fetch https://github.com/Davmunrey/rea fix/process-stop-checks-zombie
git reset --hard FETCH_HEAD
git push --force-with-lease |
…12091) Where PID 1 does not reap orphans promptly, a killed descendant stays a zombie for a while. Signal 0 still reaches a zombie, and a raw process table still lists it, so four boundary tests decided a stopped process was alive although cleanup had worked. The stop assertions in artifactVerifierCleanupOwner and desktopBuildOwnedCommand now use processHasStopped. The run-token sweep in ownedCommand reads the product's liveProcesses view, which drops zombie rows. The testing guide says to assert a stop this way and not with signal 0. Ported onto current main from #11837. The helper and the first eight cases landed in #12034, so this keeps the four that remained. Co-authored-by: Dayan Kijege <[email protected]>
Summary
Where PID 1 does not reap orphans (a container started without an init process), a killed descendant stays a zombie. Signal 0 still reaches a zombie and every process group holding one, and a raw process table still lists it. Twelve boundary tests used one of those to decide a stopped process or group was gone, so they failed in such containers although cleanup had worked.
Fixes #11819
Problem and expected behavior
desktopTaskReaderRunner: the cancelled reader's PID check (1 test).mcpDoctor:waitForExitin both outliving-descendant cases (2).kunaVersionProbeOwnership: five cases, through the test launcher'sownedGroupCleanup, which reported "group remains live" for a group holding only zombies (5). The cause is this test-owned cleanup authority, not product cleanup confirmation (the issue's hypothesis).desktopBuildOwnedCommand: packing and setup family PID checks (2).artifactVerifierCleanupOwner: protocol process and descendant (1).ownedCommand: the run-token sweep read the raw process table instead of the product'sliveProcessesview, which drops zombie rows (1).The first eight are the cases reported in #11819; the last four were found by running every suite with a signal-0 stop assertion in the same container.
Change and scope
tests/support/process/observePosixProcess.ts: addobservePosixProcessGroup(members of one group from onepstable, zombies kept apart from live members) andprocessHasStopped(a POSIX zombie counts as stopped; Windows keeps signal 0, since it has no zombie state).observePosixProcess, or the product'sliveProcessesfilter at each site.docs/development/testing.mdnames these helpers for stop assertions.Test-only plus one testing-guide paragraph; no product code changes. Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.
Contract and boundary impact
observePosixProcess.tsowns process-stop observation in tests; productliveProcessesremains the product owner.psfailure is reported instead of being read as absence.Expected effects: test harness only; no product target interaction.
Evidence and regression coverage
posixProcessObservation.test.tscovers the group helper with a fakeps(members, other groups, malformed rows, diagnostics, exit failure) and a real zombie (Python forks a child that exits and is never reaped) showing that signal 0 still reaches it whileprocessHasStoppedreports it stopped. Making the fixture reap its child fails that test at its group assertion.npmas PID 1, uid 1000), Node 24.22.1, on main: the four originally reported files fail exactly the 8 reported cases (8 failed, 55 passed).tests/fixtures/javascript-recovery/provider.tsis unverified there; firmwarePublicationDeadline and macOS-only dmgCancellationReason also skipped. Three firmware resource-limit tests fail in that container with a different cause (ProviderAdapterErrorinstead ofAnalysisResourceConstraintError) and are not addressed.Validation performed
npm run test:focused --the 7 affected files, Linux container with this change — 101 passed, none skipped.npm run check:fast— typecheck, lint and architecture guards pass.npm run docs:check— passes.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.🤖 Generated with Claude Code