-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Return the actual error from unary RPCs when SendMsg()
returns io.EOF
#7230
Comments
Yes, I think this is just an oversight in our code here. If |
To be clear, I don't have bandwidth to work on the fix myself. |
No problem! This is rare but probably important enough that we should prioritize this internally. Also the fix is probably quite easy. |
@dfawley Hi, is it possible for me pick this one up? Looks like we need to get the following done (please correct me if I'm wrong):
|
@Kailun2047 Sure, that sounds good to me, as long as you think you can work on it pretty soon. For the repro, I wonder if we can reproduce it by making a large request, and configure the server with a very small initial window size. That way the client won't be able to send the full request as long as the server handler treats the method as streaming. That should make it 100% reproducible, and be fairly simple to do. |
@dfawley Got it. Will try to delve in and make an update here within a day or two. |
@dfawley Hi, I tried creating a test per earlier discussion to reproduce but had no luck 😅 On StubServer, But upon some initial inspection, looks like the
Instead, it appears to me that the source of the
I'm definitely willing to put more investigation into this, but let me know if you are concerned about the timing and need to prioritize internally 😄 |
Oh interesting. I thought it was something simpler, but you're right - some of the streaming code actually checks the type of the RPC and adjusts its behavior accordingly. If you're able to get to the bottom of this, we would definitely appreciate it. No worries on the timing at all - I don't think it's as urgent if it's a pretty rare occurrence. |
Use case(s) - what problem will this feature solve?
When a unary RPC is called, this code gets executed:
grpc-go/call.go
Lines 65 to 74 in 59954c8
SendMsg()
docs say this:grpc-go/stream.go
Lines 112 to 115 in 59954c8
I have a test for something unrelated where the server immediately returns an error. Very rarely, depending on the timing my test gets
EOF
instead of the error that the server returns. This is because server is occasionally faster than the client. It occurred to me that this is an issue for all unary RPCs - there is no way to get the actual error as the stream is not exposed to the user.Proposed Solution
Check for
io.EOF
fromSendMsg()
and callRecvMsg()
to get the actual error, return it.Alternatives Considered
Leave it as is. This might be a requirement to be consistent with other implementations (I have not checked). Perhaps gRPC spec needs to be adjusted/clarified to change the behavior in this case.
Additional Context
gRPC v1.63.2.
Go 1.22.3
The text was updated successfully, but these errors were encountered: