Conversation
Open could create a logical connection after Close had already shut down all existing connections. Reads on that new connection would then block indefinitely because no subsequent mux shutdown would close it. Check the closed channel under the connection lock before returning or creating a connection. Cover explicit closure and peer disconnection for Open, Dialer, and Listen with both existing and new connection IDs. Assisted-by: OpenAI Codex Signed-off-by: xinjun.jiang <xinjun.jiang@daocloud.io>
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.
A mux can close after its trunk connection fails while its consumer is still opening the logical connections.
Opencurrently succeeds after that closure. For a new connection ID, the returned connection is never closed by the already completed mux shutdown, soReadblocks indefinitely.DialerandListeninherit the same behavior.Check the mux's closed channel while holding the connection lock, returning
net.ErrClosedbefore looking up or creating a connection. Add regression coverage for existing and new connection IDs after explicit shutdown and peer disconnect, including the dialer and listener entry points.Validation:
go test -race ./pkg/net/... -count=1make test(main module race tests and the plugin test targets)make build-checkgolangci-lint run --allow-parallel-runners ./...(v2.12.0, matching CI): no issues.The new regression fails on the unchanged base and passes with the fix. The socket tests use local Unix socket pairs; no live container runtime or Kubernetes end-to-end testing is claimed.
AI assistance: OpenAI Codex assisted with the investigation, implementation, tests, and PR description.