-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot resolve .. [Errno -2] Name or service not known #631
Conversation
kazoo/protocol/connection.py
Outdated
@@ -543,6 +543,8 @@ def _connect_loop(self, retry): | |||
|
|||
# Check for an empty hostlist, indicating none resolved | |||
if len(host_ports) == 0: | |||
if len(self.client.hosts) == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be willing to explain the reason for this additional condition? Looking at the code, I would have replaced the return STOP_CONNECTING
with a raise ForceRetryError('No host resolved, reconnecting')
but you may have seen something I am missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I was just trying to keep the behavior to default when multiple hosts are used and if they all fail to resolve. I would also prefer to keep it simple and raise retry in all cases. Will update.
Thans for this PR. Overall I am fine with the idea behind the change, it makes sense to trigger the retry policy in case hosts are not resolved. |
I second @StephenSorriaux's feedback. The idea is good but I am confused by the additional check on a single host in the list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
@ceache Can you please review. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thank you. Can you please merge the PR? Thanks in advance. |
Fixes #
Why is this needed?
Zookeeper is running from Docker containers and the service being resolved using Consul. When there's a network issue, the call to
socket.getaddrinfo
in method_expand_client_hosts
causing it to return the errorCannot resolve .. [Errno -2] Name or service not known
. This is causing retry to throwbackSTOP_CONNECTING
and it stops retrying as result.Proposed Changes
Change: Raise
ForceRetryError
if method_expand_client_hosts
returns empty host/ports andclient.hosts
has only one host to resolve.Does this PR introduce any breaking change?
n/a