]> Cypherpunks repositories - gostls13.git/commit
net/http/fcgi: eliminate race, keep request id until end of stdin
authorHilko Bengen <bengen@hilluzination.de>
Sun, 6 Dec 2020 21:33:59 +0000 (21:33 +0000)
committerDamien Neil <dneil@google.com>
Fri, 16 Apr 2021 19:34:33 +0000 (19:34 +0000)
commitfff236e659fa819e036ab849130931dd6245c7b2
treecd975beb5e51ccc38f2ece0b7668e0e0443af0f4
parentef57834360cf69f2e8b52b32c7a05d96bf6bbba7
net/http/fcgi: eliminate race, keep request id until end of stdin

There was a race condition that could lead to child.serveRequest
removing the request ID before child.handleRequest had read the empty
FCGI_STDIN message that indicates end-of-stream which in turn could
lead to child.serveRequest blocking while trying to consume the
request body.

Now, we remove the request ID from within child.handleRequest after
the end of stdin has been detected, eliminating the race condition.

Since there are no more concurrent modifications/accesses
to child.requests, we remove the accompanying sync.Mutex.

Change-Id: I80c68e65904a988dfa9e3cceec1829496628ff34
GitHub-Last-Rev: b3976111ae1d3bbbfa36045f99acce7911a18c44
GitHub-Pull-Request: golang/go#42840
Reviewed-on: https://go-review.googlesource.com/c/go/+/273366
Trust: Damien Neil <dneil@google.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/fcgi/child.go
src/net/http/fcgi/fcgi_test.go