-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
net/http: don't reuse connections that are experiencing errors [1.20 backport] #60301
Comments
@neild What do you think about this? Also, is this applicable to 1.19? |
Friendly ping @neild. :) |
Opened #60662 for a 1.19 backport. |
hello, btasker, your description inspired me. I've also encountered the problem with go version |
Hi @Yuhjiang Sure. I don't know your level, so apologies if any of this is teaching you to suck eggs. So, the bit you know:
That 15 minute delay in recovery is a product of the way that the Linux kernel handles TCP retransmissions between 2 and 4 above. When things are fully broken (i.e. the other end doesn't seem to be responding at all), there's an exponential back-off between each retry, for example
The minimum and maximum length of delay between the retries is defined by The number of retries, however, is governed by a sysctl - Eventually, the limit in MitigationSo, if you're looking to mitigate this through system config changes, you could do so via If you wanted to go a step further and adjust Does that help? Happy to go into more (or less) depth if needed |
@btasker Thank you very much for you detailed reply, I learn a lot from it. I've figured out the problem and the reason. Finally, you've been a big help. I will try |
Issue #60818 may also be relevant here. |
Given the report in #60818 of this fix causing a problem, moving back to CherryPickCandidate state so we can take another look. |
@alkmc the way we've mitigated is to instead enable H2 healthchecks. If you're importing But, http2Trans, err := http2.ConfigureTransports(transport)
if err == nil {
http2Trans.ReadIdleTimeout = time.Duration(ReadIdleTimeout)
} The count-down to One thing I did find though, there's something about setting |
The upstream issue isn't resolved yet, and Go 1.20 has exited its support window per https://go.dev/doc/devel/release#policy. |
Requesting that #59690 be considered for backport into the next 1.20 minor release
Relevant change in Gerrit is https://go-review.googlesource.com/c/net/+/486156
Rationale:
When encountered, this is a serious issue: requests are blocked until the kernel gives up on the socket (with default settings on a Linux host, that's around 17 minutes). If the operator restarts the application as a result, data loss may occur.
Although the fix is in
x/net
v0.10.0 it will not be available to most developers who likely importnet/http
(and so rely on the h2 bundle rolled into Go's releases)The only viable workaround is to disable the H2 client entirely via environment variable.
The text was updated successfully, but these errors were encountered: