-
Notifications
You must be signed in to change notification settings - Fork 18k
net: dialTCP should support cancelation #11225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
CL https://golang.org/cl/12712 mentions this issue. |
I've also changed TestDialSerialAsyncSpuriousConnection for consistency, although it always computes a finalDeadline of zero. Note that #11225 is the root cause of the socket leak; this just hides it from the unit test by restoring the shorter timeout. Fixes #11878 Change-Id: Ie0037dd3bce6cc81d196765375489f8c61be74c2 Reviewed-on: https://go-review.googlesource.com/12712 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Paul Marks <pmarks@google.com>
Also please follow #11626. |
CL https://golang.org/cl/17821 mentions this issue. |
With the pending fix, is it expected that If so, then next we can rewrite |
@pmarks-net, I didn't do Windows or Plan 9 yet. I wanted to see what people thought about it first before I did more. |
(but yes, cleaning up |
I don't think this can be closed until tcpsock_plan9 is also cancelable, unless it's acceptable to force Making |
Plan 9 doesn't really matter. You can force DualStack to false there. Don't let Plan 9 hold anything back. |
CL https://golang.org/cl/17880 mentions this issue. |
Updates #11225. Change-Id: I6c33d577f144643781f370ba2ab0997d1c1a3820 Reviewed-on: https://go-review.googlesource.com/17880 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL https://golang.org/cl/19390 mentions this issue. |
The previous Happy Eyeballs implementation would intentionally leak connections, because dialTCP could not be reliably terminated upon losing the race. Now that dialTCP supports cancelation (plan9 excluded), dialParallel can wait for responses from both the primary and fallback racers, strictly before returning control to the caller. In dial_test.go, we no longer need Sleep to avoid leaks. Also, fix a typo in the Benchmark IPv4 address. Updates #11225 Fixes #14279 Change-Id: Ibf3fe5c7ac2f7a438c1ab2cdb57032beb8bc27b5 Reviewed-on: https://go-review.googlesource.com/19390 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL https://golang.org/cl/20493 mentions this issue. |
This allows TestDialerFallbackDelay to pass again on machines where IPv6 connections to nowhere fail quickly instead of hanging. This bug appeared last month, when I deleted the slowTimeout constant. Updates #11225 Fixes #14731 Change-Id: I840011eee571aab1041022411541736111c7fad5 Reviewed-on: https://go-review.googlesource.com/20493 Run-TryBot: Paul Marks <pmarks@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
…cel on Plan 9 TestDialParallel, TestDialerFallbackDelay and TestDialCancel require dialTCP to support cancellation, which has been implemented for Plan 9 in CL 22144. Updates #11225. Updates #11932. Change-Id: I3b30a645ef79227dfa519cde8d46c67b72f2485c Reviewed-on: https://go-review.googlesource.com/22203 Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
DualStack mode requires dialTCP to support cancellation, which has been implemented for Plan 9 in CL 22144. Updates #11225. Updates #11932. Change-Id: I6e468363dc147326b097b604c122d5af80362787 Reviewed-on: https://go-review.googlesource.com/22204 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Brad suggested that I file this bug during the Happy Eyeballs code review.
Currently, the
dialTCP
function will block until the operation succeeds, fails, or times out. If a dialer decides that the connection is no longer useful, it must be leaked and left to die on its own time.Instead, there should be some cancelation mechanism (e.g. a closeable
chan struct{}
) which causesdialTCP
to clean up its socket and returnerrCanceled
immediately. This might also be exposed via theDialer
interface, and for non-TCP protocols, so regular users can take advantage of it.The text was updated successfully, but these errors were encountered: