-
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
KazooClient bug? connection time-out, but not retry another zk server. #205
Comments
Yahoo.com:80 (niceeee, haha) |
This should be submitted to python-zk mail list if you have a question. I don't think you should try to connect to webservers offhand. |
i'm facing this as well. did you ever figure it out? |
Try setting the kazoo.client.KazooClient.start timeout higher than the kazoo.client.KazooClient timeout. For your example: |
^^^ Doing the above can help, but might mask an issue with timeouts once the connection is established. Kazoo seems to use the client session timeout (the one in kazoo.client.KazooClient) for each attempted TCP connection before negotiating a session, but later on, it divides this number by the number of hosts in the ensemble to decide on its internal "connect timeout" (e.g. how long to wait before a write request or a reconnect times out.) So, if you set a low timeout in I'm opening a separate issue to check whether this is intended behavior. |
My question is that:
when client connect to yahoo.com:80, there is a timeout exception was throwed, But it didn't retry connect to 127.0.0.1:2181( this is my real zk server). Anybody can help me? thanks.
source code:
import logging
logging.basicConfig(level=logging.DEBUG)
from kazoo.client import KazooClient
from kazoo.retry import KazooRetry
_retry = KazooRetry(max_tries=1000, delay=0.5, backoff=2)
_zk = KazooClient(hosts="yahoo.com:80,127.0.0.1:2181", logger=logging, read_only=True, timeout=30, connection_retry=_retry)
_zk.start()
_zk.stop()
log:
DEBUG:root:ZK loop started
DEBUG:root:Skipping state change
INFO:root:Connecting to yahoo.com:80
DEBUG:root: Using session_id: None session_passwd: 00000000000000000000000000000000
INFO:root:Sending request(xid=None): Connect(protocol_version=0, last_zxid_seen=0, time_out=30000, session_id=0, passwd='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', read_only=True)
WARNING:root:Connection dropped: socket connection broken
DEBUG:root:Connection stopped
Traceback (most recent call last):
File "/tmp/1.py", line 7, in
_zk.start()
File "/home/s/apps/wdshopping/python/lib/python2.7/site-packages/kazoo-1.2.1-py2.7.egg/kazoo/client.py", line 476, in start
raise self.handler.timeout_exception("Connection time-out")
kazoo.handlers.threading.TimeoutError: Connection time-out
The text was updated successfully, but these errors were encountered: