Jochem Wichers Hoeth created CURATOR-710:
--------------------------------------------
Summary: EnsembleTracker leaking watch
Key: CURATOR-710
URL: https://issues.apache.org/jira/browse/CURATOR-710
Project: Apache Curator
Issue Type: Bug
Components: Framework
Affects Versions: 5.6.0
Reporter: Jochem Wichers Hoeth
EnsembleTracker registers a watch on /zookeeper/config (via
GetConfigBuilderImpl). It uses WatcherRemovalManager to automatically remove
this watch when closed. In Curator 5.6.0 this mechanism broke, and the watch no
longer gets removed when EnsembleTracker is closed.
*Technical details*
To enable the WatcherRemovalManager, EnsembleTracker wraps its client in a
WatcherRemovalFacade here:
[code|https://github.com/apache/curator/blob/a9a8020918c345fb6c3c0a099a27189cbd7cf819/curator-framework/src/main/java/org/apache/curator/framework/imps/EnsembleTracker.java#L88].
It passes this wrapped client to GetConfigBuilderImpl. In Curator 5.5.0 and
earlier, GetConfigBuilderImpl would use this client directly. But since [#474|
https://github.com/apache/curator/pull/474/files] got merged into 5.6.0, it
calls client.usingNamespace() which returns a NamespaceFacade that wraps the
_underlying_ CuratorFrameworkImpl client. So now when GetConfigBuilderImpl adds
a watch through its client, that call no longer passed through
WatcherRemovalManager. And when EnsembleTracker calls client.removeWatchers()
on close, the WatcherRemovalManager doesn't remove the watch anymore because it
isn't aware that it exists.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)