Browse Source

http2: fix race in flaky TestServer_Rejects_TooSmall

There is a race between scheduling the response of the header frame and
when the data frame error is detected. The header frame may be
queued before or after the stream reset.

Fixes golang/go#25645

Change-Id: Id598eedfec9538fb7b154102a1a6e28e08fe117f
Reviewed-on: https://go-review.googlesource.com/121197
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Michael Fraenkel 7 years ago
parent
commit
e514e69ffb
1 changed files with 1 additions and 0 deletions
  1. 1 0
      http2/server_test.go

+ 1 - 0
http2/server_test.go

@@ -3762,6 +3762,7 @@ func TestIssue20704Race(t *testing.T) {
 
 func TestServer_Rejects_TooSmall(t *testing.T) {
 	testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
+		ioutil.ReadAll(r.Body)
 		return nil
 	}, func(st *serverTester) {
 		st.writeHeaders(HeadersFrameParam{