mirror of
https://github.com/golang/net.git
synced 2026-04-01 02:47:08 +09:00
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/21160
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user