Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(113)

Issue 7939045: code review 7939045: net/http/fcgi: fix a shutdown race (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by bradfitz
Modified:
11 years, 2 months ago
Reviewers:
CC:
golang-dev, rsc
Visibility:
Public.

Description

net/http/fcgi: fix a shutdown race If a handler didn't consume all its Request.Body, child.go was closing the socket while the host was still writing to it, causing the child to send a RST and the host (at least nginx) to send an empty response body. Now, we tell the host we're done with the request/response first, and then close our input pipe after consuming a bit of it. Consuming the body fixes the problem, and flushing to the host first to tell it that we're done increases the chance that the host cuts off further data to us, meaning we won't have much to consume. No new tests, because this package is lacking in tests. Tested by hand with nginx. See issue for testing details. Fixes issue 4183

Patch Set 1 #

Patch Set 2 : diff -r 85b1cc5d35dd https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r aaead10e12ae https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -7 lines) Patch
M src/pkg/net/http/fcgi/child.go View 1 5 chunks +25 lines, -7 lines 0 comments Download

Messages

Total messages: 3
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 2 months ago (2013-03-21 15:07:14 UTC) #1
rsc
LGTM
11 years, 2 months ago (2013-03-21 20:12:09 UTC) #2
bradfitz
11 years, 2 months ago (2013-03-21 21:07:25 UTC) #3
*** Submitted as https://code.google.com/p/go/source/detail?r=5851b45d1c82 ***

net/http/fcgi: fix a shutdown race

If a handler didn't consume all its Request.Body, child.go was
closing the socket while the host was still writing to it,
causing the child to send a RST and the host (at least nginx)
to send an empty response body.

Now, we tell the host we're done with the request/response
first, and then close our input pipe after consuming a bit of
it. Consuming the body fixes the problem, and flushing to the
host first to tell it that we're done increases the chance
that the host cuts off further data to us, meaning we won't
have much to consume.

No new tests, because this package is lacking in tests.
Tested by hand with nginx.  See issue for testing details.

Fixes issue 4183

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7939045
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b