Repository navigation
Close retired RPC connections after draining replies - #690
Merged
Merged
Conversation
Bun closes already-idle HTTP sockets on server.close, but sockets active at stop can remain reusable after replying. A TUI request following a reload can then reach the retired RPC dispatcher and receive unauthorized instead of reaching the successor. Mark draining replies Connection: close and destroy/await all remaining owned sockets after the native close callback drains replies. Keep short-lived info-log RPC fixtures out of Bun's pool and preserve that fetch option through the loopback guard, including redirects. Add deterministic regressions: old RPC source reaches the retired dispatcher after stop; old guard loses the pool opt-out and produces ECONNRESET. The original release log does not record port/socket reuse, so its exact ordering is not claimed as observed.
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.
Close retired RPC connections after draining replies. Worker delivery rebased onto main; see the commit messages.
Summary by cubic
Fixes a stale-connection race where the OpenCode TUI's
/claudemenu briefly errored with "unauthorized" or a dropped connection after a plugin reload.Connection: closeand destroys all remaining owned sockets after replies drain.Written for commit 5e4ba50. Summary will update on new commits.