Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-3131

org.apache.zookeeper.server.WatchManager resource leak

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.3, 3.5.4, 3.6.0
    • Fix Version/s: 3.6.0, 3.5.5
    • Component/s: server
    • Environment:

      -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?

        Attachments

          Activity

            People

            • Assignee:
              lvfangmin Fangmin Lv
              Reporter:
              hw_wangchao ChaoWang
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 4h 20m
                4h 20m