net/http: 1.17.3 setting http.Client.Timeout returns context cancelled on Body.Close #49517
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
We use
"net/http"
with timeout specified as following:What did you expect to see?
We expected to close the resp.Body with no error regardless whether requests were successful or not.
What did you see instead?
We saw an intermittent

context canceled
error happening when closingresp.Body
even when the requests were successful and took far less than the specified timeout duration.When we downgraded to
go1.17.2
the issue disappeared.I managed to create this small program that behaves differently when being run using go1.17.3 and go.17.2:
running with **go1.17.3**
running with **go1.17.2**: (no `context canceled` at all)
I guess there are two questions from me:
Thanks
Andre
The text was updated successfully, but these errors were encountered: