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
If the underlying connection to the client is closed before sending the first message in a server stream, it gets a grpc error having the status of Unknown, as rpc error: code = Unknown desc = connection error: desc = "transport is closing". After an investigation, I found that if the connection is closed at the very beginning of the stream before the server writes the headers. When it writes the headers, it gets the ConnectionError and tries to convert it to a grpc status error by status.Convert(err).Err(). Since ConnectionError is not a grpc status error it converts the error to grpc status of Unknown.
What operating system (Linux, Windows, …) and version?
macOs Sonoma 14.0
What did you do?
If the underlying connection to the client is closed before sending the first message in a server stream, it gets a grpc error having the status of Unknown.
What did you expect to see?
rpc error: code = Unavailable desc = transport is closing
gRPC status returned to your RPC handler on the server side is not a very reliable indicator of the actual error or status returned to the client. Ideally, it would have been nicer if we did not return a grpc.Status for methods on the server side. But the API is what it is, and changing that would be a big breaking change.
The status code and message returned to the client is what you can reliably use to understand more about the status of the RPC.
All that said, I think changing the status code to be UNAVAILABLE if there is a lost connection -- which is what would be generated by the client if this kind of thing happens -- is not unreasonable, if you want to send a PR.
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.
If the underlying connection to the client is closed before sending the first message in a server stream, it gets a grpc error having the status of Unknown, as rpc error: code = Unknown desc = connection error: desc = "transport is closing". After an investigation, I found that if the connection is closed at the very beginning of the stream before the server writes the headers. When it writes the headers, it gets the ConnectionError and tries to convert it to a grpc status error by status.Convert(err).Err(). Since ConnectionError is not a grpc status error it converts the error to grpc status of Unknown.
Have a test reproducing the case: https://github.com/mustafasen81/grpc-status-unknown
What version of gRPC are you using?
v1.59.0
What version of Go are you using (
go version
)?1.21.4
What operating system (Linux, Windows, …) and version?
macOs Sonoma 14.0
What did you do?
If the underlying connection to the client is closed before sending the first message in a server stream, it gets a grpc error having the status of Unknown.
What did you expect to see?
rpc error: code = Unavailable desc = transport is closing
What did you see instead?
rpc error: code = Unknown desc = connection error: desc = "transport is closing".
The text was updated successfully, but these errors were encountered: