fix: name selected Docker connection in DMR transport errors - #4491
Merged
Merged
Conversation
The Docker system dial-stdio subprocess started via commandconn.New can exit quickly, surfacing errors on net.Conn Read/Write as a plain closed or broken pipe with no mention of which Docker connection was selected. Wrap the HTTP transport used for an explicitly selected Docker connection so a failed RoundTrip returns a *net.OpError naming the selected connection args, while preserving errors.Is, Timeout/Temporary and CloseIdleConnections behavior. The default, unselected transport path is untouched.
trungutt
approved these changes
Oct 1, 2026
aheritier
approved these changes
Oct 1, 2026
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.
Since #4481, DMR requests over an explicitly selected Docker connection dial through a subprocess started via
commandconn.Newfordocker system dial-stdio. That subprocess can exit quickly, and the resultingnet.ConnRead/Writecalls then surface as a bare closed or broken pipe error with no indication of which Docker connection (--host,--context, etc.) was in use.TestDMRDockerConnectionErrorNamesEnginecatches this on Linux but is flaky because of the race between the subprocess exiting and the first read, which also made it fail intermittently under #4490 even though that PR never touched this code path.This adds a
dockerTransportthat wraps*http.Transportand, on a failedRoundTrip, returns a*net.OpErrornaming the selected connection's args while preservingerrors.Ismatching,Timeout/Temporary, andCloseIdleConnections. The wrapper is only used when a Docker connection was explicitly selected; the default unix-socket path is untouched.resolve_test.goadds a deterministic table of dial errors, closed/broken pipes, EOF, and context cancellation/deadline so the error-naming behavior no longer depends on subprocess timing.Validated with
task build,task test, andtask lint, plus targeted repeats of the new and existing DMR tests (go test -race ./pkg/model/provider/dmr/dmrmodels -count=20, and Linux-only repeats ofTestDMRDockerConnectionErrorNamesEngineand the new deterministic test) to confirm no remaining flakiness.