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
No way to differentiate between server-side errors vs client-side errors #319
Comments
You should only feed the error you got from rpc call into grpc.Code instead of arbitrary ones. For now the only case you see codes.Unknown is server application error. Do I miss something here? |
Two points:
|
|
https://github.com/grpc/grpc-go/blob/master/codes/codes.go#L50-L55 From the doc, it says the server might return an unknown error in some cases. So if the application receives an unknown error, there is still no way to know if it is a connection error. What I want to achieve is to determine if the rpc fails because of client side issues (when the local network is down) or a connection failure (when the server is down). |
grpc/grpc-go#319 (comment). grpc-go suggests that we should not return unknown error since it is reserved for grpc internal usage.
grpc/grpc-go#319 (comment). grpc-go suggests that we should not return unknown error since it is reserved for grpc internal usage.
grpc/grpc-go#319 (comment). grpc-go suggests that we should not return unknown error since it is reserved for grpc internal usage.
I will take a look at the unknown case. But regardless, your client should never get a connection error unless you set the connect time out (and then you may get ErrClientConnTimeout error as the connection error) because grpc internal always tries to address connection error by itself. You may get DeadlineExceeded error for sure if you set a deadline for your rpc but the connection cannot be established in time. |
So it will retry forever regardless the connection error? |
We want to be able to tell if a particular error was due to a server-side error, or due to the client not being able to connect to the server. There's no good way of doing that right now, since doing grpc.Code(err) will return codes.Unknown for a client error. However, it's possible that the server could also return a codes.Unknown.
The text was updated successfully, but these errors were encountered: