Repository navigation
test(runtime): close every connection when a live node stops - #601
Merged
Merged
Conversation
Since nodes keep an idle connection open for 65 s, a connection that went idle after `server.close()` held the stop, and with it the peer-delegation teardown, past the 20 s hook timeout. The harness now closes all of a node's connections as it stops; production keeps its keep-alive. Closes #572 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mrgoonie
enabled auto-merge (squash)
October 7, 2026 16:42
Contributor
Author
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
Contributor
Author
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #572. The live-node test harness now closes every connection when a node stops.
Cause
#557 raised the server's
keepAliveTimeoutto 65 s.server.close()closes only the connections that are idle at the moment it is called. A connection that goes idle after that moment stays open until its keep-alive timeout runs out, which is 65 s. While it is open,nodes.stopAll()inafterEachwaits, so the hook hits its 20 s timeout.Reproduced on Windows: with the "confirms the sender's stop…" and "stops a worker running here…" tests, 3 of 10 runs failed with
Hook timed out in 20000ms. Instrumentation showed the laptop node's server still holding one open connection with no request in flight.Fix
LiveNode.stopnow callsserver.closeAllConnections()right afterserver.close(). It is a test-only change; production keeps its 65 s keep-alive.Verification
pnpm verifyrun on this machine: 7346 tests passed and 4 browser tests timed out. Those 4 aresession-preview-real,task-dispatch-browser, andbrowser-playwrightdriverandinjection. None of them useslive-nodes, and they passed 36 of 36 when rerun on their own, so they timed out from load.Note
The production shutdown in
apps/runtime/src/main.tscallscloseIdleConnections()once, the same way. So a connection that goes idle after that call could delay exit by up to 65 s. That is noted on #572 and is not changed here.🤖 Generated with Claude Code