Skip to content

test(runtime): close every connection when a live node stops - #601

Merged
mrgoonie merged 2 commits into
mainfrom
fix/live-nodes-close-connections
Oct 8, 2026
Merged

mrgoonie merged 2 commits into
mainfrom
fix/live-nodes-close-connections

Conversation

@mrgoonie

@mrgoonie mrgoonie commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #572. The live-node test harness now closes every connection when a node stops.

Cause

#557 raised the server's keepAliveTimeout to 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() in afterEach waits, 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.stop now calls server.closeAllConnections() right after server.close(). It is a test-only change; production keeps its 65 s keep-alive.

Verification

  • The same tests together with "could not be delivered" passed 15 of 15 runs. Before the fix, 3 of 10 runs failed.
  • pnpm verify run on this machine: 7346 tests passed and 4 browser tests timed out. Those 4 are session-preview-real, task-dispatch-browser, and browser-playwright driver and injection. None of them uses live-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.ts calls closeIdleConnections() 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

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

mrgoonie commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Review attestation: ready to merge at d28a1f178f3f3881bc4b3a76fee6deabf9d4695a, reviewed by agent:independent-reviewer.

A push to this PR makes this attestation stale; the new head needs its own review.

@mrgoonie

mrgoonie commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Review attestation: ready to merge at ad900117b3aad13002e526f3cf85d8d554d96641, reviewed by agent:independent-reviewer.

A push to this PR makes this attestation stale; the new head needs its own review.

@mrgoonie
mrgoonie merged commit ceb79fa into main Oct 8, 2026
21 of 22 checks passed
@mrgoonie
mrgoonie deleted the fix/live-nodes-close-connections branch October 8, 2026 02:04
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.

test(runtime): peer-delegation teardown times out when idle connections stay open

1 participant