Repository navigation
Reclaim half-open worker sockets before the lease fails the run - #13
Merged
Merged
Conversation
When a worker hellos with the same workerId while the prior socket still holds assignments, probe that socket with a short WebSocket ping. If it pongs, keep rejecting the duplicate (4002). If it does not, terminate the dead peer, bind assignments to the new socket, and continue adoption so Fargate reconnects can beat the lease instead of failing with lost contact. Fixes CONDUIT-S
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.
Fixes CONDUIT-S
A Fargate worker that reconnects with the same
workerIdwas rejected with close 4002 while the previous socket still held the assignment. A half-open socket never emitscloseand never answers a ping, so the real worker could not take the connection back. About 75 seconds later the lease expired and the run failed with lost contact.On
worker:hello, if the claimed run ids intersect that worker's assignments, the server now pings the old socket (300ms). A pong keeps the existing reject-the-duplicate behavior, including the impostor case where the new hello does not claim the active run. No pong means the peer is dead: the server terminates it, moves the assignments onto the new socket, and continues adoption without failing the run.npx vitest run src/server/workerControl.test.ts— 53 passed.