-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grpc: fix a bug introduced in #7461 #7505
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7505 +/- ##
==========================================
- Coverage 81.58% 81.52% -0.06%
==========================================
Files 358 358
Lines 27388 27390 +2
==========================================
- Hits 22345 22331 -14
- Misses 3828 3836 +8
- Partials 1215 1223 +8
|
stream.go
Outdated
@@ -1121,7 +1121,8 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { | |||
} | |||
// Special handling for non-server-stream rpcs. | |||
// This recv expects EOF or errors, so we don't collect inPayload. | |||
if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp, false); err == nil { | |||
err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something like this instead:
if err := recv(); err == io.EOF {
return a.s.Status().Err() // expected; return stream status error
} else if err != nil {
return toRPCErr(err) // other error
}
return ...gOt <nil>, wanted io.EOF... // no end stream??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
return toRPCErr(err) | ||
return toRPCErr(errors.New("grpc: client streaming protocol violation: get <nil>, want <EOF>")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*gOt please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Didn't see this comment in the excitement to merge this :(
When I was reviewing #7461, I made a comment to replace some lines which read as:
to be replaced as:
Little did I realize that the
err
value was being used below. Luckily this did not make it into the release, which we haven't yet cut. So, no release notes required.This wasn't caught as a compile error, because
err
was a named return parameter. I'm not making the changes in this PR to not haveerr
as a named return parameter though.RELEASE NOTES: none