Fix TCP relay source handover and shutdown races - #263
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
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.
Fixes #262. Related to #247 and #261.
Give each TCP relay instance its own cancellation context and join its listener/connection workers before
Startreturns, including after partial startup failure. Install sources in accept order before launching readers, close sockets when readers finish, and make source dialing context-aware.Regression tests cover both source modes, failures in duplex/readable port setup, delayed reader scheduling, EOF cleanup, canceled dialing, and immediate port reuse after shutdown. The startup rollback, delayed reader, EOF, and canceled-dial regressions fail against unmodified
main.Validation
macOS arm64, Go 1.27.1:
go test -race -count=1 -timeout=3m ./pkg/...passed independently and with Synchronize TCP relay tests with provider readiness #261.-cpu=1,2,4, independently and with Synchronize TCP relay tests with provider readiness #261.go vet ./pkg/tcprelayandgit diff --checkpassed.Test limitation
A 90-run full relay stress test combined with #261 hit one
TestRelayReadablestartup failure (bind: address already in use). The existing test helper releases an ephemeral port before the provider binds it, leaving a separate port-allocation race. No race-detector warnings or lifecycle-regression failures were reported in that run. This runtime fix does not change test-port allocation.This PR and #261 change disjoint files and target
mainindependently.