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, csen...@gmail.com 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, yangya...@gmail.com 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 grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
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/3a1006e9-aa06-455e-a80f-835c1744b8d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to