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 D7F3117A05 for ; Wed, 18 Feb 2015 08:32:11 +0000 (UTC) Received: (qmail 59802 invoked by uid 500); 18 Feb 2015 08:32:11 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 59745 invoked by uid 500); 18 Feb 2015 08:32:11 -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 59733 invoked by uid 99); 18 Feb 2015 08:32:11 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Feb 2015 08:32:11 +0000 Date: Wed, 18 Feb 2015 08:32:11 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@curator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CURATOR-157) Avoid stack traces closing PathChildrenCache followed by closing CuratorFramework 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-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14325577#comment-14325577 ] ASF GitHub Bot commented on CURATOR-157: ---------------------------------------- Github user bdumon commented on the pull request: https://github.com/apache/curator/pull/51#issuecomment-74829158 Hmm, I don't see any such check? Is this in NodeCache or PathChildrenCache? > Avoid stack traces closing PathChildrenCache followed by closing CuratorFramework > --------------------------------------------------------------------------------- > > Key: CURATOR-157 > URL: https://issues.apache.org/jira/browse/CURATOR-157 > Project: Apache Curator > Issue Type: Improvement > Reporter: Bruno Dumon > Assignee: Jordan Zimmerman > Attachments: LogProblemIllustration.java > > > When closing PathChildrenCache, and immediately afterwards closing CuratorFramework, some ERROR-level stack traces are logged. > This was previously reported on the mailing list: http://curator.markmail.org/thread/bmfr62ekx5p2vv7f > The cause is that the BackgroundCallback defined in PathChildrenCache.refresh() will, when triggered, perform some more ZooKeeper operations. > Thus one can get in sequences such as: > * operation with BackgroundCallback is submitted > * processResult of the BackgroundCallback is called > * PathChildrenCache is closed > * CuratorFramework is closed > * processResult, which is running on another thread, comes to the point it does operations on ZooKeeper, which fail because ZooKeeper is closed. > There is no real impact on the application, it is just for log-esthetical reasons that I'd like to avoid it. > In the more common case, the processResult will receive an IllegalStateException, which could be easily catched and ignored in PathChildrenCache if the PathChildrenCache is closed: > {noformat} > 14/10/30 11:24:51 ERROR org.apache.curator.framework.imps.CuratorFrameworkImpl: Background exception was not retry-able or retry gave up > java.lang.IllegalStateException: instance must be started before calling this method > at com.google.common.base.Preconditions.checkState(Preconditions.java:149) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:360) > at org.apache.curator.framework.recipes.cache.PathChildrenCache.getDataAndStat(PathChildrenCache.java:545) > at org.apache.curator.framework.recipes.cache.PathChildrenCache.processChildren(PathChildrenCache.java:668) > at org.apache.curator.framework.recipes.cache.PathChildrenCache.access$200(PathChildrenCache.java:68) > at org.apache.curator.framework.recipes.cache.PathChildrenCache$4.processResult(PathChildrenCache.java:490) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.sendToBackgroundCallback(CuratorFrameworkImpl.java:715) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:502) > at org.apache.curator.framework.imps.GetChildrenBuilderImpl$2.processResult(GetChildrenBuilderImpl.java:166) > at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:590) > at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498) > {noformat} > But sometimes it also fails with other async operations deeper down: > {noformat} > 14/10/30 11:24:51 ERROR org.apache.curator.framework.imps.CuratorFrameworkImpl: Background exception was not retry-able or retry gave up > java.lang.IllegalStateException: Client is not started > at com.google.common.base.Preconditions.checkState(Preconditions.java:149) > at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:113) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:474) > at org.apache.curator.framework.imps.GetDataBuilderImpl.performBackgroundOperation(GetDataBuilderImpl.java:263) > at org.apache.curator.framework.imps.OperationAndData.callPerformBackgroundOperation(OperationAndData.java:65) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.performBackgroundOperation(CuratorFrameworkImpl.java:789) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:487) > at org.apache.curator.framework.imps.GetDataBuilderImpl.forPath(GetDataBuilderImpl.java:275) > at org.apache.curator.framework.imps.GetDataBuilderImpl.forPath(GetDataBuilderImpl.java:41) > at org.apache.curator.framework.recipes.cache.PathChildrenCache.getDataAndStat(PathChildrenCache.java:545) > at org.apache.curator.framework.recipes.cache.PathChildrenCache.processChildren(PathChildrenCache.java:668) > at org.apache.curator.framework.recipes.cache.PathChildrenCache.access$200(PathChildrenCache.java:68) > at org.apache.curator.framework.recipes.cache.PathChildrenCache$4.processResult(PathChildrenCache.java:490) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.sendToBackgroundCallback(CuratorFrameworkImpl.java:715) > at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:502) > at org.apache.curator.framework.imps.GetChildrenBuilderImpl$2.processResult(GetChildrenBuilderImpl.java:166) > at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:590) > at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498) > {noformat} > Therefore I have created a patch where PathChildrenCache.close() will wait until the possibly running BackgroundCallback is finished. > I will also attach a small class that illustrates the problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332)