Commit 1600a4cd authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

http2: revert part of e7da8eda to fix data race it introduced

Git rev e7da8eda (CL 20542) introduced an optimization to reuse the
64k request body buffers across multiple requests. But ServeHTTP
handlers could retain them too long and cause races.

Temporarily revert the main part of that CL until a proper fix is in.

Updates golang/go#14960
Updates grpc/grpc-go#604

Change-Id: I28450e797a1d3122868214700b6ef345a0a1a47c
Reviewed-on: https://go-review.googlesource.com/21160Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 991d3e32
......@@ -1616,9 +1616,13 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res
Trailer: trailer,
}
if bodyOpen {
st.reqBuf = sc.getRequestBodyBuf()
// Disabled, per golang.org/issue/14960:
// st.reqBuf = sc.getRequestBodyBuf()
// TODO: remove this 64k of garbage per request (again, but without a data race):
buf := make([]byte, initialWindowSize)
body.pipe = &pipe{
b: &fixedBuffer{buf: st.reqBuf},
b: &fixedBuffer{buf: buf},
}
if vv, ok := header["Content-Length"]; ok {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment