[
https://issues.apache.org/jira/browse/CURATOR-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103918#comment-14103918
]
ASF GitHub Bot commented on CURATOR-136:
----------------------------------------
GitHub user madrob opened a pull request:
https://github.com/apache/curator/pull/39
CURATOR-136 Make LeaderLatch handling of relative paths consistent.
LeaderLatch would previously normalize a relative path in some places
but not others, causing inconsistent behavior. Make it check for an
absolute path on startup.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/madrob/curator CURATOR-136
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/curator/pull/39.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 #39
----
commit 0f598860e78dd4796eb8af8cfcc370952258bded
Author: Mike Drob <[email protected]>
Date: 2014-08-11T20:12:53Z
CURATOR-136 Make LeaderLatch handling of relative paths consistent.
LeaderLatch would previously normalize a relative path in some places
but not others, causing inconsistent behavior. Make it check for an
absolute path on startup.
----
> Invalid LeaderLatch path never errors
> -------------------------------------
>
> Key: CURATOR-136
> URL: https://issues.apache.org/jira/browse/CURATOR-136
> Project: Apache Curator
> Issue Type: Bug
> Components: Recipes
> Affects Versions: 2.6.0
> Reporter: John Vines
>
> I was messing with the LeaderLatch and I noticed some ill behavior for the
> pathing of it. Given the following code-
> {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();
> }
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.2#6252)