[
https://issues.apache.org/jira/browse/CURATOR-240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14649742#comment-14649742
]
Scott Blum commented on CURATOR-240:
------------------------------------
Actually I think it's TreeCache getting itself into an infinite "loop" based on
my debugging.
> Severe memory leak in TreeCache when path does not exist
> --------------------------------------------------------
>
> Key: CURATOR-240
> URL: https://issues.apache.org/jira/browse/CURATOR-240
> Project: Apache Curator
> Issue Type: Bug
> Components: Recipes
> Affects Versions: 2.8.0
> Environment: java version "1.7.0_71"
> Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
> Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
> OSX Yosemite
> Reporter: Joe Littlejohn
> Assignee: Scott Blum
> Priority: Critical
> Labels: memory-leak
>
> When creating a TreeCache, if the path supplied does not exist in Zookeeper
> then the heap is quickly exhausted. The problem appears to be instances of
> org.apache.curator.framework.imps.NamespaceWatcher.
> Try running the following test:
> {code}
> package org.apache.curator.framework.recipes.cache;
> import org.apache.curator.framework.CuratorFramework;
> import org.apache.curator.framework.CuratorFrameworkFactory;
> import org.apache.curator.framework.recipes.cache.TreeCache;
> import org.apache.curator.retry.RetryOneTime;
> import org.apache.curator.test.TestingServer;
> public class TreeCacheLeak {
> public static void main(String[] args) throws Exception {
> TestingServer server = new TestingServer();
>
> final CuratorFramework curatorFramework =
> CuratorFrameworkFactory.newClient(server.getConnectString(), new
> RetryOneTime(1));
> curatorFramework.start();
> final TreeCache cache = new TreeCache(curatorFramework,
> "/foo/bar/baz");
> cache.start();
> try {
> while (true) {
> Thread.sleep(1000);
> }
> } finally {
> cache.close();
> server.close();
> }
> }
> }
> {code}
> Launch the class then connect e.g. jvisualvm. You'll see the heap growing and
> if you watch for a few minutes then take a heap dump, you'll see millions of
> instances of org.apache.curator.framework.imps.NamespaceWatcher are present.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)