fix(server): detect dead clients and reclaim their sockets - #471
Merged
sjtrny merged 2 commits intoAug 22, 2026
Merged
Conversation
The server never noticed a disconnected client. The control channel task only wrote heartbeats, and writes keep succeeding on a half-closed socket, so the ControlChannelHandle stayed in the map, its shutdown_tx never dropped, and the data channel pool's listening sockets leaked. Read the control channel concurrently with writes (the client sends nothing after the handshake, so any completed read means it disconnected), and remove the handle from the map when the control channel ends so shutdown_tx drops and the pool is torn down. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Avoid retaining the control-channel map from cleanup tasks and treat unexpected client data as a protocol violation. Cover half-closed channels, map teardown, listener release, and heartbeat-disabled client shutdown.
sjtrny
force-pushed
the
fix/server-control-channel-socket-leak
branch
from
August 22, 2026 07:52
47725c0 to
cdb7720
Compare
Contributor
|
Thanks! |
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.
Problem
Fixes #470. The server only wrote to control channels, so a half-closed client could leave its handle, data-channel pool, and service listener alive indefinitely.
Changes
Regression coverage
Validation