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

Eric Tschetter updated CURATOR-21:
----------------------------------

    Attachment: CURATOR-21-Fix_watcher_race.patch

Attaching another patch to fix a slight bug with the changes introduced here.

Allowing the executor to queue up tasks has introduced a race condition in 
which.  Specifically, if the PathChildrenCache is set to watch for data 
changes, after the PathChildrenCache has been closed the dataWatcher will stay 
registered on the various paths ('cause ZK is awesome like that) and, when 
changes happen to those paths, the watcher will fire and try to submit 
Runnables to the closed ExecutorService.  This results in 
RejectedExecutionExceptions showing up in the logs, there is actually nothing 
functionally wrong with this other than that it scares people who don't know 
what is going on.

This patch fixes it so that it will not generate those exceptions anymore.
                
> PathChildrenCache consumes an entire thread all the time no matter what
> -----------------------------------------------------------------------
>
>                 Key: CURATOR-21
>                 URL: https://issues.apache.org/jira/browse/CURATOR-21
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.0.0
>            Reporter: Eric Tschetter
>            Assignee: Jordan Zimmerman
>         Attachments: CURATOR-21-docs.patch, 
> CURATOR-21-Fix_watcher_race.patch, CURATOR-21.patch
>
>
> PathChildrenCache currently takes an Executor, but only to fire off a 
> Runnable that does a blocking while loop waiting for work.  This means that 
> you must have one thread per PathChildrenCache, which is not that great.
> PathChildrenCache should just use the Executor's work queuing mechanism to 
> enqueue work items instead of maintaining its own work queue mechanism.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to