Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/net/http2: closing a requestBody in the ServerHTTP method drops conn-level flow control #28634
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
I'm happy to explain the logs in more detail. Note that a quick work around for me is to do:
But I think this is a hack since I don't think the http2.Server should break if a http handler closed the body.
Yeah, I think this patch handles an unhandled edge case from #16481:
Applying that to my fork I see my issues go away. I'll work on a contained reproduction sometime next week, although maybe the patch gives you some insight on the issue?
(found this via #28204)
We ran into the same issue a few times, and it seems to be exactly as @jared2501 points out -- closing a request body on the server doesn't update the connection flow-control, leading to the connection stalling as the client side thinks it has exhausted the connection flow-control.
I have a repro up:
(Edit: The repro almost always fails on Linux within 100 iterations, but requires a higher number of iterations on other platforms).
The repro does the following in a loop:
It typically breaks in < 50 iterations, but sometimes (probably 5% of the time) makes it through 100 iterations. When it fails, we see a timeout on the echo call. If I remove the
Digging into the code for
The last call nils out the pipe buffer field
Logs from the repro running with
I tried the patch above on a branch, and it seemed to improve the success rate of getting through 100 iterations (probably to 10-20% instead of 5%) but it didn't seem to fix the issue.
Once the pipe is broken, any remaining data needs to be reported as well as any data that is written but dropped. The client side flow control can eventually run out of available bytes to be sent since no WINDOW_UPDATE is sent to reflect the data that is never read in the pipe. Updates golang/go#28634 Change-Id: I83f3c9d3614cd92517af2687489d2ccbf3a65456 Reviewed-on: https://go-review.googlesource.com/c/net/+/187377 Reviewed-by: Brad Fitzpatrick <email@example.com> Run-TryBot: Brad Fitzpatrick <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com>