Description
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".