Thanks for your reply. I have considered those options and it would not work for me. 1. The streaming rpc will provide incremental on change data from server to the client, if I set the deadline the streaming rpc gets reestablished if server is still connected and have no data to send within the period configured in the deadline. I do not want the client to reconnect and get the stale data when the server has not really broken and keeps idle. 2. I am still using grpc v1.0.0 and keep alive channel arguments are not supported in that version. I may need to upgrade to v1.6.0.
Just wondering if there are any other options with v1.0.0. Thanks again for your reply, On Thursday, 7 December 2017 16:26:45 UTC-6, Yang Gao wrote: > > You can set a deadline to your stream. Re-issuing the rpc is not really a > problem because a failed read at the client means the rpc is done at the > server or failed somehow anyway. > > Or you can configure client side channel keep alive by adding channel > arguments: GRPC_ARG_KEEPALIVE_TIME_MS and GRPC_ARG_KEEPALIVE_TIMEOUT_MS. > See > https://github.com/grpc/grpc/blob/a8021572683c4a6e6af59888cf3a000933abe00c/include/grpc/impl/codegen/grpc_types.h#L218 > > On Monday, December 4, 2017 at 12:22:34 PM UTC-8, [email protected] wrote: >> >> Hi, >> Can you help me understand how did you overcome this issue. I too have a >> client that invokes streaming rpc and it gets blocked in ClientReader::Read. >> I cant set a timeout as it would mean the rpc needs to be invoked again >> after the timeout. >> >> I need a way to reestablish the server connection if client gets blocked >> in ClientReader::Read. I cannot read the connection state as the call is >> blocked. >> However Read fails and gets unblocked if >> - I kill the server process or unplug the connection between client and >> server >> But the client gets blocked indefinitely when the server is >> shutdown/powered off. >> >> My code goes like this.... >> ClientContext context; >> std::unique_ptr<Consumer::Stub> stub_ = Consumer::NewStub(channel); >> ThreadEventReader = stub_->GetDataStream(&context, Filter); //rpc call >> // blocked read - until stream closed >> while (ThreadEventReader->Read(&StreamedData)) >> { >> cout << "UpdateStream: " << StreamedData.displayvalue() >> << endl; >> } >> >> On Wednesday, 25 May 2016 10:29:57 UTC-5, [email protected] wrote: >>> >>> Hi, my version has fail_fast, and I checked the state of channel. When >>> server is shutdown, the state is GRPC_CHANNEL_CONNECTING, which helps me >>> know server is unavailable. >>> Thank you! >>> >> -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/94be5c76-aa5d-4786-95c9-66f350eb0445%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
