Skip to content

flaky: windows-command.test.ts detached killChildren test times out at 20 s on the Windows unit job #1965

Todo

Description

@V3RON

What happened

src/ports/windows-command.test.ts, "ends a detached killChildren child through its conhost wrapper: the program and its child, not the grandchild", timed out at 20 s on the Windows unit job on main, twice: at c68b5e4 (CI run 46388831672) and at d002e60 (CI run 46385642954). It also did so once on PR #1958 (CI run 46398553224).

Error: Test timed out in 20000ms.
 ❯ src/ports/windows-command.test.ts:122:3

Other runs of the job on the same day passed; one took 6.8 s.

What you expected

The test passes on every run.

How to reproduce

Not reproduced locally: it runs on Windows only. The cause is not known; which step hung (the spawn, the pid files or the kill) is not in the log.

Environment

CI: windows-2025, job Unit tests (Windows), 20 s test timeout.

Written by an agent.

Activity

  1. added
    bug:new
    flaky-test
    on Nov 30, 2026
  2. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Correction to the last paragraph of What happened: a second run on PR #1958 timed out too, so 2 of 2 runs at cc0abbb did, against 2 of 17 at commits without that PR's code that I read. The flake exists on main, but that PR may make it worse. An A/B on the Windows runner is under way.

    Written by an agent.

  3. added
    os:windows
    on Nov 30, 2026
  4. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    A/B result, CI shard 3/3 in fresh VMs, 8 each (run): 5 of 8 timed out at cc0abbb (PR #1958), 0 of 8 at 10d4e2e. So that PR makes it much worse; that part is the PR's to fix. The timeouts on main remain this issue. An earlier interleaved run in one VM (20 each) had none on either side, so it needs the whole shard's load. The step that hangs is not known. One fix to my comment above: the 17 other runs include one at the PR's earlier version.

    Written by an agent.

  5. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Correction to my A/B comment: "that PR makes it much worse" is not established. A later run of the same shard at cfa46be (same product code as cc0abbb, the test now reports its steps) had 0 of 10 timeouts (run), at 7.4 to 9.7 s each. My earlier A/B changed which tests share the shard, since that PR adds a test file. Cause unknown.

    Written by an agent.

  6. self-assigned this
    on Nov 30, 2026
  7. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Seen on: fakes for the defect; Windows CI logs for the flake.

    src/ports/process-tree-kill.test.ts on bug/1965-repro: "a (children | grandchildren) kill whose PowerShell takes 15 s waits for it, rather than ending the process Node holds alone". spawn is a fake on a fake clock.

    $ pnpm exec vitest run --project unit src/ports/process-tree-kill.test.ts
    AssertionError: expected [ 'program alone' ] to deeply equal []   src/ports/process-tree-kill.test.ts:86
    AssertionError: expected [ 'conhost alone' ] to deeply equal []   src/ports/process-tree-kill.test.ts:86
    

    The flaky test's durations in 105 Windows CI jobs, 2026-11-29 15:03Z to 11-30 12:51Z:

                                       jobs  median  slowest pass  10.1-19.9 s  20 s timeouts
    started before 9457a8015 (08:42Z)    57   1.4 s         9.1 s            0              0
    started after                        48   6.5 s        10.0 s            0              8
    

    Root cause

    Defect. TASKKILL_TIMEOUT_MS (10 s, src/ports/process-tree-kill.ts:5) also bounds the PowerShell kill (line 93). Past it, the fallback (line 98) ends the process Node holds alone, so nothing ends the program under conhost and qemu. The test then polls 10 s for the child to die: 10 + 10 passes the 20 s test timeout, so no assertion shows. The empty gap from 10 to 20 s fits that; no failing log names the step. The slowdown starts with 9457a80 (#1935), which stopped test daemons running PowerShell, so this test likely gets the cold first start. In one job the non-conhost twin also timed out (20009 ms, run 46415165015). Not explained: the 5 of 8 in the A/B, whose commits lack 9457a80.

    Simplest fix

    Give the PowerShell kill its own 30 s limit (taskkill keeps 10 s), and the two real killChildren tests in windows-command.test.ts a 60 s timeout.

    fix tried, then restored: pnpm typecheck clean; reproduction, windows-command, process-runner,
    process-supervisor, child-window tests: 109 passed | 7 skipped (the win32 block skips on macOS)
    

    Alternatives rejected

    • Longer test timeouts alone: the test would fail on its assertion, and a real qemu would still be left running.
    • Warm PowerShell up in beforeAll: hides the same product defect.
    • taskkill /T as the fallback: it also ends the shared netsimd.

    Risk

    • 30 s is a guess: the 10 s limit hides how long a kill really takes.
    • A hung PowerShell delays the wrapper's end from 10 s to 30 s; the emulator's SIGKILL_REAP_TIMEOUT_MS (5 s) already gives up earlier.
    • Not run on Windows; the fix PR's Windows shards are its proof.

    Fast track

    • Defect: yes
    • Fix tried: no — the real Windows test could not run here; only the fake reproduction passed
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: no — a test-only change would leave users' kills at 10 s; the length of the limit is a choice

    Side findings

    Written by an agent.

  8. removed their assignment
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:newflaky-testos:windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions