go
go copied to clipboard
x/net/http2: stream reset on invalid content-length header drops conn flow control
What version of Go are you using (go version
)?
$ go version go version go1.18.4 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/ronakj/Library/Caches/go-build" GOENV="/Users/ronakj/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/ronakj/gocode/pkg/mod" GONOPROXY="none" GONOSUMDB="*" GOOS="darwin" GOPATH="/Users/ronakj/gocode" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.18.3" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/ronakj/project/http2-issue-repro/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4d/2jw_2tc15x339gr53x6k64hm0000gn/T/go-build1453600270=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I'm using Go HTTP2 server for proxying gRPC requests, where a client could potentially forward a request with a smaller content-length header.
What did you expect to see?
Stream with an invalid content-length
header must result in an RST_STREAM
. This must not affect other valid streams and connection level flow control.
What did you see instead?
The client slowly notices degradation in performance and eventually, the client is hung with all requests failing with deadline exceeded errors.
This issue happens as the client flow control eventually runs out of available outward flow control bytes as the HTTP2 server does not return WINDOW_UPDATE
when the stream resets due to an invalid content-length
header.
Change https://go.dev/cl/420615 mentions this issue: http2: fix conn flow control when stream closes on bad content-length
CC @neild, @tombergan.
Change https://go.dev/cl/421974 mentions this issue: http2: fix conn flow control when stream closes on bad content-length