is it solved? 在2021年12月2日星期四 UTC+8 03:06:39<[email protected]> 写道:
> I can think of a few ways to achieve this (with keepalives configured > ofcourse). One way to detect this would be to perform a `Read()` on the > stream. If the channel dies, the stream would die too and the read would > fail. > > On Tuesday, November 16, 2021 at 3:08:46 AM UTC-8 [email protected] > wrote: > >> Hi all, >> >> 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: >> >> >> 1. *I started a synchronous client side streaming RPC. *The channel >> is in a GRPC_CHANNEL_READY state >> 2. *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 >> 3. *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: >> >> args.SetInt(GRPC_ARG_KEEPALIVE_TIME_MS, 10000); >> >> args.SetInt(GRPC_ARG_KEEPALIVE_TIMEOUT_MS, 5000); >> >> args.SetInt(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS, 1); >> >> args.SetInt(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA, 0); >> >> Regards, >> >> Paulin >> > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/6402e79f-72c1-432c-ac36-6491cedc578dn%40googlegroups.com.
