python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

ChildrenWatch can not be collected by gc after be stopped? #542

Closed kulallwang closed 5 years ago

kulallwang commented 5 years ago

When the registered function return 'False', the ChildrenWatch is stopped. But it does not remove session watcher from listener. It means ChildrenWatch can not be collected by gc. The result is that the ChildrenWatch will be always increase and cause memory leakage.

StephenSorriaux commented 5 years ago

Hi,

Thanks for your issue. You're right, it seem like it would be better to also remove session watcher from the listener when func() is returning False. Feel free to submit any PR if you have some times, I would be more than happy to merge a fix.

kulallwang commented 5 years ago

Hi,

I submit a PR. It seems always check failed by different test case with cause such as "Connection time-out" and so on.

StephenSorriaux commented 5 years ago

Hi,

Thanks for your PR. I will try to review it today. Don't bother closing / re-opening your PR to trigger the tests, I will take care of it.