Repository navigation
Conversation
An external hostname can leave HTTP transport goroutines alive at the package leak check and can fail before certificate verification. Dial a local TLS test server and require an untrusted certificate instead.
Member
Author
|
I don't know what the goal of the original test was. This does change the test semantics |
Emyrk
marked this pull request as ready for review
December 4, 2026 16:32
This branch has not been deployed
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.
The bad TLS dial test could pass on any network error and leave an idle HTTP connection alive when the package checked for goroutine leaks, as seen in #610.
In a local reproduction, dialing
wss://totallyfake.nhooyr.ioreturnedfailed to WebSocket dial: expected handshake response status code 101 but got 200. TLS had succeeded. The server did not upgrade the connection, soDialreturned a nil WebSocket connection. The HTTP transport kept the underlying connection idle for reuse, and its read and write goroutines were still running at test shutdown. CI logged the goroutine stacks, not the HTTP status.x509.UnknownAuthorityError. The client now rejects the certificate during the TLS handshake, before an HTTP connection can enter the idle pool.Reproduction and verification
On
master(12c866f), running onlyTestBadDials/badReq/badTLSreproduced the twonet/httppersistent connection goroutines. With this change, the same subtest passed in 25 fresh race-enabled processes on each of Go 1.26.11 and 1.27.4. The full ordinary and race suites passed on both. This fixes the test fixture rather than adding a grace period toTestMainas proposed in #603.Coder Agents on behalf of @Emyrk.