gRPC client auto reconnect

3,180 views
Skip to first unread message

Hemendra Rawat

unread,
Nov 7, 2021, 10:59:47 PM11/7/21
to grpc.io
Hi All,

I'm new to using gRPC framework!

What will happen if the gRPC server process terminates and is restarted after few seconds for e.g. 20 seconds delay ? Will the client side channel auto reconnect or do I need to add specific logic on client side to handle reconnects on server restart?




Yuri Golobokov

unread,
Nov 8, 2021, 1:12:58 PM11/8/21
to Hemendra Rawat, grpc.io
Hi Hemendra,

A gRPC channel will reconnect automatically.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/81b09b62-bcba-47e8-bea8-50112985b645n%40googlegroups.com.

Hemendra Rawat

unread,
Nov 8, 2021, 5:41:34 PM11/8/21
to grpc.io
Thanks for answering the question. What happens to the inflight client calls when the server terminates and then restarts? Does the client gets an error "UNAVAILABLE" and they have to add logic to retry the failed call, or gRPC call will just block and returns when server becomes alive?

Regards,
Hemendra 

Сергей Соболев

unread,
Nov 9, 2021, 11:28:17 AM11/9/21
to grpc.io
A grpc ClientContext has set_wait_for_ready method.  https://grpc.github.io/grpc/cpp/classgrpc_1_1_client_context.html#aa342af7349c88727e8bd4c765a000ae5

вторник, 9 ноября 2021 г. в 01:41:34 UTC+3, hkr...@gmail.com:

Yuri Golobokov

unread,
Nov 9, 2021, 1:55:02 PM11/9/21
to grpc.io
I'd say it depends on the client implementation, but AFAIK most clients will return UNAVAILABLE if the connection is dropped after the request is sent to the server.
Reply all
Reply to author
Forward
0 new messages