Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-136

Invalid LeaderLatch path never errors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 2.7.0
    • Recipes
    • None

    Description

      I was messing with the LeaderLatch and I noticed some ill behavior for the pathing of it. Given the following code-

        public static void main(String args[]) throws Exception {
          TestingServer ts = new TestingServer();
      
          CuratorFramework curator = CuratorFrameworkFactory.builder().connectString(ts.getConnectString()).retryPolicy(new ExponentialBackoffRetry(1000, 5)).build();
          curator.start();
          curator.getZookeeperClient().blockUntilConnectedOrTimedOut();
          curator.create().creatingParentsIfNeeded().forPath("/parent", "A string".getBytes());
          
          try {
            LeaderLatch ll = new LeaderLatch(curator, "parent", "myNode");
            ll.start();
            ll.await();
            System.out.println(ll.hasLeadership());
            ll.close();
          } catch (Exception e) {
            e.printStackTrace();
          }
      
          ts.close();
        }
      

      the system will just hang forever. Inspecting the TestingServer with zkcli shows entries showing up though.

      If I switch out the path in the LeaderLatch constructor with "/parent", the same path is created AND the program runs fine.

      LeaderLatch should either accept the path all around or fail outright, not this half state that makes things difficult for the user.

      Attachments

        Activity

          People

            randgalt Jordan Zimmerman
            vines John Vines
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: