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 F0A2D10047 for ; Tue, 25 Feb 2014 16:13:48 +0000 (UTC) Received: (qmail 71195 invoked by uid 500); 25 Feb 2014 16:13:48 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 71147 invoked by uid 500); 25 Feb 2014 16:13:47 -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 71127 invoked by uid 99); 25 Feb 2014 16:13:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Feb 2014 16:13:45 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 25 Feb 2014 16:13:43 +0000 Received: (qmail 70786 invoked by uid 99); 25 Feb 2014 16:13:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Feb 2014 16:13:21 +0000 Date: Tue, 25 Feb 2014 16:13:21 +0000 (UTC) From: "Jordan Zimmerman (JIRA)" To: dev@curator.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CURATOR-89) ChildReaper only checks for children once MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CURATOR-89?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13911684#comment-13911684 ] Jordan Zimmerman commented on CURATOR-89: ----------------------------------------- Test clearly shows the problem. CloseableScheduledExecutorService.scheduleWithFixedDelay is incorrectly using a FutureTask which is a one-time use object. I've pushed a potential fix as branch CURATOR-89. Please test your use case to see if it fixes things. > ChildReaper only checks for children once > ----------------------------------------- > > Key: CURATOR-89 > URL: https://issues.apache.org/jira/browse/CURATOR-89 > Project: Apache Curator > Issue Type: Bug > Reporter: David Kesler > Assignee: Jordan Zimmerman > Attachments: curator-89-test.patch > > > I've created a child reaper for a particular path underneath which have a bunch of lock paths that I want cleaned up periodically. The problem is that I'm seeing ChildReaper.doWork only get called once. Thus newly added children nodes never get picked up by the child reaper and passed to the actual reaper. > The problem appears to be the fact that an InternalFutureTask is being submitted to the ScheduledExecutorService through the ClosableScheduledExecutorService that ChildReaper uses. Putting a breakpoint on java's FutureTask.run and FutureTask.runAndReset, it looks like what happens is that when the InternalFutureTask gets submitted to the ScheduledExecutorService, another task gets created. THAT task wraps the InternalFutureTask that the ClosableScheduledExecutorService submitted to the real executor and correctly gets executed repeatedly via its runAndReset method. However when the outermost task executes it calls .run on the wrapped InternalFutureTask. The first time the InternalFutureTask itself is executed, the state of it's Sync field gets set to RAN (2). Then every future invocation of run on the InternaFutureTask is ignored because the task has already run. > The Reaper itself doesn't seem to have a problem because it's manually rescheduling the task after every invocation rather than using scheduleWithFixedInterval. > I don't know if it makes a difference, but I'm using the default scheduled executor for ChildReaper. I'm using java 6 and tried both curator 2.1.0 and 2.4.0 -- This message was sent by Atlassian JIRA (v6.1.5#6160)