You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The computers on which the 3 ZK servers run are deliberately OFF. Run the client from a forth computer.
In the client code, define 3 hosts in the KazooClient() statement. The start() statement that follows, cycles through the hosts in about 5 seconds per host. Not 10 as expected.
Setting the timeout in the call to KazooClient() or start() does not change this duration.
Snippet to Reproduce the Problem
zk = KazooClient(hosts='rpi17.local:2181,rpi18.local:2181,rpi19.local:2181') # Adding timeout param does not change behavior
zk.start()` # or zk.start(timeout=15)
Logs with logging in DEBUG mode
Cannot resolve rpi17.local: [Errno 8] nodename nor servname provided, or not known
Cannot resolve rpi18.local: [Errno 8] nodename nor servname provided, or not known
Cannot resolve rpi19.local: [Errno 8] nodename nor servname provided, or not known
Failed connecting to Zookeeper within the connection retry policy.
Traceback (most recent call last):
File "/Users/Dropbox/Idempotent/ZooKeeper/zkMyCli.py", line 441, in
zk.start(timeout=15)
File "/Users/rahav/anaconda3/lib/python3.11/site-packages/kazoo/client.py", line 669, in start
raise self.handler.timeout_exception("Connection time-out")
kazoo.handlers.threading.KazooTimeoutError: Connection time-out
Specifications
Kazoo version: 2.10.0
Result of pip list command: kazoo 2.10.0
Zookeeper version: 3.8.4
Zookeeper configuration:
Python version: 3.11.5
OS: macOS
The text was updated successfully, but these errors were encountered:
In the example and logs you've given, I don't think there is any way to get the "10s per host timeout" you would expect with Kazoo as the error you are getting is a DNS error that prevents Kazoo for making a connection since, well, your hostnames cannot be resolved to a valid IP address. Most of the time there is a 5s timeout for resolving a hostname so that's why you are noticing that specific value. You could probably update your system DNS settings to achieve what you want (maybe some options timeout:10 would work).
With Kazoo, you could make use of some KazooRetry() to retry more, for instance:
fromkazoo.clientimportKazooClientfromkazoo.retryimportKazooRetryzk=KazooClient(hosts='rpi17.local:2181,rpi18.local:2181,rpi19.local:2181', connection_retry=KazooRetry(max_tries=-1)) # infinite retrieszk.start(timeout=30) # wait for 30s... or more depending on the number of hosts + DNS setting
Expected Behavior
timeout
is respected.timeout
is respected.Actual Behavior
The computers on which the 3 ZK servers run are deliberately OFF. Run the client from a forth computer.
In the client code, define 3
hosts
in theKazooClient()
statement. Thestart()
statement that follows, cycles through the hosts in about 5 seconds per host. Not 10 as expected.Setting the
timeout
in the call toKazooClient()
orstart()
does not change this duration.Snippet to Reproduce the Problem
Logs with logging in DEBUG mode
Cannot resolve rpi17.local: [Errno 8] nodename nor servname provided, or not known
Cannot resolve rpi18.local: [Errno 8] nodename nor servname provided, or not known
Cannot resolve rpi19.local: [Errno 8] nodename nor servname provided, or not known
Failed connecting to Zookeeper within the connection retry policy.
Traceback (most recent call last):
File "/Users/Dropbox/Idempotent/ZooKeeper/zkMyCli.py", line 441, in
zk.start(timeout=15)
File "/Users/rahav/anaconda3/lib/python3.11/site-packages/kazoo/client.py", line 669, in start
raise self.handler.timeout_exception("Connection time-out")
kazoo.handlers.threading.KazooTimeoutError: Connection time-out
Specifications
pip list
command: kazoo 2.10.0The text was updated successfully, but these errors were encountered: