You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by domwong <gi...@git.apache.org> on 2014/05/21 14:49:37 UTC

[GitHub] curator pull request: Curator locks leaving dangling watches

GitHub user domwong opened a pull request:

    https://github.com/apache/curator/pull/7

    Curator locks leaving dangling watches

    As per https://issues.apache.org/jira/browse/CURATOR-107 . I've seen this in our services too. 
    
    The issue is because the code is using exists() call rather than getData() for creating a watch for lock. exists() creates a watch regardless of whether the node exists or not, getData() will only create the watch if node exists

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/domwong/curator master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/curator/pull/7.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #7
    
----
commit 8a94985c07b3e6f74ac1a2935af008cbdb649410
Author: Dominic Wong <do...@hailocab.com>
Date:   2014-05-21T12:20:55Z

    Lock is leaving dangling watchers for nodes that don't exist.

commit c9716499642b2dd4a0d77e5df6f9b84e8dfc90d0
Author: Dominic Wong <do...@hailocab.com>
Date:   2014-05-21T12:40:39Z

    Catch no node exception

commit ac57e11b34bb2970775b385f5a1e94bccd287232
Author: Dominic Wong <do...@hailocab.com>
Date:   2014-05-21T12:45:54Z

    No need for null check

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: Curator locks leaving dangling watches

Posted by Randgalt <gi...@git.apache.org>.
Github user Randgalt commented on a diff in the pull request:

    https://github.com/apache/curator/pull/7#discussion_r12897669
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java ---
    @@ -295,9 +295,9 @@ private boolean internalLockLoop(long startMillis, Long millisToWait, String our
     
                         synchronized(this)
                         {
    -                        Stat stat = client.checkExists().usingWatcher(watcher).forPath(previousSequencePath);
    -                        if ( stat != null )
    +                        try 
                             {
    +                            byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
    --- End diff --
    
    Very interesting. I can see how the previous code would leave watches around. This is a very big change though. I'll run the tests with it and think about edge cases.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: Curator locks leaving dangling watches

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/curator/pull/7


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---