-
Catalin Patulea authored
Request ID reuse is allowed by the FastCGI spec [1]. In particular nginx uses the same request ID, 1, for all requests on a given connection. Because serveRequest does not remove the request from conn.requests, this causes it to treat the second request as a duplicate and drops the connection immediately after beginRequest. This manifests with nginx option 'fastcgi_keep_conn on' as the following message in nginx error log: 2014/03/17 01:39:13 [error] 730#0: *109 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: example.org, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "example.org" Because handleRecord and serveRequest run in different goroutines, access to conn.requests must now be synchronized. [1] http://www.fastcgi.com/drupal/node/6?q=node/22#S3.3 LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/76800043
a387f915