fix(agent): retire replaced tunnel sessions - #541
Merged
Conversation
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.
What changed
Transport.Copyso multiplex routes receive an independent transport wrapperRoot cause
Runtime chain replacement overwrote the registry entry without retiring resources owned by the previous chain. Multiplexed dialers could therefore retain background sessions, sockets, and buffers after repeated tunnel updates.
Transport.Copyalso returned the original transport rather than the copy, causing route state to be shared.Impact
New connections switch to the replacement chain immediately. Existing multiplexed streams are allowed to drain, and the retired backing session closes after it becomes idle, avoiding both resource accumulation and unnecessary connection interruption.
Validation
cd go-gost/x && go test ./...— 67 tests passed across 205 packagescd go-gost/x && go test -race ./chain ./registry ./internal/util/sessionretire ./dialer/kcp ./dialer/mtcp ./dialer/mtls ./dialer/mws— 13 tests passed across 7 packagescd go-gost && go build -o /tmp/flux_agent_buildcheck .— successful