Repository navigation
fix: reclaim failed destination TCP dial results - #37
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The ownership fix is consistent across transports and comprehensively validated without exposing private errors.
Review effort: Balanced
Findings: None
What changed in this PR
Ensures failed relay destination dials reclaim owned connections while preserving sanitized responses.
Changes:
- Close non-nil connections returned with dial errors.
- Reject successful dials returning nil connections.
- Add four-transport ownership, session-preservation, and half-close tests.
| File | Description |
|---|---|
internal/tunnel/common.go |
Handles failed native destination results safely. |
internal/tunnel/web_handler.go |
Handles failed H2/H3 destination results safely. |
internal/tunnel/destination_dial_error_ownership_test.go |
Tests ownership across authenticated transports. |
internal/tunnel/destination_dial_result_preserve_test.go |
Tests nil results and healthy session preservation. |
docs/DEPLOYMENT.md |
Documents relay dial ownership behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Reclaim a non-nil TCP connection returned with a custom destination Dialer's setup error. Cover native QUIC/TLS and authenticated WebH2/WebH3 exits.
(nil, nil)results before a success reply or invalid destination wrapper.StatusDialFailedand verified web HTTP 502 responses.Validation on
351b3755a2372899a71aae862915033a5d2b7c92make checkandmake race: full repository, terminal exit 0; no existing test or budget relaxed.d340950ec944d0565e14c4707a3808d4946eb28d732e552e0ecf6d3d81ffb2c9. Pull never, network none, read-only, no capabilities, resource bounds, Go/container/host 50/55/60-second ceilings.Exact-head GitHub verification
All workflows completed on attempt 1 against
351b3755a2372899a71aae862915033a5d2b7c92:netem integration passed.No failed job rerun or gate relaxation.
Post-merge main verification
PR #37 is squash-merged as
cf8f97ca179098fd6ddf85b7245a0d946f654796. Local main, origin/main and the live remote main ref match. Treedf0d5b86648392fb024e8a341f4f4a0025348e70is identical to tested PR head351b3755a2372899a71aae862915033a5d2b7c92; the five frozen file hashes also match the Linux inventory. Independent local audit confirms clean status, the exact five-file scope and unchanged local tags/release configuration.netem integration passed.The separate deterministic HTTP idle Shutdown duplicate-close finding remains the next iteration; it is not changed here.
Scope and evidence limits
Only configured/custom Dialers were demonstrated to return a live owned connection alongside an error; no built-in Dialer is claimed to do so, and no indefinite descriptor leak is claimed. The earlier diagnostic covered QUIC/H2 only; the four-transport coverage above comes from actual executed public-client tests.
Nil-result real-Serve tests run only on guarded production; no unsafe old-production goroutine panic baseline was attempted. A shell redirection failed before the initial root baseline test started because its new evidence directory was missing; the actual rerun completed and is retained separately.
This is source-build behavior, not part of v1.0.1. No dependency, default budget, new release/tag, remote host, Docker image/daemon mutation or large capture campaign is changed. No traffic-equivalence or comparative-performance claim is made. The separately diagnosed HTTP duplicate-listener-close Shutdown return is not fixed by this destination patch.