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

Issue 4530089: http/spdy: fix data race in header decompression. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 10 months ago by willchan
Modified:
13 years, 9 months ago
Reviewers:
CC:
bradfitz, rsc, peterGo, golang-dev
Visibility:
Public.

Description

http/spdy: fix data race in header decompression. flate's reader greedily reads from the shared io.Reader in Framer. This leads to a data race on Framer.r. Fix this by providing a corkedReader to zlib.NewReaderDict(). We uncork the reader and allow it to read the number of bytes in the compressed payload. Fixes issue 1884.

Patch Set 1 #

Patch Set 2 : diff -r 666f4fed7016 https://go.googlecode.com/hg/ #

Total comments: 4

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

Patch Set 4 : diff -r 666f4fed7016 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 5 : diff -r 666f4fed7016 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 6 : diff -r 666f4fed7016 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -17 lines) Patch
M src/pkg/http/spdy/framer.go View 1 2 3 4 5 6 chunks +26 lines, -5 lines 0 comments Download
M src/pkg/http/spdy/framer_test.go View 1 2 chunks +0 lines, -12 lines 0 comments Download

Messages

Total messages: 29
willchan
I think this should fix it (I've tested with GOMAXPROCS=4). Question though, I'm not explicitly ...
13 years, 10 months ago (2011-05-31 13:13:36 UTC) #1
rsc
> I think this should fix it (I've tested with GOMAXPROCS=4). Question > though, I'm ...
13 years, 10 months ago (2011-05-31 14:54:55 UTC) #2
willchan
On Tue, May 31, 2011 at 2:54 PM, Russ Cox <rsc@golang.org> wrote: >> I think ...
13 years, 10 months ago (2011-05-31 15:00:33 UTC) #3
rsc
http://codereview.appspot.com/4530089/diff/2001/src/pkg/http/spdy/framer.go File src/pkg/http/spdy/framer.go (right): http://codereview.appspot.com/4530089/diff/2001/src/pkg/http/spdy/framer.go#newcode50 src/pkg/http/spdy/framer.go:50: bytesAvailable int I suggest n int open bool http://codereview.appspot.com/4530089/diff/2001/src/pkg/http/spdy/framer.go#newcode55 ...
13 years, 10 months ago (2011-05-31 15:01:49 UTC) #4
willchan
http://codereview.appspot.com/4530089/diff/2001/src/pkg/http/spdy/framer.go File src/pkg/http/spdy/framer.go (right): http://codereview.appspot.com/4530089/diff/2001/src/pkg/http/spdy/framer.go#newcode50 src/pkg/http/spdy/framer.go:50: bytesAvailable int On 2011/05/31 15:01:49, rsc wrote: > I ...
13 years, 10 months ago (2011-05-31 15:41:06 UTC) #5
peterGo
Will, Follow the Go contribution guidelines and add "Fixes issue 1884." at the end of ...
13 years, 10 months ago (2011-05-31 16:59:04 UTC) #6
willchan
Oops, I missed that, thanks! I've changed the first line of the description as well. ...
13 years, 10 months ago (2011-05-31 17:02:21 UTC) #7
peterGo
The first line of the CL description should be something like: "spdy: Fix data race ...
13 years, 10 months ago (2011-05-31 17:03:56 UTC) #8
willchan
Didn't I already do that? What don't you like about: "http/spdy: Fix data race in ...
13 years, 10 months ago (2011-05-31 17:09:44 UTC) #9
peterGo
I filed issue 1884. After applying this CL, I now get: $ hg id 9449a15e4ac4+ ...
13 years, 10 months ago (2011-05-31 17:18:38 UTC) #10
willchan
Thanks for testing this! Hm, I don't seem to be able to repro on my ...
13 years, 10 months ago (2011-05-31 17:20:18 UTC) #11
rsc
please s/Fix/fix/ in the CL description. code looks fine but waiting to hear resolution of ...
13 years, 10 months ago (2011-05-31 17:20:42 UTC) #12
peterGo
For GOMAXPROCS=1, ./all.bash succeeds. $ env | grep '^GO' GOBIN=/home/peter/spdy/bin GOARCH=amd64 GOMAXPROCS=1 GOROOT=/home/peter/spdy GOOS=linux ALL ...
13 years, 10 months ago (2011-05-31 17:23:58 UTC) #13
peterGo
Has Albert Strasheim tested this CL? http/spdy test failure http://groups.google.com/group/golang-dev/browse_thread/thread/ada97a7289e7cac4 Peter
13 years, 10 months ago (2011-05-31 17:35:00 UTC) #14
rsc
I don't think Albert needs to test it if you have a failure on your ...
13 years, 10 months ago (2011-05-31 17:36:15 UTC) #15
bradfitz
LGTM Cool. Glad corkedReader ended up working. I can't get the test to fail on ...
13 years, 10 months ago (2011-05-31 18:33:45 UTC) #16
willchan
I've changed the changelist description again and addressed Brad's comments. But this shouldn't have changed ...
13 years, 10 months ago (2011-05-31 19:02:24 UTC) #17
bradfitz
LGTM I've tested this on Linux and can't reproduce any errors. I'm happy submitting now, ...
13 years, 10 months ago (2011-05-31 20:11:21 UTC) #18
rsc
http://codereview.appspot.com/4530089/diff/4/src/pkg/http/spdy/framer.go File src/pkg/http/spdy/framer.go (right): http://codereview.appspot.com/4530089/diff/4/src/pkg/http/spdy/framer.go#newcode102 src/pkg/http/spdy/framer.go:102: f.headerReader.ch <- payloadSize On 2011/05/31 20:11:22, bradfitz wrote: > ...
13 years, 10 months ago (2011-05-31 20:17:31 UTC) #19
bradfitz
http://codereview.appspot.com/4530089/diff/4/src/pkg/http/spdy/framer.go File src/pkg/http/spdy/framer.go (right): http://codereview.appspot.com/4530089/diff/4/src/pkg/http/spdy/framer.go#newcode102 src/pkg/http/spdy/framer.go:102: f.headerReader.ch <- payloadSize On 2011/05/31 20:17:31, rsc wrote: > ...
13 years, 10 months ago (2011-05-31 20:23:40 UTC) #20
willchan
If you're fine submitting it, then I'm fine with it too. http://codereview.appspot.com/4530089/diff/4/src/pkg/http/spdy/framer.go File src/pkg/http/spdy/framer.go (right): ...
13 years, 10 months ago (2011-05-31 20:26:48 UTC) #21
bradfitz
Russ, Do we need to be concerned about flate's inflate goroutine's Read blocking forever on ...
13 years, 10 months ago (2011-05-31 20:36:39 UTC) #22
bradfitz
On Tue, May 31, 2011 at 1:36 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > Russ, > > ...
13 years, 10 months ago (2011-05-31 20:44:51 UTC) #23
rsc
> Do we need to be concerned about flate's inflate goroutine's Read blocking > forever ...
13 years, 10 months ago (2011-05-31 20:45:22 UTC) #24
bradfitz
On Tue, May 31, 2011 at 1:45 PM, Russ Cox <rsc@golang.org> wrote: > > Do ...
13 years, 10 months ago (2011-05-31 20:47:13 UTC) #25
rsc
On Tue, May 31, 2011 at 16:47, Brad Fitzpatrick <bradfitz@golang.org> wrote: > On Tue, May ...
13 years, 10 months ago (2011-05-31 20:48:12 UTC) #26
bradfitz
On Tue, May 31, 2011 at 1:48 PM, Russ Cox <rsc@golang.org> wrote: > On Tue, ...
13 years, 10 months ago (2011-05-31 20:56:18 UTC) #27
rsc
On Tue, May 31, 2011 at 16:56, Brad Fitzpatrick <bradfitz@golang.org> wrote: > So what should ...
13 years, 10 months ago (2011-05-31 21:03:49 UTC) #28
bradfitz
13 years, 10 months ago (2011-05-31 21:06:14 UTC) #29
*** Submitted as http://code.google.com/p/go/source/detail?r=aa3072daee08 ***

http/spdy: fix data race in header decompression.

flate's reader greedily reads from the shared io.Reader in Framer. This leads to
a data race on Framer.r. Fix this by providing a corkedReader to
zlib.NewReaderDict(). We uncork the reader and allow it to read the number of
bytes in the compressed payload.

Fixes issue 1884.

R=bradfitz, rsc, go.peter.90
CC=golang-dev
http://codereview.appspot.com/4530089

Committer: Brad Fitzpatrick <bradfitz@golang.org>
Sign in to reply to this message.

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