2

I've faced a problem with error handling on my gRPC client. Shortly: I've got gRPC client and server both running in Kubernetes. Client makes synchronous calls to server to retrieve some data. Everything goes fine, but some time ago the client received an error rpc error: code = Unavailable desc = resolver returned no addresses. I've restarted the POD and it has reconnected without any problems.

After googling and looking into the gRPC balancer source code I've found that this error returns when the balancer cannot get the IP from a DNS (thats quite logical). It seems to be effects of Kubernetes PODs rebalancing or so.

But the question is how to handle this error properly? GRPC client has built in reconnection mechanism but it's not triggered in that situation. Of course I can catch this error, close existing connection and make a dial again, but I don't want to build a bicycle if there is more correct way to handle it.

Thank you!

2
  • It seems some debugging is in order. gRPC will automatically reconnect to new addresses when DNS is updated, and DNS is refreshed periodically (on connection errors; at most every 30 seconds, and with exponential backoff if there are no addresses currently connected). There was a bug during a short window that would prevent this; make sure you're not using an affected version: github.com/grpc/grpc-go/issues/3252 Commented Mar 23, 2020 at 16:24
  • Yes, it seems. Thank you for response :) Commented Apr 27, 2020 at 8:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.