1
0
mirror of https://github.com/golang/go synced 2024-11-27 05:11:22 -07:00

net/http/fcgi: fix race between serveRequest and cleanUp

Fixes #11552

Change-Id: I87904e9e3fb4bd1fb4c7075a4e2d0151e5bd37df
Reviewed-on: https://go-review.googlesource.com/11890
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Brad Fitzpatrick 2015-07-03 12:32:40 -07:00
parent b3a8b0574a
commit f96fa06d14

View File

@ -289,6 +289,8 @@ func (c *child) serveRequest(req *request, body io.ReadCloser) {
} }
func (c *child) cleanUp() { func (c *child) cleanUp() {
c.mu.Lock()
defer c.mu.Unlock()
for _, req := range c.requests { for _, req := range c.requests {
if req.pw != nil { if req.pw != nil {
// race with call to Close in c.serveRequest doesn't matter because // race with call to Close in c.serveRequest doesn't matter because