You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue.
What version of gRPC are you using?
1.9.1. The bug was not present in gRPC 1.7.2 (I haven't tested 1.8 It's in the current tip of the v1.8.x branch too)
What version of Go are you using (go version)?
go version go1.9.2 darwin/amd64
What operating system (Linux, Windows, …) and version?
macOS 10.13.2 and ubuntu 16.04
What did you do?
With the race detector enabled, issue a streaming rpc (I don't know if the use of streaming is relevant) and immediately cancel its context, so that the cancellation races with the arrival of the headers packet from the server. I don't have a minimal reproduction of this, but it manifests (very infrequently) in the cockroachdb test suite (run make stressrace PKG=./pkg/gossip in the cockroach repo for 30 minutes). See cockroachdb/cockroach#21451
What did you expect to see?
No data races
What did you see instead?
The race detector reports a race between RecvCompress and operateHeaders:
I have determined (via printf debugging) that we see one goroutine call http2Client.CloseStream while another is in http2Client.operateHeaders, and a third calls Stream.RecvCompress. The CloseStream call sets s.headerDone and closes s.headerChan, unblocking RecvCompress. The read of s.recvCompress in Stream.RecvCompress then races with the write of this field in operateHeaders.
I see two simple ways to address the data race: Acquire s.mu in Stream.RecvCompress, or move the assignment to s.recvCompress into the if !s.headerDone block so we don't change it if we've already signaled that we're done with headers. (it's possible that this error is revealing a deeper synchronization issue, but I'm not sure enough of the various goroutines involved here)
The text was updated successfully, but these errors were encountered:
Please answer these questions before submitting your issue.
What version of gRPC are you using?
1.9.1. The bug was not present in gRPC 1.7.2 (
I haven't tested 1.8It's in the current tip of the v1.8.x branch too)What version of Go are you using (
go version
)?go version go1.9.2 darwin/amd64
What operating system (Linux, Windows, …) and version?
macOS 10.13.2 and ubuntu 16.04
What did you do?
With the race detector enabled, issue a streaming rpc (I don't know if the use of streaming is relevant) and immediately cancel its context, so that the cancellation races with the arrival of the headers packet from the server. I don't have a minimal reproduction of this, but it manifests (very infrequently) in the cockroachdb test suite (run
make stressrace PKG=./pkg/gossip
in the cockroach repo for 30 minutes). See cockroachdb/cockroach#21451What did you expect to see?
No data races
What did you see instead?
The race detector reports a race between RecvCompress and operateHeaders:
I have determined (via printf debugging) that we see one goroutine call
http2Client.CloseStream
while another is inhttp2Client.operateHeaders
, and a third callsStream.RecvCompress
. The CloseStream call setss.headerDone
and closess.headerChan
, unblocking RecvCompress. The read of s.recvCompress inStream.RecvCompress
then races with the write of this field inoperateHeaders
.I see two simple ways to address the data race: Acquire
s.mu
inStream.RecvCompress
, or move the assignment tos.recvCompress
into theif !s.headerDone
block so we don't change it if we've already signaled that we're done with headers. (it's possible that this error is revealing a deeper synchronization issue, but I'm not sure enough of the various goroutines involved here)The text was updated successfully, but these errors were encountered: