Skip to content

Commit 324dfc1

Browse files
neildgopherbot
authored andcommitted
[internal-branch.go1.21-vendor] http2: fix TestServerContinuationFlood flakes
This test causes the server to send a GOAWAY and close a connection. The server GOAWAY path writes a GOAWAY frame asynchronously, and closes the connection if the write doesn't complete within 1s. This is causing failures on some builders, when the frame write doesn't complete in time. The important aspect of this test is that the connection be closed. Drop the check for the GOAWAY frame. This is a test-only fix that has no effect on the vendored content, helps tests on this branch, and avoids a merge conflict in next CL. For golang/go#66697. Change-Id: I099413be9c4dfe71d8fe83d2c6242e82e282293e Reviewed-on: https://go-review.googlesource.com/c/net/+/576235 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Than McIntosh <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/net/+/578335 Reviewed-by: Damien Neil <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 947e999 commit 324dfc1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

http2/server_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4896,22 +4896,24 @@ func TestServerContinuationFlood(t *testing.T) {
48964896
"x-last-header", "1",
48974897
))
48984898

4899-
var sawGoAway bool
49004899
for {
49014900
f, err := st.readFrame()
49024901
if err != nil {
49034902
break
49044903
}
49054904
switch f.(type) {
4906-
case *GoAwayFrame:
4907-
sawGoAway = true
49084905
case *HeadersFrame:
4909-
t.Fatalf("received HEADERS frame; want GOAWAY")
4906+
t.Fatalf("received HEADERS frame; want GOAWAY and a closed connection")
49104907
}
49114908
}
4912-
if !sawGoAway {
4913-
t.Errorf("connection closed with no GOAWAY frame; want one")
4914-
}
4909+
// We expect to have seen a GOAWAY before the connection closes,
4910+
// but the server will close the connection after one second
4911+
// whether or not it has finished sending the GOAWAY. On windows-amd64-race
4912+
// builders, this fairly consistently results in the connection closing without
4913+
// the GOAWAY being sent.
4914+
//
4915+
// Since the server's behavior is inherently racy here and the important thing
4916+
// is that the connection is closed, don't check for the GOAWAY having been sent.
49154917
}
49164918

49174919
func TestServerContinuationAfterInvalidHeader(t *testing.T) {

0 commit comments

Comments
 (0)