How can you tell if a connection is broken?  Unless you receive a packet 
saying the host isn't reachable, its possible the remote endpoint is just 
taking a long time.  It can't be distinguished from radio silence.  The 
deadline mechanism isn't really for connection level usage, it's for RPC 
level usage.  

If you can listen for OS updates on Android, why not just kill the RPCs 
your self when you get notified?  And, even if you did do this, how can you 
tell if the connection is failed?  For example, if the OS tells you the 
antenna is turned off, it may be temporary and could turn on again with 
neither endpoint being the wiser.  The connection is still active.

On Friday, August 11, 2017 at 6:24:48 PM UTC-7, Uli Bubenheimer wrote:
>
> I am seeing issues with how Deadline works at present in the presence of 
> failing connections. What I found in my tests & research regarding my 
> Android use case:
>
>
>    - I am missing an option to explicitly fail a connection (signal that 
>    the connection is broken) when a Deadline expires. An expired Deadline in 
>    my Android use case would typically mean that the connection is broken, 
> and 
>    reconnecting may help.
>    - Detecting broken connections with Keep-Alives does not work so well 
>    in conjunction with Deadlines. If all RPCs have failed due to expired 
>    Deadlines caused by a broken connection then using Keep-Alive won't detect 
>    the broken connection unless I set 
>    NettyServerBuilder.permitKeepAliveWithoutCalls(true) and 
>    OkHttpChannelBuilder.keepAliveWithoutCalls(true), which judging by the 
>    documentation does not seem the best idea.
>
> Deadlines are useful, for example, when there is a user waiting for a 
> response - I have to take action when nothing comes back after 20 or 30 
> seconds. Setting KeepAlive to such small values as a workaround would not 
> be a good idea.
>
> I started looking at creating my own LoadBalancer as a workaround, which 
> seems less architecturally insane than recreating the Channel. I am 
> thinking when I sense a broken connection via an expired Deadline I can 
> shutdown() the old Subchannel and create a new Subchannel for the same 
> address. I'm not sure how to signal all other open RPCs to error out as if 
> connection failure had been detected by Keep-Alive - I'd have that problem 
> even with the channel recreation workaround.
>
> Thoughts?
>

-- 
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/efbd8616-be16-4208-bb9a-cdbb4b69369f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to