Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.19.1 darwin/amd64
Does this issue reproduce with the latest release?
yes
https://pkg.go.dev/vuln/GO-2022-0969
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env
What did you do?
go get -u golang.org/x/net
What did you expect to see?
Existing streams are processed normally after sending GOAWAY and no new streams are accepted
What did you see instead?
Existing stream is incorrectly terminated
--- FAIL: TestGOAWAYConcurrency (6.06s)
goaway_test.go:486: failed to request "/get-with-goaway", err: failed to read response body, error: http2: server sent GOAWAY and closed the connection; LastStreamID=9, ErrCode=NO_ERROR, debug=""
goaway_test.go:486: failed to request "/get-with-goaway", err: failed to read response body, error: http2: server sent GOAWAY and closed the connection; LastStreamID=9, ErrCode=NO_ERROR, debug=""
goaway_test.go:486: failed to request "/get-with-goaway", err: failed request test server, err: Get "https://127.0.0.1:50125/get-with-goaway": http2: server sent GOAWAY and closed the connection; LastStreamID=9, ErrCode=NO_ERROR, debug=""
goaway_test.go:486: failed to request "/get-with-goaway", err: failed to read response body, error: http2: server sent GOAWAY and closed the connection; LastStreamID=5, ErrCode=NO_ERROR, debug=""
goaway_test.go:486: failed to request "/get-with-goaway", err: failed to read response body, error: http2: server sent GOAWAY and closed the connection; LastStreamID=5, ErrCode=NO_ERROR, debug=""
goaway_test.go:486: failed to request "/get-with-goaway", err: failed request test server, err: Get "https://127.0.0.1:50125/get-with-goaway": http2: server sent GOAWAY and closed the connection; LastStreamID=5, ErrCode=NO_ERROR, debug=""
goaway_test.go:516: in-flight watch was broken by GOAWAY frame, expect response body: hello, got:
FAIL
exit status 1
FAIL k8s.io/apiserver/pkg/server/filters 6.899s
Related to this #54658
@neild Can you help me look at it?
This will alleviate
diff --git a/http2/server.go b/http2/server.go
index a894e69..364c25c 100644
--- a/http2/server.go
+++ b/http2/server.go
@@ -1369,7 +1369,7 @@ func (sc *serverConn) startGracefulShutdownInternal() {
func (sc *serverConn) goAway(code ErrCode) {
sc.serveG.check()
if sc.inGoAway {
- if sc.goAwayCode == ErrCodeNo {
+ if sc.goAwayCode == ErrCodeNo && code != ErrCodeProtocol {
sc.goAwayCode = code
}
return
Question was introduced by https://go.dev/cl/428735