mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-18 02:42:25 +02:00
fix(browse): SIGKILL abandoned Chromium on close-race timeout (suite wedge)
close()'s launched-mode path raced browser.close() against 5s and on timeout ABANDONED the child: this.browser nulled, process handle lost, Chromium alive holding keep-alive connections into test servers whose stop() then waits forever. Reproduced twice as an intermittent (~50%) whole-suite wedge — a 44min 0.1%-CPU hang pinned by a leaked LISTEN socket, and a 400s hang with commands.test.ts teardown in flight. The child handle is now captured BEFORE the race and SIGKILLed on race-timeout (launched mode only; headed keeps context.close). Race timers are unref'd so a successful close stops pinning the caller's event loop for the window. The four browse test servers force-close keep-alives (stop(true)) as belt-and-braces. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
576112e7cf
commit
6a2e589cbd
@@ -43,7 +43,7 @@ beforeAll(async () => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
try { testServer.server.stop(); } catch {}
|
||||
try { testServer.server.stop(true); } catch {} // force-close keep-alives — a lingering Chromium connection otherwise blocks stop() forever
|
||||
// Close only this file's own browser — never process.exit(): bun test runs
|
||||
// all files in one process, so a delayed exit kills the whole suite
|
||||
// (see test/no-suicide-exit.test.ts). close() can hang when the browser
|
||||
|
||||
Reference in New Issue
Block a user