Return-Path: X-Original-To: apmail-curator-dev-archive@minotaur.apache.org Delivered-To: apmail-curator-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C08C21863D for ; Fri, 31 Jul 2015 19:59:17 +0000 (UTC) Received: (qmail 15586 invoked by uid 500); 31 Jul 2015 19:59:05 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 15518 invoked by uid 500); 31 Jul 2015 19:59:05 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 15499 invoked by uid 99); 31 Jul 2015 19:59:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jul 2015 19:59:05 +0000 Date: Fri, 31 Jul 2015 19:59:04 +0000 (UTC) From: "Mike Drob (JIRA)" To: dev@curator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CURATOR-240) Severe memory leak in TreeCache when path does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CURATOR-240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14649738#comment-14649738 ] Mike Drob commented on CURATOR-240: ----------------------------------- I had spent a little bit of time looking at this, and I think it is watchers on the ZK side of things not getting cleared properly. > 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)