You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jordan Zimmerman (JIRA)" <ji...@apache.org> on 2014/02/25 23:41:23 UTC

[jira] [Resolved] (CURATOR-89) ChildReaper only checks for children once

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

Jordan Zimmerman resolved CURATOR-89.
-------------------------------------

    Resolution: Fixed

Merged and pushed. Thanks for the test.

> ChildReaper only checks for children once
> -----------------------------------------
>
>                 Key: CURATOR-89
>                 URL: https://issues.apache.org/jira/browse/CURATOR-89
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework, Recipes
>    Affects Versions: 2.4.0
>            Reporter: David Kesler
>            Assignee: Jordan Zimmerman
>             Fix For: 2.4.1
>
>         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)