Re: [grpc-io] How can gRPC client know about network loss/failure?

2017-06-20 Thread 'Eric Anderson' via grpc.io
You want to enable keep alive, via keepAliveTime on NettyChannelBuilder or
OkHttpChannelBuilder.

On Sun, Jun 11, 2017 at 10:54 PM,  wrote:

>
> I have a gRPC server to whom i have connected my gRPC client (Java).
> - the client is observing server streaming RPC, which is supposed to go on
> for couple of hours.
> - When the server stopped, the client gets the information as gRPC invoked
> onError() method.
> - but when the network was broken between server and client, the client
> doesn't even know about the problem, the streamobserver is idle and no
> activity.
>
> In my scenario, if anything like this happens the client is supposed to
> retry the connection and invoke RPC again.
> So my question is how can i know about the network failure in the client.
>
> --
> 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/9f221cd0-441d-4e16-aa2e-386efdd13c35%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2B4M1oP4VPO7fTSODzhO7Yxi4FSQqV5X2X%3DcHqjcZuHpOoRtrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [grpc-io] How can gRPC client know about network loss/failure?

2017-06-21 Thread deepakagarwal2027
Hi Eric, thanks for the response but i have to problems
1) I am using grpc-java 1.0.1 which does not support this Interface (The 
product team has decided on grpc version)
2) The keepalive time is not fixed.

Also i have a doubt about the whether grpc java 1.0.1 can support http2. I 
found c based grpc 1.0.1 and grpc-java 1.0.1 has many different functions


On Tuesday, June 20, 2017 at 11:21:40 PM UTC+5:30, Eric Anderson wrote:
>
> You want to enable keep alive, via keepAliveTime on NettyChannelBuilder or 
> OkHttpChannelBuilder.
>
> On Sun, Jun 11, 2017 at 10:54 PM, > 
> wrote:
>
>>
>> I have a gRPC server to whom i have connected my gRPC client (Java).
>> - the client is observing server streaming RPC, which is supposed to go 
>> on for couple of hours.
>> - When the server stopped, the client gets the information as gRPC 
>> invoked onError() method.
>> - but when the network was broken between server and client, the client 
>> doesn't even know about the problem, the streamobserver is idle and no 
>> activity.
>>
>> In my scenario, if anything like this happens the client is supposed to 
>> retry the connection and invoke RPC again. 
>> So my question is how can i know about the network failure in the client.
>>
>> -- 
>> 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+u...@googlegroups.com .
>> To post to this group, send email to grp...@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/9f221cd0-441d-4e16-aa2e-386efdd13c35%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/738ed641-9342-41c0-92d2-da8106d31872%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] How can gRPC client know about network loss/failure?

2017-06-21 Thread 'Eric Anderson' via grpc.io
On Wed, Jun 21, 2017 at 3:10 AM,  wrote:

> Hi Eric, thanks for the response but i have to problems
> 1) I am using grpc-java 1.0.1 which does not support this Interface (The
> product team has decided on grpc version)
>

Sorry, but the feature wasn't available in 1.0.x.

The only workaround in that case is to send "noop/trash" messages/RPCs
periodically. Basically, TCP needs *writes* in order to discover
*read* failures,
so you generate noop writes on the TCP connection. If you receive GOAWAY
from the server (like during server shutdown or server rotation), then any
new RPCs will use a different connection, thus won't help you detect if the
old connection is broken. Depending on your setup, that may not be much of
a problem (e.g., if the server closes the connection soon after sending the
GOAWAY). Using noop messages on the same RPC stream (by making it a bidi
streaming RPC) wouldn't have that deficiency, but you'd also need to do the
noop messages on all active streams and have to change more of your
application logic.

2) The keepalive time is not fixed.
>

I don't understand this.

Also i have a doubt about the whether grpc java 1.0.1 can support http2. I
> found c based grpc 1.0.1 and grpc-java 1.0.1 has many different functions
>

I don't understand what you mean by functions. Could you explain more? It
sounds like this is unrelated to the network break detection.

-- 
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/CA%2B4M1oOWzxOyyT%3D3_KcXqSR3tejsR7tSxedbbGmgT8d9Sw96YA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [grpc-io] How can gRPC client know about network loss/failure?

2017-06-21 Thread deepakagarwal2027
Ok. let me explain the complete scenario

1) I have a gRPC server which provides a server streaming RPC, my 
application is a client which needs to invoke this RPC and keep listening 
to the data written by the server (until the RPC is closed).
The problem here is that in the server side if they detect that the 
connection has problem (while writing the data to the RPC), they consider 
this RPC as closed and *client need to re-invoke it**.*
In grpc java 1.0.1 i don't have mechanism in client to know the 
connection was broken and i need to restart the RPC.

   I have done some test, when we stop the server, in client side 
streamobserver, the overloaded method warning(String msg, Object... params) 
is invoked
   But when i disconnect the network between client and server, the server 
can get to know but client doesn't get to know about it and the observer 
keeps on idle.

2)  I am using NettyChannelBuider to build the channel with the gRPC 
server, (I hope all types of channelbuilder uses http2)

3)  If somehow I can convince the product team to upgrade the grpc-java 
version, will it be able to communicate with c based grpc 1.0.1 version 
server?





On Wednesday, June 21, 2017 at 11:56:59 PM UTC+5:30, Eric Anderson wrote:
>
> On Wed, Jun 21, 2017 at 3:10 AM, > 
> wrote:
>
>> Hi Eric, thanks for the response but i have to problems
>> 1) I am using grpc-java 1.0.1 which does not support this Interface (The 
>> product team has decided on grpc version)
>>
>
> Sorry, but the feature wasn't available in 1.0.x.
>
> The only workaround in that case is to send "noop/trash" messages/RPCs 
> periodically. Basically, TCP needs *writes* in order to discover *read* 
> failures, 
> so you generate noop writes on the TCP connection. If you receive GOAWAY 
> from the server (like during server shutdown or server rotation), then any 
> new RPCs will use a different connection, thus won't help you detect if the 
> old connection is broken. Depending on your setup, that may not be much of 
> a problem (e.g., if the server closes the connection soon after sending the 
> GOAWAY). Using noop messages on the same RPC stream (by making it a bidi 
> streaming RPC) wouldn't have that deficiency, but you'd also need to do the 
> noop messages on all active streams and have to change more of your 
> application logic.
>
> 2) The keepalive time is not fixed.
>>
>
> I don't understand this.
>
> Also i have a doubt about the whether grpc java 1.0.1 can support http2. I 
>> found c based grpc 1.0.1 and grpc-java 1.0.1 has many different functions
>>
>
> I don't understand what you mean by functions. Could you explain more? It 
> sounds like this is unrelated to the network break detection.
>

-- 
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/6e76eb90-455b-4a0b-9f6c-c88ba45f3a8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.