From c7e80503f3be97d26ff2de27f9e424070c8181bb Mon Sep 17 00:00:00 2001 From: Jean-Marc Saffroy Date: Sun, 10 Nov 2019 11:41:39 +0100 Subject: [PATCH] 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 f4c21fa5..6c066a06 100644 --- a/kazoo/client.py +++ b/kazoo/client.py @@ -628,6 +628,7 @@ def start(self, timeout=15): 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("/"):