Skip to content

Unexpected error type returned from ServerStream.SendMsg() #6548

Closed
@ash2k

Description

@ash2k

What version of gRPC are you using?

v1.57.0

What version of Go are you using (go version)?

N/A

What operating system (Linux, Windows, …) and version?

N/A

What did you do?

Called SendMsg() on a ServerStream in a streaming RPC.

What did you expect to see?

On error I was expecting to get something that has a GRPCStatus() method i.e. can be converted to the Status type, etc.

What did you see instead?

Based on the error message (in logs and error tracking system), occasionally I get a transport.ConnectionError:

https://github.com/grpc/grpc-go/blob/v1.57.0/internal/transport/transport.go#L782

https://github.com/grpc/grpc-go/blob/v1.57.0/internal/transport/transport.go#L747-L778

This is an internal type and I cannot check for it in a nice way so that I can handle it properly. I also cannot handle it in a generic way (via GRPCStatus()) because it doesn't have that method.

I can see that this type is converted to a "proper" error via toRPCErr() e.g. when passed to stats handlers in https://github.com/grpc/grpc-go/blob/v1.57.0/server.go#L1227 and in other places.

Shouldn't gRPC convert this internal type to a "proper" (i.e. Status) error type before returning it to the user code?

p.s. This may be affecting other methods too, not only SendMsg(), I haven't audited the code.
p.p.s. It'd be very useful to document the contract on what errors can be returned from all public API methods on ServerStream and ClientStream (and anywhere else it makes sense).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions