net/http: add InactivityTimeout to http.DefaultClient #22982
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. |
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: