Skip to content

Relay: don't send a replacement Burrow client-gone for a backlogged Client of the Burrow it replaced - #1887

Open
dormouse-bot wants to merge 1 commit into
mainfrom
fix/relay-replacement-backlogged-client
Open

dormouse-bot wants to merge 1 commit into
mainfrom
fix/relay-replacement-backlogged-client

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

When a Burrow reconnects, the self-host Relay could send the replacement Burrow a client-gone for a Client it never bound. RelayHub.registerBurrow points the map at the new socket, then #dropClientsOf tells each Client bound to the old one burrow-gone. If that Client's socket is past MAX_RELAY_SOCKET_BUFFERED_BYTES, #toClient tears it down via unregisterClient, which still saw the old binding (it was only cleared after the send) and looked up #burrows.get(burrowId) — now the replacement. This PR clears the binding before the send.

The effect was a stray frame naming a clientId the new Burrow process never saw, which the registerBurrow doc comment and docs/specs/relay.md -> "Routing" ("their bindings are cleared at replacement time") say should not happen. Hosted's RelayRoom is not affected: its send never re-enters teardown.

A new case in relay/test/relay-displaced.test.mjs stalls a bound Client, replaces its Burrow, and asserts the replacement was sent nothing; it fails on main with the client-gone frame and passes here. The full relay suite passes locally.

…replaced its own

When a Burrow reconnects, RelayHub tells each Client bound to the old
socket burrow-gone. If that Client's socket is backlogged, the send tears
it down instead, and unregisterClient read the still-set binding and sent
client-gone to the replacement, which never bound that clientId. Clear the
binding before the send.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3c449c5
Status: ✅  Deploy successful!
Preview URL: https://21dbfde1.mouseterm.pages.dev
Branch Preview URL: https://fix-relay-replacement-backlo.mouseterm.pages.dev

View logs

This branch has not been deployed

No deployments
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