From c7e80503f3be97d26ff2de27f9e424070c8181bb Mon Sep 17 00:00:00 2001 From: Jean-Marc Saffroy Date: Sun, 10 Nov 2019 11:41:39 +0100 Subject: fix(core): when connection fails, close the ConnectionHandler (#577) (#579) When connection attempts fail repeatedly (e.g. all ZK servers are unavailable), eventually the socketpair in the ConnectionHandler fills up, and the Client gets stuck trying to write a single byte to the socketpair. Avoid this by ensuring we close the socketpair on a failed connection attempt. --- kazoo/client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kazoo/client.py b/kazoo/client.py index f4c21fa..6c066a0 100644 --- a/kazoo/client.py +++ b/kazoo/client.py @@ -628,6 +628,7 @@ class KazooClient(object): if not self.connected: # We time-out, ensure we are disconnected self.stop() + self.close() raise self.handler.timeout_exception("Connection time-out") if self.chroot and not self.exists("/"): -- cgit v1.2.1