Repository navigation
test(windows-plugin): walk the owned tree as stop does, so a reused parent number pulls in nothing - #2202
Conversation
…arent number pulls in nothing The Windows test "starts after its launcher exits, stops its owned tree and restarts on Windows" built the server's tree with a plain parent walk. Windows keeps a dead parent's number on its children and hands that number on, so when a server process got such a number the walk took in long-lived unrelated processes and everything below them. On runs 40635841024 (#2185) and 40638822136 (#2193) the 128 and 123 "still owned" pids included the test runner's own pid (8248, 2228), which can never exit. The test now uses descendantProcesses, the reuse-aware walk stop itself uses, and after the deadline drops a member whose number a new process holds.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merging 48e6c04: omo-native-code-reviewer and Codex both pass this head. It fixes the |
|
Native Windows install on this head (48e6c04), run 40640646826: attempt 1 passed, and two reruns of only that job passed too (jobs 122669490489, 122670310311). The changed test ran each time: 27.9 s, 26.1 s, 26.5 s, like main's passing runs (23-27 s). |
Change
What was wrong. On Windows CI, "starts after its launcher exits, stops its owned tree and restarts on Windows" sometimes failed at "wait up to ten seconds for the Windows-owned process tree to disappear" (#2185, run 40635841024; #2193, run 40638822136).
stopitself had succeeded: it exited 0, andrun("stop")asserts that. The test then waited for its own list of "owned" processes, and that list was wrong. It held 128 and 123 pids, starting with boot-time system pids. It also held the test runner's own pid (8248 and 2228). The earlier test in the same file prints that number in "stopped Ovis (pid N)", because it recordsprocess.pid. The runner started before the server, so it can never be part of the server's tree, and it never exits.The test built that list with a plain parent walk (unchanged since #330). Windows keeps a dead parent's number on its children and gives that number to new processes. When a process in the server's tree got a number that long-lived processes still named as their parent, the walk pulled them in, and everything below them.
Is #2166 the cause? No. #2166 (the plugin lifecycle lock) does not change what
stopwaits for, andstopreturned 0 in both failures. Its Windows wait already usesdescendantProcesses(scripts/plugin.tsstopInTurn), the reuse-aware walk that skips a process older than its parent. The test's walk had this hole since #330. Whether it shows up depends on which numbers the runner hands out. Two hits half an hour apart, right after #2166 merged, look like timing on the hosted runners rather than something #2166 did, but that is not proven.Fix (test only). The test builds the owned tree with
descendantProcesses, the walkstopuses. After the 10 s deadline, it also drops a member whose number now belongs to a process with a different start time. A member with a missing start time, or a failed table read, stays on the list, so the check still fails closed. No product code changes.Validation
%TEMP%, throwaway profile, app data and temp folders,HERDR_TEST_MODE=unit, removed afterwards with no bun or herdr process left): the fixed test passed 30 of 30 runs. The unfixed test also passed 10 of 10 there. The failure needs a server-tree process to land on one of the few stale parent numbers, so it did not happen on this PC in 10 tries. The failures above and the walk comparison are the evidence for the cause, not a local reproduction.bun run check fast: green at the head commit (7968 unit tests pass, 0 fail).Reviews
process.pidfrom the earlier test, and that the order of the list matches a walk from boot-time system processes down to the runner. It found no way for the new check to pass while an owned process still runs. LOW notes: the test andstopnow share one walk (it keeps its own unit test inserver/shell-agent.test.ts); a backwards clock step between a parent's and a child's start; a reused number costing an extra table read within the 90 s timeout.CodeRabbit: test-only change, so no review requested.