-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/net/http2: timeouts not respected on malformed data frames #57851
Comments
cc @neild @tombergan |
FWIW the URL in question is curl exits immediately:
|
Verified with go 1.19.5 @ darwin/arm64. For the record, this issue effectively creates a DoS, since there is (afaik?) no other way to enforce a timeout. |
here is the crux of the issue, a panic
|
The actual issue is failing to treat a 101 response as a PROTOCOL_ERROR. |
Change https://go.dev/cl/463095 mentions this issue: |
Change https://go.dev/cl/463497 mentions this issue: |
I don't think the handling of 101 responses is the problem; we'd encounter the same issue if the server had sent a 102 instead. The issue is that we're trying to process a DATA frame (or what looks like one) before the final headers have been read., which causes an internal panic. The panic is then obscured by a deferred cleanup function that gets stuck waiting on a mutex that was locked when the panic happened. |
Doesn't your fix handle #43965 as well? |
Yes, #43965 looks to be the same thing. And you have a fix for that one in CL https://go.dev/cl/330415 (exact same change as my CL, heh) which seems to have fallen through the Gerrit cracks somehow. |
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
)?Darwin / ARM64 / AMD64, but also reproduced on Linux / AMD64.
What did you do?
Run the following code with server that completes TLS handshake, but then just sends random raw data.
In other words, our client never receives frame with
flags=END_STREAM
.What did you expect to see?
After 3 seconds, the connection is aborted.
What did you see instead?
The connection hangs indefinitely.
Additional Context
We've seen this happen with Cloudflare in front of a non-http(s) backend.
In this case we assume it is wrongly configured to point at a SSH daemon.
Even in that case, we should not hang forever.
Running with
GODEBUG=http2debug=2
:x/net/http2 also provides a
ReadIdleTimeout
andPingTimeout
. According to the docs:So the following was tried:
This still hangs indefinitely.
The text was updated successfully, but these errors were encountered: