Skip to content

Commit

Permalink
http2: fix TestServerContinuationFlood flakes
Browse files Browse the repository at this point in the history
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.

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]>
  • Loading branch information
neild committed Apr 3, 2024
1 parent 762b58d commit c48da13
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions http2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4813,22 +4813,24 @@ func TestServerContinuationFlood(t *testing.T) {
"x-last-header", "1",
))

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

func TestServerContinuationAfterInvalidHeader(t *testing.T) {
Expand Down

0 comments on commit c48da13

Please sign in to comment.