summaryrefslogtreecommitdiff
path: root/kazoo/protocol
diff options
context:
space:
mode:
authorJiangge Zhang <tonyseek@gmail.com>2016-07-29 11:41:29 +0800
committerJiangge Zhang <tonyseek@gmail.com>2016-07-29 18:19:41 +0800
commit61a3576a822a72888eb330e32dee02fddf7f2acc (patch)
treed170ca39132b951ba44698bde5cfb44e46b67718 /kazoo/protocol
parent1b4bca7cae660c8f9edd5c9693f9159e69bef320 (diff)
downloadkazoo-61a3576a822a72888eb330e32dee02fddf7f2acc.tar.gz
Fix the client.add_auth hangs by xids mismatch.
This commit fixes https://github.com/python-zk/kazoo/issues/229 by throwing the runtime exception into the dequeued async_result. It will end the waiting of user threading. But this commit doesn't fix the xids mismatch itself. The unordered xids may caused by a bug from the ZooKeeper server side, such as the official issues https://issues.apache.org/jira/browse/ZOOKEEPER-1863 described.
Diffstat (limited to 'kazoo/protocol')
-rw-r--r--kazoo/protocol/connection.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kazoo/protocol/connection.py b/kazoo/protocol/connection.py
index 067a629..1b398b9 100644
--- a/kazoo/protocol/connection.py
+++ b/kazoo/protocol/connection.py
@@ -338,8 +338,10 @@ class ConnectionHandler(object):
if header.zxid and header.zxid > 0:
client.last_zxid = header.zxid
if header.xid != xid:
- raise RuntimeError('xids do not match, expected %r '
+ exc = RuntimeError('xids do not match, expected %r '
'received %r', xid, header.xid)
+ async_object.set_exception(exc)
+ raise exc
# Determine if its an exists request and a no node error
exists_error = (header.err == NoNodeError.code and