-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: add InactivityTimeout to http.DefaultClient #22982
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
What change in particular are you suggesting? That a timeout of 0 convert to some default, or that the The former will break many programs, as there would be no way to disable the timeout. The latter would still break some, as they may depend on And there's always the question of what timeout to use. If it's too short, it will break far too many programs. If it's too long, to some people it will still "get stuck". Why not use a custom |
Maybe we can do a 3 minute timeout or something high. Enough other stuff breaks or times out around 3 minutes in the wild that this doesn't seem too invasive. Thoughts, @tombergan? |
I don't want to hijack this specific issue but I fully agree with all network operations (i.e. not just HTTP) having timeouts by default. We have been bitten so many times by components that don't allow to specify timeouts for network operations (or that have no sane default timeout) that is now one of the first things I check when evaluating the use of a new component/library. |
Maybe 3 minute is enough. |
Change https://golang.org/cl/116356 mentions this issue: |
I sent CL 116356 to add a 5 minute timeout, but right after I mailed it I realized it would break people wanting to do long downloads. I think the only conservative thing we could do by default is to add some sort of InactivityTimeout, but it's too late for that, so bumping to Go 1.12. |
thanks @bradfitz |
Per discussion with proposal review, retitled with understanding that step 2 is to set it to a good default in #24138. |
This was closed without reference to a CL. Was it fixed? |
It doesn't look fixed, and I'm not sure why @knightXun closed the issue. It's their decision to close it, though. |
cc @neild |
go/src/net/http/client.go
Line 110 in 1b9f663
Look at two code:
server.go:
client.go
when we run client.go, it will stuck. please notice it.
The text was updated successfully, but these errors were encountered: