Proper error handling for streams. Should connections need to be thrown away on some errors?

26 views
Skip to first unread message

jdw...@gmail.com

unread,
May 17, 2018, 10:28:05 PM5/17/18
to grpc.io
Howdy,

I'm trying to build some configuration distribution with gRPC for prefab.cloud. All is working, but I could use a second opinion on whether I'm implementing error handling correctly. 
My clients would like to setup a connection and then listen forever. So far I have found that they successfully reconnect after network blips, but when I deploy the server my clients will hang unless I throw away the connection. Is that expected? 

My approach has been to treat all errors as semi-fatal, back off myself, nuke the connection and start over.


Relevant code is in 
https://github.com/prefab-cloud/prefab-cloud-ruby/blob/master/lib/prefab/config_client.rb#L119-L133

Does that seem like the right approach? 

(For bonus points you can see my kinda weird "stub" cache. That felt... weird...   but I was trying to avoid creating new stubs everywhere. Am I being silly?)

Thanks!

-Jeff

Penn (Dapeng) Zhang

unread,
May 30, 2018, 1:30:23 PM5/30/18
to grpc.io
Can you provide more details about what is happening when you deploy the server? And what your client is doing when you deploy the server, like is the client having an ongoing RPC, or is it idle? 

jdw...@ezcater.com

unread,
Jun 2, 2018, 10:01:10 PM6/2/18
to grpc.io
Hi. The clients are trying to just keep an everlasting connection to the server (ie I never call onComplete() on the server). 

Deploys are run by AWS ECS. All the instances are in an AWS NLB, then ECS starts removing them from the LB after it has brought new nodes up. I presume that that means the services just disappear into the ether from the perspective of the client. 

I will have to spend some time to go reproduce the errors I'd had. My question here is just whether what I've ended up with is "expected bahavior", specifically that after the server instance I've connected to disappears I should recreate the stub & the channel as well. 
Reply all
Reply to author
Forward
0 new messages