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
I think I see the problem is in withRetry, definition is
func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) error {
cs.mu.Lock()
for {
if cs.committed {
cs.mu.Unlock()
// toRPCErr is used in case the error from the attempt comes from
// NewClientStream, which intentionally doesn't return a status
// error to allow for further inspection; all other errors should
// already be status errors.
return toRPCErr(op(cs.attempt))
}
a := cs.attempt
...
Bug is in return toRPCErr(op(cs.attempt)) which is not locked, and other recv can modify cs.attempt.
The text was updated successfully, but these errors were encountered:
I don't think your assessment of the bug is correct.
cs.attempt is only assigned from newAttemptLocked, which is only called either at the very start of the RPC (while the stream is being created) or during retryLocked which is not called if cs.committed is true. So if withRetry sees cs.committed == true, then it can safely read cs.attempt outside of the lock.
Do you have a reproducible test case for your situation? I'm sure there is something wrong here, but I'm having a hard time designing a test that expose it. Thanks.
This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.
What version of gRPC are you using?
1.42.0
What version of Go are you using (
go version
)?1.15
What operating system (Linux, Windows, …) and version?
Linux
What did you do?
Call bi-directional stream client's
recv
andsend
in different goroutine, and panic duringCloseSend()
in send goroutine.The panic stack is
I think I see the problem is in
withRetry
, definition isBug is in
return toRPCErr(op(cs.attempt))
which is not locked, and otherrecv
can modifycs.attempt
.The text was updated successfully, but these errors were encountered: