You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Ioannis Canellos (JIRA)" <ji...@apache.org> on 2013/07/04 22:55:48 UTC

[jira] [Updated] (CURATOR-14) Memory leak in Curator watches

     [ https://issues.apache.org/jira/browse/CURATOR-14?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ioannis Canellos updated CURATOR-14:
------------------------------------

    Attachment: CURATOR-14-dispatchingwatcher.patch

I experimented with Eric's idea and created the attached patch.

The patch introduces a global watcher (DispatchingWatcher) which dispatches events to all registered watchers. 

Watcher/Path pairs can be registered to the dispatcher (in the same manner that are registered in ZK itself). The main difference is that watcher instances are stored in a guava cache that uses soft values (weak values were too eager for some of curator tests, so went with soft).

Registered watchers will be removed from the DispatchingWatcher when fired or garbage collected.

A single watcher can be registered to many paths, but only once per path.


                
> Memory leak in Curator watches
> ------------------------------
>
>                 Key: CURATOR-14
>                 URL: https://issues.apache.org/jira/browse/CURATOR-14
>             Project: Apache Curator
>          Issue Type: New Feature
>          Components: Recipes
>    Affects Versions: 2.0.0-incubating
>            Reporter: Brandon Beck
>            Priority: Minor
>         Attachments: CURATOR-14-dispatchingwatcher.patch, CURATOR-14-draft-2.patch, CURATOR-14-draft-3.patch, CURATOR-14.patch, MemoryTest.java
>
>
> The JVM runs out of memory if you repetitively create a PathChildrenCache, start it then immediately stop it.  It appears that the memory is taken up by a watch that isn't ever cleaned up.  Curator attempts to do some pooling of watches, but doesn't seem to use the path in the pooling.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira