Repository navigation
test(windows): end the unbound owner control's primary (LEAK row) - #12207
Conversation
…aking the harness pipe (#9564) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vhkd2Rg6pXt3emf3gMBRZF
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 29 minutes. View limit details
|
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- The cleanup command trusts PID values read from marker files; if a process exits and Windows reuses its PID, Stop-Process could terminate an unrelated process.
- If the primary exits between marker publication and Stop-Process, PowerShell may emit a terminating error before stopping the descendant, because both IDs are sent in one Stop-Process command.
Verification questions
- Confirm several failure paths can return before the spawned primary and descendant are stopped, preserving the pipe-holding LEAK behavior the patch intends to remove.
- Confirm the test does not assert that the unbound owned primary is terminated; it only stops it as cleanup after asserting the descendant survived.
- Confirm the Windows test now records and stops the owned primary as well as the descendant, matching the stated cleanup intent.
- Confirm the helper's primary PID marker is read only after the descendant marker is observed, but the marker write precedes descendant creation.
Parked follow-ups
- crates/ripr/src/process_owner.rs:925 — The cleanup passes previously recorded PIDs directly to Stop-Process. If either process exits and its PID is reused before cleanup, this can forcibly terminate an unrelated Windows process. Validate the PID's creation time or otherwise identify the owned process before signaling it.
Evidence gaps
- The PR claims nextest no longer reports a LEAK row, but the required cargo-test receipt is absent and the PR body says the Windows run result will follow.
- The claimed nextest LEAK fix is not proven by the changed test because cleanup happens after the descendant assertion and failures before cleanup can leave the primary holding the inherited pipe.
- Model proof intent was rejected by deterministic validation.
- The PR claim that the LEAK row is resolved is not yet supported by a completed Windows nextest receipt in the supplied evidence.
|
Sharded Windows run 41322998440 on af47b18 (nextest,
On the review's findings: the PID-reuse risk is limited to the 3 s between the hard kill and the cleanup in a test that owns both PIDs just recorded from live children; Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY — head af47b18
Review of record, independent of the author. The diff is test-only (process_owner.rs mod tests, Windows-gated) plus a changelog fragment. I read the full diff and the hosted Windows run; I could not run the Windows tests locally.
Does it stop the real survivors rather than mask the detector? Yes. In the unbound control the helper is hard-killed, leaving two survivors: the descendant sleeper and the owned primary PowerShell (which keeps the harness's inherited output pipe for its remaining 40 s, the LEAK source). The primary now writes $PID to {marker}.primary before spawning the descendant, and the descendant marker is still written last as the readiness signal, so the primary file is guaranteed present when the helper reads it. Cleanup now passes both PIDs to a single Stop-Process. The control keeps its meaning: leaked is computed from the descendant before any cleanup, and the assert on it is unchanged, so the control still proves an unbound owner leaks. The bound subject still asserts its descendant terminated, unchanged. Nothing about the leak detector or nextest config changes; the test just no longer leaves a process it created. Hosted evidence: run 41322998440 on this exact head, shard 2 shows PASS [6.517s] ... force_terminated_owner_ends_descendants_only_when_bound with no LEAK line in any shard (main showed LEAK at about 9 s). Shards 1–3 and doctests succeed. Shard 4 fails only on xtask tests::policy_checker_facade_runs_current_repo_checks at the 300 s cap, which is the known #12035 shard-timeout class, unrelated to this diff.
Can it kill anything outside the test? Only PIDs the test itself read back from marker files it just created, in temp_dir(), named with the test process's own PID, and removed before the helper starts so a stale file cannot be read. Stop-Process -ErrorAction SilentlyContinue tolerates an already-exited process. The residual risk is PID reuse if a survivor exited and its PID was recycled inside the 3 s window, which is negligible on Windows and the same exposure the existing descendant kill already carried. The bound mode reads its primary PID but discards it (_bound_primary_pid), so it kills nothing extra.
Non-blocking nit: if the primary marker read fails after the descendant marker was seen, the helper is killed but the descendant is left running for its 40 s. That path is already a test failure with an explicit error, so it costs a short leak only on failure.
Hosted Ripr Rust Small on GitHub Hosted / Rust gates was still in progress when I read the check-runs, so Ripr Rust Small Result is not green on this head yet. Merge needs it green on the exact head first.
Disposition: no blocking findings.
Generated by Claude Code
Governing issue or accepted claim: #9564
Acceptance delta (one sentence): The Windows force-terminated-owner test stops both survivors of its unbound control, so nextest no longer reports
process_owner::tests::force_terminated_owner_ends_descendants_only_when_boundas LEAK.What and why
In the sharded Windows advisory run the test passes but nextest flags it LEAK (8.5 s). The unbound control hard-kills the helper owner; the owned primary powershell (
Start-Sleep -Seconds 40) survives because the per-child job is not kill-on-close. The test stopped only the descendant, so the primary kept the harness's inherited output pipe for its remaining ~40 s.The helper now records its own PID (
<marker>.primary) before the readiness marker, and the control stops both PIDs. The bound subject case is unchanged.Evidence
cargo check -p ripr --lib --tests --target x86_64-pc-windows-gnu: clean for this change (3 pre-existing unrelated dead-code warnings).cargo xtask precommit: pass.Generated by Claude Code