Repository navigation
fix(plugin): close connections after failed listener handoff - #5614
Draft
shizukunacho wants to merge 1 commit into
Draft
shizukunacho wants to merge 1 commit into
shizukunacho 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.
WHY
A work connection can be scheduled before a proxy stops and reach the HTTP plugin after its listener has closed.
Listener.PutConnthen returns an error without taking ownership of the connection. The static-file plugin, HTTP bridge plugins and the non-CONNECT path ofhttp_proxydiscard that error, and the caller does not close connections retained by plugins. The connection remains open even though no HTTP server will handle it.Close the connection wrapper when listener handoff fails at those three call sites. A successful handoff continues to transfer ownership to the HTTP server.
The regression test creates each real plugin, closes it, then calls
Handlewith a pipe connection. AfterHandlereturns, the peer must observe EOF. All three cases timed out before the fix and pass afterward; the HTTP-proxy case supplies the method prefix needed to reach its non-CONNECT handoff.Validation on Windows/amd64 with Go 1.26.11:
go test ./pkg/plugin/client -count=1go test -race ./pkg/plugin/client -count=1go vet ./pkg/plugin/clientgo test -tags noweb ./client/proxy -count=1gofmtandgit diff --checkThe full end-to-end suite was not run locally.
Draft while #5612 remains open, in accordance with the repository's one non-draft PR limit.