Hello,
I have moved to Apache Curator 5.9 recently (from 5.6) and I have observed a memory leak using that new version.
Checking using a heap dump, the leak is clearly coming from PersistentWatcher which is registering a listener on Curator and that listener is not properly removed when the PersistentWatcher is closed.
In this example, I have 1524 registered PersistentWatcher "owned" listeners, a very big majority of them being listeners from PersistentWatcher instances long gone (closed) and discarded...

This issue has been introduced by CURATOR-729 (PR#520): https://github.com/apache/curator/pull/520/changes#diff-03152e1ad97a8fdbe50c309d864922eeb0bad131198922c9d865b08851c8d877R83
The listener created during PersistentWatcher#start should be removed in PersistentWatcher#close.
Best regards,
Vincent
Hello,
I have moved to Apache Curator 5.9 recently (from 5.6) and I have observed a memory leak using that new version.

Checking using a heap dump, the leak is clearly coming from PersistentWatcher which is registering a listener on Curator and that listener is not properly removed when the PersistentWatcher is closed.
In this example, I have 1524 registered PersistentWatcher "owned" listeners, a very big majority of them being listeners from PersistentWatcher instances long gone (closed) and discarded...
This issue has been introduced by CURATOR-729 (PR#520): https://github.com/apache/curator/pull/520/changes#diff-03152e1ad97a8fdbe50c309d864922eeb0bad131198922c9d865b08851c8d877R83
The listener created during PersistentWatcher#start should be removed in PersistentWatcher#close.
Best regards,
Vincent