Skip to content

Close peer sessions as moved when a cluster node stops - #8565

Merged
jasnell merged 1 commit into
mainfrom
piscisaureus/cluster-drain-race
Nov 20, 2026
Merged

jasnell merged 1 commit into
mainfrom
piscisaureus/cluster-drain-race

Conversation

@piscisaureus

@piscisaureus piscisaureus commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

This makes rolling restarts preserve exactly-once execution for peer
calls. Previously, a call sent but not started could die with the
stopping node, returning 500 Network connection lost without retry.
This caused cluster-test CI flakes on TSan, ASan and coverage.

  • A stopping node refuses new peer calls as moved and new CONNECTs
    with 503. It drains started calls per session, sends an Abort carrying
    moved, then reads for peer EOF for at most about one second. The
    connection deadline still bounds shutdown.

  • Counts are per session, so a long-lived request such as a WebSocket
    holds only its own session open, up to the connections deadline.

  • Requests waiting for an object's handoff are relayed only within the
    in-flight deadline, including owner resolution and relay startup.
    Expired requests receive moved before running, so peers resend them.

  • Debug-port requests are always relayed. During shutdown they remain
    served and counted, while the cluster port serves only clustered-actor
    lookups.

  • Handoff starts and deadline-triggered moved responses are logged.

The exactly-once test fails 20 of 20 runs without the fix and passes 20
of 20 with it. The handoff-relay test fails 10 of 10 without its fix and
passes 40 of 40 with it. All cluster targets pass 40 runs each on
bazelflare.

Under heavy CPU and disk stress, the rolling-restart test lost requests
in about 12 of 200 runs on main. The remaining losses on the earlier
branch version were the handoff-relay case fixed here.

It applies to main on its own and does not depend on #8564.

Kind Lines Where
Implementation 395 cluster, actor, bridge, config, RPC factory
Tests 209 cluster-test.mjs, cluster-worker.js
Documentation 5 workerd.capnp comments
Total 609

@piscisaureus
piscisaureus requested review from a team as code owners November 18, 2026 00:50
@piscisaureus
piscisaureus requested a review from ry November 18, 2026 00:50

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 1eedb9f0.

This review, of 7e1e6d91

💬 Approved with comments — No correctness or security defects found. The change also narrows the cluster port to clustered-actor lookups. Two INFO notes cover shutdown-phase behavior.

Findings: 2 info (2 are inline comments on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 2 info

No correctness bugs. Two minor shutdown-behavior notes.

Recommendation: 💬 Optional Nits

  • [INFO] During stop, debug-port getActor requests are refused as moved, a peer-routing error that debug clients won't expect. (src/workerd/server/server/cluster.rs:550)
  • [INFO] After the Abort, the drain loop waits until the peer closes its side. (src/workerd/server/factory/worker-factory-rpc.c++:312)
View full review
  • Debug-port requests answered moved during stop. resolve_actor calls peer_channel(.., None), which goes through peer_request. Once refusing_peers is set, a debug client gets a peer-routing moved error. The doc comment says this is intended, but the description says --debug-port is unchanged. This only happens in the final shutdown phase.
  • Post-Abort drain waits for the peer to close. After the Abort is written, factory_accept_cluster_peer reads until EOF. A peer that never closes holds the session open until the connections deadline.

✅ All other checks passed

🔒 Security: ✅ LGTM

This change narrows the attack surface. The cluster peer port now serves only getActor, for clustered namespaces, and no longer exposes getEntrypoint to peers. The 403 authentication check in PeerConnection::connect is unchanged, and the new 503 refusal applies only after it.


📖 AGENTS.md: ✅ LGTM

No issues.


⚡ Performance: ✅ LGTM

The drain paths run once per stop, so they add no meaningful overhead.


📝 Documentation: ✅ LGTM

No documentation issues.


Reviewed commit: 7e1e6d91

Comment thread src/workerd/server/server/cluster.rs Resolved
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-lease-starvation branch from c180a34 to 1c6fd5c Compare November 18, 2026 00:56
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from 7e1e6d9 to 1eedb9f Compare November 18, 2026 00:56

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of c88c6b3d.

This review, of 1eedb9f0

💬 Approved with comments — No correctness or security defects found at this commit. The two INFO notes on shutdown-phase behavior from the earlier review still apply.

Findings: 2 info

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 2 info

No correctness defects. Two INFO notes on shutdown-phase behavior still apply.

Recommendation: 💬 Optional Nits

  • [INFO] During stop, debug-port getActor requests are refused with the peer-routing moved error. (src/workerd/server/server/cluster.rs:549)
  • [INFO] After the Abort, the drain loop waits until the peer closes its side. (src/workerd/server/factory/worker-factory-rpc.c++:311)
View full review
  • Debug-port getActor answered moved during stop. peer_request(None) returns moved("this instance is stopping") once refusing_peers is set. The debug port reaches that call through peer_channel(id, None). The doc comment says this is intended, but the description says --debug-port is unchanged. It only happens in the final stop phase.
  • Post-Abort drain waits for the peer's EOF. After it writes the Abort and calls shutdownWrite(), factory_accept_cluster_peer keeps reading until the peer closes its side. A peer that ignores the Abort keeps stop_peer_sessions waiting until the connections deadline. That deadline bounds the wait, so this delays stop but cannot hang it.

✅ All other checks passed

🔒 Security: ✅ LGTM

This change narrows the attack surface. The cluster peer port now serves only clustered-actor getActor lookups. The authentication check in PeerConnection::connect is unchanged, and the new 503 refusal applies only after it.


📖 AGENTS.md: ✅ LGTM

No issues.


⚡ Performance: ✅ LGTM

The drain paths run once per stop, so they add no meaningful overhead.


📝 Documentation: ✅ LGTM

No documentation issues.


Reviewed commit: 1eedb9f0

@codecov-commenter

codecov-commenter commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 5.12821% with 222 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.57%. Comparing base (a034bcb) to head (aebd6de).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/workerd/server/factory/worker-factory-rpc.c++ 0.00% 73 Missing ⚠️
src/workerd/server/tests/cluster/cluster-worker.js 0.00% 45 Missing ⚠️
src/workerd/server/server/cluster.rs 0.00% 43 Missing ⚠️
src/workerd/server/server/actor.rs 25.00% 36 Missing ⚠️
src/workerd/server/server/config.rs 0.00% 23 Missing ⚠️
src/workerd/server/server/bridge.rs 0.00% 1 Missing ⚠️
src/workerd/server/server/run.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8565      +/-   ##
==========================================
- Coverage   66.72%   66.57%   -0.16%     
==========================================
  Files         797      797              
  Lines      204156   204630     +474     
  Branches    31724    31734      +10     
==========================================
+ Hits       136231   136232       +1     
- Misses      49329    49797     +468     
- Partials    18596    18601       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-lease-starvation branch from 1c6fd5c to b1c6ad6 Compare November 18, 2026 01:38
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from 1eedb9f to c88c6b3 Compare November 18, 2026 01:39

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 7dda9f2c.

This review, of c88c6b3d

✅ Approved — Both earlier notes on stop-time behaviour are fixed, and no new correctness, security or performance issues were found in the changed code.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

  • resolve_peer_actor rejects namespaces that have no cluster, and the peer port does not implement getEntrypoint.
  • The new 503 refusal in PeerConnection::connect comes after the existing key check.
  • The Abort message is built only from an exception this process creates, so it carries no data from the peer.

📖 AGENTS.md: ✅ LGTM

No issues.


📋 Code Quality: ✅ LGTM

Both earlier notes are fixed at this commit:

  • peer_request refuses only peer sessions. Debug-port calls are served and counted.
  • The read-until-close after the Abort is capped at 1 s by PEER_CLOSE_TIMEOUT.

The refusal paths in actor.rs and cluster.rs happen before any work starts, so resending a refused call is safe.


⚡ Performance: ✅ LGTM

The new drain logic runs only during stop and is bounded by the 1 s close timeout and the connections deadline. Per-request counting costs an Rc increment and decrement.


📝 Documentation: ✅ LGTM

The updated ClusterConfig comment in workerd.capnp describes the new order of the peer drain.


Reviewed commit: c88c6b3d

@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-lease-starvation branch from b1c6ad6 to 58fc388 Compare November 18, 2026 03:27
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from c88c6b3 to 7dda9f2 Compare November 18, 2026 03:27

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 80d71be0.

This review, of 7dda9f2c

💬 Approved with comments — No correctness, security or performance problems in the changed code. One INFO: in the late part of a stop, debug-port requests can get a moved error from the handoff branch in actor.rs.

Findings: 1 info (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

Earlier notes stay fixed; one minor inconsistency for debug-port requests late in a stop.

Recommendation: 💬 Optional Nits

  • [INFO] Debug-port requests that wait on a handoff get moved once the in_flight deadline has passed, even though peer_request now spares them during stop. (src/workerd/server/server/actor.rs:971)
View full review

Both earlier notes are still fixed: peer_request refuses only peer sessions, and the wait for the peer to close after the Abort is bounded by PEER_CLOSE_TIMEOUT. closing resolves only after refusing_peers is set and the session's count reaches zero, so nothing new can be counted on a session after it closes.

One remaining inconsistency: the handoff branch at actor.rs:971-977 checks remote, which is also true for debug-port requests (peer_channel(.., None)). Once the in_flight deadline passes, those requests get moved instead of being forwarded. This goes against the peer_request doc comment, which says debug-port requests are served as before.


✅ All other checks passed

🔒 Security: ✅ LGTM

Peers are still authenticated by the cluster key before the new 503 refusal. The peer port now serves only clustered-actor lookups. The Abort reason is built from an exception this process creates, so it carries no data from the peer.


📖 AGENTS.md: ✅ LGTM

No issues.


⚡ Performance: ✅ LGTM

The new drain logic runs only during stop and is bounded by the close timeout and the connections deadline. Counting each request costs an Rc increment and decrement.


📝 Documentation: ✅ LGTM

The updated ClusterConfig comment in workerd.capnp matches the new drain order.


Reviewed commit: 7dda9f2c

Comment thread src/workerd/server/server/actor.rs Resolved
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from 7dda9f2 to 80d71be Compare November 18, 2026 03:35

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 441b6969.

This review, of 80d71be0

✅ Approved — The one earlier INFO (debug-port requests answered moved from the handoff branch) is fixed, and no new problems were found in the changed code.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

The cluster key still authenticates peers before the new 503 refusal. The peer port now serves only clustered-actor lookups.


📖 AGENTS.md: ✅ LGTM

No issues.


📋 Code Quality: ✅ LGTM

The handoff branch at src/workerd/server/server/actor.rs:973-977 now checks peer instead of remote. Debug-port requests (session == None) are therefore still forwarded after the in_flight deadline, which matches the peer_request doc comment. A moved error from peer_request is returned before any work starts, so the peer can resend the call safely. A session's closing future resolves only after refusing_peers is set and that session's count reaches zero.


⚡ Performance: ✅ LGTM

relays_handed_off is a cheap Instant comparison that runs once per handed-off request. The drain logic runs only during stop, and the close timeout bounds it.


📝 Documentation: ✅ LGTM

The ClusterConfig comment in workerd.capnp describes the drain order the code now follows.


Reviewed commit: 80d71be0

@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-lease-starvation branch from 58fc388 to 5e431f3 Compare November 18, 2026 04:52
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from 80d71be to 441b696 Compare November 18, 2026 04:52

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 44f9ccfd.

This review, of 441b6969

✅ Approved — No findings in this pull request, and the earlier notes are fixed at this commit.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No exploitable issues found.

  • Cluster key: PeerConnection::connect still checks the cluster key before the new 503 refusal.
  • Peer port: ClusterPeerPortImpl implements only getActor, and resolve_peer_actor rejects namespaces that are not clustered. A peer can no longer reach the full debug-port interface.
  • Peer close: the read-until-close after the Abort is limited to 1 s.

📖 AGENTS.md: ✅ LGTM

No issues.


📋 Code Quality: ✅ LGTM

No problems found in the changed code.

  • Refusing calls during stop: once refusing_peers is set, ClusterNode::peer_request returns moved before any work starts. Debug-port requests (session == None) are still counted and served.
  • Closing a session: a session's closing future resolves only after refusing_peers is set and that session's count reaches zero.
  • Handoff relay: the peer = remote && self.session.is_some() check keeps debug-port requests forwarded after the in_flight deadline.
  • C++ session close: ClosingStream sets reason before it throws, so the explicit Abort is written before the write side shuts down. The read-until-close is limited by PEER_CLOSE_TIMEOUT.

⚡ Performance: ✅ LGTM

No performance regressions found.

  • Per-session counting: the cost per request is negligible.
  • Handoff deadline checks: these are cheap Instant comparisons, made only for requests that waited on a handoff.
  • Drain logic: it runs only during stop. The connections deadline and timeout_at in run.rs limit how long it takes.

📝 Documentation: ✅ LGTM

The ClusterConfig comment in workerd.capnp matches the drain order the code follows.


Reviewed commit: 441b6969

@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from 441b696 to 44f9ccf Compare November 18, 2026 05:03

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of aebd6deb.

This review, of 44f9ccfd

✅ Approved — No findings at this commit, and the changes since the previous review (actor.rs, cluster-test.mjs) are correct.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

  • Cluster key: PeerConnection::connect still rejects a bad cluster key with 403 before the new 503 refusal.
  • Peer port: ClusterPeerPortImpl implements only getActor, and resolve_peer_actor rejects namespaces that are not clustered.
  • Peer close: the read-until-close after the Abort is limited to 1 s, and the connections deadline also bounds it.

📖 AGENTS.md: ✅ LGTM

No issues.


📋 Code Quality: ✅ LGTM

  • Refusing calls during stop: peer_request returns moved before it creates a Counted. Debug-port requests (session == None) are still counted and served.
  • Counters: Count::none and Signal::wait create the notified() future before they check the state, so a wakeup that arrives in between is not lost.
  • Handoff relay: with peer = remote && self.session.is_some(), only peer sessions get moved answers. The relay deadline is checked after the handoff wait, while resolving the owner, and again as the relay starts.
  • C++ session close: ClosingStream sets reason before it throws, so the explicit Abort is written before the write side shuts down. The read-until-close is limited by PEER_CLOSE_TIMEOUT.
  • Tests: the rolling-restart test asserts consecutive counts and a final state of all + 1. That checks that each call ran exactly once.

⚡ Performance: ✅ LGTM

Per-session counting costs very little per request. The deadline checks are cheap Instant comparisons, and they run only for requests that waited on a handoff.


📝 Documentation: ✅ LGTM

The workerd.capnp comments match the drain order the code follows.


Reviewed commit: 44f9ccfd

A stopping node exited as soon as no peer request it had started was
in flight. A peer's call that it had not started yet, still unread on
the session or not yet routed to an object, was cut off with the
process. The forwarder saw "Peer disconnected", which it treats as a
request that may have run, so the client got a 500 instead of a retry.

The node now ends its peers' sessions itself, once its own listeners
have finished:

* It starts no peer request from then on: one that reaches
  RoutedChannel is answered `moved`, before anything runs, and a new
  CONNECT is refused with 503, which the dialing peer reports as not
  delivered. The debug port's requests are still served, and counted
  until they end.
* Each session counts the requests started on it, and closes once
  that count is zero, so a long-lived request holds only its own
  session open, up to the connections deadline.
* A session closes with `moved` as the reason. A ClosingStream fails
  its reads, so capnp disconnects with that exception and sends it as
  an Abort, unless the connection is idle on its side. The node then
  sends an Abort itself, since an idle side may still have the peer's
  unread calls, which the peer would otherwise fail as plain
  disconnects. The peer fails every call it still has out on the
  session as `moved`, sends each again where the object runs now, and
  shuts its side.
* The node reads on until the peer's EOF, so no unread data turns the
  close into a reset that could drop the Abort, but for about a second
  at most, so a peer that never closes holds up the stop little. The
  KJ timer that bounds it advances only when the loop runs out of
  work; the connections deadline bounds the stop in any case.

Every call the Abort fails was not started: the node starts nothing
after the cutoff, and closes a session only once everything started
on it has finished.

A peer's request that waited here for its object's handoff is sent on
to where the object went only until the in-flight deadline, the time
work in flight on the object had. Released later, as when a handoff
runs late, it is answered `moved` before anything runs, and the peer
sends it there itself. Relayed, it could still be running when the
connections deadline cuts it off, as a call that may have run, which
the peer cannot send again. The deadline is checked again as the relay
starts, and bounds resolving where the object went, which can wait on
the bucket or a peer's dial: resolving runs nothing on the object, so
`moved` is still safe then. Each such answer is logged, as is the
start of the handoffs. The debug port's requests are still sent on,
since its clients do not retry on `moved`.

The cluster port no longer serves the whole debug port. It exposed
getEntrypoint (any service, stateless entrypoints included) and
getActor for ephemeral and non-clustered namespaces, none of which
was counted, so a peer could have started side-effecting work that a
stop would then Abort as `moved` after it ran. Peers only ever call
getActor on clustered namespaces, so a peer session now gets
ClusterPeerPortImpl: getActor for clustered namespaces only, with
every request counted on the session, and getEntrypoint
unimplemented. The debug port listener is unchanged.

The new cluster test runs two lanes of increments, one at a time
each, on stubs bound to the stopping node, across its exit, so that a
call lands while the node stops. It checks that each call applied
exactly once: every call succeeds, the counts have no repeats or
gaps, and the final count matches. It also holds an idle session to
the stopping node, and checks that the node's own Abort carries the
reason. Without this change, with that idle check left out, it fails
in 20 of 20 runs: 18 on "Network connection lost", 2 on a node that
never found a gap to exit in. With it, it passes 20 of 20.

Another test holds a request on a DO past the in-flight deadline, so
that its handoff ends late. Once the DO reports the request running on
the stopping node, and that node logs that its handoffs started, the
test sends a peer's request that waits for the handoff. It checks from
the stopping node's log that the peer's request was answered `moved`,
and that it ran where the DO went. Relayed instead, it fails in 10 of
10 runs on "Network connection lost"; with the `moved` answer it
passes 40 of 40.
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-lease-starvation branch from 5e431f3 to a0d00cc Compare November 18, 2026 06:06
@piscisaureus
piscisaureus force-pushed the piscisaureus/cluster-drain-race branch from 44f9ccf to aebd6de Compare November 18, 2026 06:06
@piscisaureus
piscisaureus changed the base branch from piscisaureus/cluster-lease-starvation to main November 18, 2026 06:07

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — No findings at this commit, and the changes since the previous review (actor.rs, cluster-test.mjs) are correct.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

  • Cluster key: PeerConnection::connect still rejects a bad cluster key with 403 before the new 503 refusal.
  • Peer port: ClusterPeerPortImpl implements only getActor, and resolve_peer_actor rejects namespaces that are not clustered.
  • Peer close: the read-until-close after the Abort is limited to 1 s, and the connections deadline also bounds it.

📖 AGENTS.md: ✅ LGTM

No issues.


📋 Code Quality: ✅ LGTM

  • Refusing calls during stop: peer_request returns moved before it creates a Counted. Debug-port requests (session == None) are still counted and served.
  • Counters: Count::none and Signal::wait create the notified() future before they check the state, so a wakeup that arrives in between is not lost.
  • Handoff relay: with peer = remote && self.session.is_some(), only peer sessions get moved answers. The relay deadline is checked after the handoff wait, while resolving the owner, and again as the relay starts.
  • C++ session close: ClosingStream sets reason before it throws, so the explicit Abort is written before the write side shuts down. The read-until-close is limited by PEER_CLOSE_TIMEOUT.
  • Tests: the rolling-restart test asserts consecutive counts and a final state of all + 1. That checks that each call ran exactly once.

⚡ Performance: ✅ LGTM

Per-session counting costs very little per request. The deadline checks are cheap Instant comparisons, and they run only for requests that waited on a handoff.


📝 Documentation: ✅ LGTM

The workerd.capnp comments match the drain order the code follows.


Reviewed commit: aebd6deb — same changes as 44f9ccfd, so this is that commit's review (no new review was run; line numbers are as of 44f9ccfd)

@ry ry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI] LGTM. I traced the exactly-once argument and it holds:

  • Calls are counted at start_request.
  • Once the node is refusing, a call is answered moved before anything runs.
  • Calls that were never read get the Abort.
  • A session's count drops only when the peer releases the call's capability (kjToCapnp(startRequest(...))), so zero means the peer is done with every call that started.

Non-blocking:

  • The hand-written rpc::Message Abort (needed because capnp sends none on an idle connection) ties this code to TwoPartyVatNetwork's framing. An upstream capnp option to always send the Abort would be cleaner; maybe worth asking Kenton.
  • At the connections deadline, a session held open by a WebSocket or a returned RpcTarget is dropped without an Abort. A call on it that was never read then fails as a plain disconnect and isn't resent. The window is small; I'm mentioning it so it's a known limit.
  • PEER_CLOSE_TIMEOUT runs on the KJ timer, so it starves the same way the lease does (the comment says so).
  • resolve_peer_actor repeats resolve_debug_actor's namespace lookup; one helper would do.

@piscisaureus
piscisaureus requested a review from jasnell November 19, 2026 23:17
@jasnell
jasnell merged commit df88962 into main Nov 20, 2026
44 of 48 checks passed
@jasnell
jasnell deleted the piscisaureus/cluster-drain-race branch November 20, 2026 01:38
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.

4 participants