grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

Feature request: Map ERR_NETWORK_CHANGED to usefule gRPC error code and message

Open pixelbucket-dev opened this issue 5 years ago • 2 comments

Versions of relevant software used 0.12.0

What happened When switching networks for some reason the network connection switches our streams collapse. Currently your library only returns the follwing:

code: 2, code_text: "Unknown", messge: "Response closed without grpc-status (Headers only)".

What you expected to happen Ideally, the gRPC code would be something more specific. More important though is that the same error that the Browser shows is returned in the gRPC error payload/message. In this case that would be "ERR_NETWORK_CHANGED".

How to reproduce it (as minimally and precisely as possible): Roam between WiFi access points or use a VPN and kill the VPN connection.

Anything else we need to know

pixelbucket-dev avatar Sep 01 '20 15:09 pixelbucket-dev

I don't think there is much we can do here from a client side point of view, all we know is that the response was not valid. Do you have a patch that fixes this? We'd be happy to review it.

johanbrandhorst avatar Sep 02 '20 10:09 johanbrandhorst

I do not have a patch. Basically what happens is that the underlying network stack changes (ethernet cable unplugged, new IP address, WiFi access point changed). What I would expect to return is a more specific error code, e.g. ABORTED or UNAVAILABLE. The connection gets interrupted because the server/end point becomes unreachable briefly. The only way to mitigate this currently is filterung above error message and do a retry. This is brittle, I believe, and should not be trusted in production.

PS: This is for a gRPC service where client and server are on the same device.

pixelbucket-dev avatar Nov 26 '20 15:11 pixelbucket-dev