Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.5.3, 3.5.4, 3.6.0
-
-Xmx512m
Description
In some cases, the variable watch2Paths in Class WatchManager does not remove the entry, even if the associated value "HashSet" is empty already.
The type of key in Map watch2Paths is Watcher, instance of NettyServerCnxn. If it is not removed when the associated set of paths is empty, it will cause the memory increases little by little, and OutOfMemoryError triggered finally.
Possible Solution:
In the following function, the logic should be added to remove the entry.
org.apache.zookeeper.server.WatchManager#removeWatcher(java.lang.String, org.apache.zookeeper.Watcher)
if (paths.isEmpty())
{ watch2Paths.remove(watcher); }For the following function as well:
org.apache.zookeeper.server.WatchManager#triggerWatch(java.lang.String, org.apache.zookeeper.Watcher.Event.EventType, java.util.Set<org.apache.zookeeper.Watcher>)
Please confirm this issue?