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

org.apache.zookeeper.server.WatchManager resource leak

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5.3, 3.5.4, 3.6.0
    • 3.6.0, 3.5.5
    • server
    • -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

        Issue Links

          Activity

            People

              lvfangmin Fangmin Lv
              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