Skip to content

gRPC server stream returns status of Unknown when connection to the client closed #6845

Closed
@mustafasen81

Description

@mustafasen81

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions