Skip to content

fix: make shutdown tests reliable on windows-latest#2241

Closed
triuzzi wants to merge 1 commit into
ChromeDevTools:mainfrom
triuzzi:fix/windows-shutdown-budget
Closed

fix: make shutdown tests reliable on windows-latest#2241
triuzzi wants to merge 1 commit into
ChromeDevTools:mainfrom
triuzzi:fix/windows-shutdown-budget

Conversation

@triuzzi

@triuzzi triuzzi commented Jun 21, 2026

Copy link
Copy Markdown

Problem

tests/shutdown.test.ts flakes on windows-latest, for two distinct reasons.

1. The stdin-EOF budget is too tight for Windows teardown. On a recent main run:

✖ exits within budget on stdin EOF after Chrome launch
  AssertionError: stdin-EOF shutdown took 6451ms (budget 3000ms)
ERROR: The process with PID 5496 (child process of PID 5024) could not be terminated.

The graceful path tears down the Chrome process tree via taskkill /T, far slower than POSIX teardown (~6.5s observed vs <500ms) and noisy with benign "could not be terminated" retries, so the flat SHUTDOWN_BUDGET_MS = 3000 is exceeded. --test-concurrency=1 (#2205) reduced overlap but doesn't change this budget.

2. The signal tests don't exercise graceful shutdown on Windows. child.kill('SIGTERM'|'SIGINT'|'SIGHUP') maps to TerminateProcess on Windows (no POSIX signals), so the server's handlers never run — those three tests hard-kill instantly, assert nothing about graceful shutdown, and leak the Chrome process tree.

Fix

  • stdin-EOF budget → 8000ms on Windows (3000ms elsewhere). 8000ms is above the real ~6.5s teardown but below the production force-exit backstop in chrome-devtools-mcp-main.ts (an unref'd setTimeout(process.exit(0), 10000)), so a genuine hang rescued by that backstop (exiting ~10s) is still caught.
  • Skip the three signal tests on Windowschild.kill(signal) can't trigger the graceful handlers there. stdin-EOF remains the cross-platform graceful-shutdown coverage.
  • Reuse the shared IS_WINDOWS from src/daemon/utils.ts.

Linux/macOS behavior is unchanged.

Related: #2137

@google-cla

google-cla Bot commented Jun 21, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@triuzzi triuzzi force-pushed the fix/windows-shutdown-budget branch from e13bfc2 to f3d63b1 Compare June 21, 2026 14:11
The shutdown tests flake on windows-latest, for two distinct reasons:

1. stdin-EOF: the graceful path tears down the Chrome process tree via
   `taskkill /T`, far slower than POSIX teardown (~6.5s observed in CI vs
   <500ms) and noisy with benign "could not be terminated" retries, so the flat
   3000ms budget is exceeded ("stdin-EOF shutdown took 6451ms (budget 3000ms)").
   Give Windows an 8000ms budget — above the real teardown but below the
   production force-exit backstop in chrome-devtools-mcp-main.ts (an unref'd
   `setTimeout(process.exit(0), 10000)`), so a genuine hang rescued by that
   backstop (exiting ~10s) is still caught.

2. SIGTERM/SIGINT/SIGHUP: Windows has no POSIX signals — Node maps
   child.kill(signal) to TerminateProcess, which hard-kills the server without
   running its handlers, so the graceful path never executes. Those three tests
   would assert nothing and leak the Chrome process tree on Windows; skip them
   there. stdin-EOF remains the cross-platform graceful-shutdown coverage.

Also reuse the shared IS_WINDOWS from src/daemon/utils.ts.

Related: ChromeDevTools#2137
@triuzzi triuzzi force-pushed the fix/windows-shutdown-budget branch from f3d63b1 to 951a452 Compare June 21, 2026 19:37
@triuzzi triuzzi changed the title fix: give windows-latest a larger shutdown budget fix: make shutdown tests reliable on windows-latest Jun 21, 2026
@triuzzi triuzzi closed this Jun 27, 2026
@triuzzi triuzzi deleted the fix/windows-shutdown-budget branch June 27, 2026 15:49
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