During client side streaming, I'd like to know how the client could detect that the server process has been abruptly restarted (e.g. due to some critical failure), and how the client could recover from this.
Apparently for server side streaming we can use IsCancelled() and AsyncNotifyWhenDone() to detect such issues. But is there any similar mechanism on the client side?
This is what I have tested so far:
- I started a synchronous client side streaming RPC. The channel is in a GRPC_CHANNEL_READY state
- Killed the server process. After the server dies, the channel is briefly GRPC_CHANNEL_IDLE. Then the channel started alternating between GRPC_CHANNEL_CONNECTING and GRPC_CHANNEL_TRANSIENT_FAILURE
- Then the server is started again. Тhe channel then goes in a GRPC_CHANNEL_READY state. However, the server no longer receives any of the streamed messages. I suppose at this stage the client should start a new RPC and abandon the old one? But how would the client know that it has to do this? Is there a reliable way for the client to know that it has to re-establish the connection?
I attempted to detect the issue using the retval of WaitForConnected() and Write() but both of these functions returned “true” while the server was down.
Also, I tried setting these configuration variables on both the server and client, but it didn't seem to help: