I am using kazoo in project I am working on. But after some time I get an error message that new connection to zookeper cannot be opened.
So I wrote a little test program:
for i in range(0, 1000):
print i
zk = kazoo.client.KazooClient()
zk.start()
zk.stop()
And after around 500 iteration I've got an error: "Too many open files".
Am I using kazoo somehow wrong?
Call the close()
method. From the documentation:
close()
Free any resources held by the client.
This method should be called on a stopped client before it is discarded. Not doing so may result in filehandles being leaked.
New in version 1.0.
However the example code within the same documentation doesn't call close()
, so it's confusing.