Skip to content

Kill a timed-out test's whole process group in the test runner - #241

Merged
vicmaster merged 1 commit into
masterfrom
runner-timeout-kill-group
Nov 1, 2026
Merged

vicmaster merged 1 commit into
masterfrom
runner-timeout-kill-group

Conversation

@vicmaster

Copy link
Copy Markdown
Owner

The test runner's 180s timeout sent SIGKILL to the npx wrapper only. The tsx process under it was orphaned and kept the output pipes open. The runner resolves a test on the pipes closing, so a single hung test stalled the whole run until someone killed that process by hand. This happened twice in Phase 30 (slices E and G), both times on a one-off Chrome hang in test-text-props.ts, and the second time a full-tier run sat for 25 minutes.

The fix

  • Each test now runs in its own process group (detached: true), and the timeout kills the whole group. The hung test is reported as timed out and the run moves on.
  • A process in its own group doesn't receive the terminal's Ctrl-C, so the runner now passes SIGINT and SIGTERM on to the running test before it exits. Without this, interrupting the runner would leave the test running.
  • FRAMESMITH_TEST_TIMEOUT_MS overrides the 180s timeout, so the new test can run in seconds.

Known limit

A browser that Puppeteer launched can still outlive a killed test. Puppeteer starts Chrome in a process group of its own, so killing the test's group doesn't reach it. That was already true before this change.

Testing

  • New test-runner-timeout.ts (fast tier) runs the real runner in a temp dir with one test that never exits and one that passes, using a 3s timeout. It checks four things: the run finishes, the hung test is reported as timed out, the other test still passes, and no process of the hung test is left running. It fails on the old runner (the run never finished; its own 45s guard tripped) and passes in 5s now.
  • By hand: interrupting the runner with SIGINT during a hung test leaves no test process behind.
  • npm test: 80/80.

The timeout killed only the npx wrapper; the orphaned tsx kept the output pipes open, so one hung
test stalled the run until someone killed it by hand.
@vicmaster
vicmaster merged commit e38f7f5 into master Nov 1, 2026
3 checks passed
@vicmaster
vicmaster deleted the runner-timeout-kill-group branch November 1, 2026 23:21
@vicmaster vicmaster mentioned this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant