-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/http2: ioutil.ReadAll(req.Body) gets stuck on HTTP/2 #40816
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
I did some more digging through the stack traces and the server is handling 5 requests at this time: goroutine goroutine goroutine My understanding is that since RWMutex is writer-preferring, Now I'm wondering whether having 3 requests that are not reading request bodies immediately (because they have not acquired the shared lock) could prevent the other 2 requests that already have the shared lock from making progress, in particular due to the fact that request bodies are rather large ~20MB in size each. In other words - does HTTP/2 require all request handlers to read request bodies to ensure liveness? It appears that HTTP/1.1 server does not have this behavior (I'm guessing because there is no request pipelining). |
cc @fraenkel |
FWIW - we changed the code in Kopia to read all request payload before acquiring shared lock and got confirmation that it fixed the issue. If timely reading of request bodies is indeed required for liveness, perhaps it should be documented. |
/cc @bradfitz @tombergan per owners. |
hi @jkowalski , were you able to find any workarounds for this problem? I'm having it pretty consistently too with http2 |
See his last comment above. |
oh I misunderstood the problem then, thanks |
doesn't seem like anyone else has this problem? optimistically closing. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
tbd.
What operating system and processor architecture are you using (
go env
)?Debian/Buster (server)
Linux Mint (client)
What did you do?
This was reported by users of Kopia (backup tool). I can't personally reproduce this, but two users have reported it independently.
There's a client and server (HTTP+TLS), both compiled using golang 1.14.7. The client sends large blobs (~20 MB) to the server using PUT method on 1-4 parallel goroutines.
Sometimes the server gets stuck handling requests for no apparent reason. We have captured stack traces when this happens, both client and server-side:
(server) kopia/kopia#538 (comment)
(client) kopia/kopia#538 (comment)
In the stack traces you see that the server is stuck on ioutil.ReadAll() when reading from the request body for 3 minutes:
The client:
Server-side code is here:
https://github.com/kopia/kopia/blob/9a6dea898b79a47cab16a681f1a3310a1a38b820/internal/server/api_content.go#L62
Client-side code is here:
https://github.com/kopia/kopia/blob/923c91b5a45f48a042569bc38d0de26d1caa7377/internal/apiclient/apiclient.go#L44
According to the bug report, disabling HTTP/2 using
GODEBUG
resolves the issue.Full disclosure: I'm a Googler, but Kopia is my personal project and not affiliated with Google.
The text was updated successfully, but these errors were encountered: