curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evaristo (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-53) PersistentEphemeralNode does not work when ZK server are not available when the node is started
Date Wed, 18 Sep 2013 09:30:51 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770602#comment-13770602
] 

Evaristo commented on CURATOR-53:
---------------------------------

I have test the new implementation and I think there is an issue with the ConnectionStateListener
of the CuratorFramework used in the recipe

This sequence is not working (The problem is that the ConnectionStateListener is triggered
as CONNECTED even when the ZK server is stopped, and this related with the start of the PersistentEphemeralNode
instance)

// ZK servers are not started here
ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 1, 2000);
CuratorFramework zkClient = CuratorFrameworkFactory.newClient("127.0.0.1:30101", 

4500,
4500,
retryPolicy);

// Added Connection State Listener
ConnectionStateListener listener = new ConnectionStateListener() {
			
			@Override
			public void stateChanged(CuratorFramework client, ConnectionState state) {
				System.out.println("new state" + state);
			}
		};
		zkClient.getConnectionStateListenable().addListener(listener );

zkClient.start();
Thread.sleep(2000);
PersistentEphemeralNode pen = new PersistentEphemeralNode(zkClient, Mode.EPHEMERAL, "/abc/pen",
"hello".getBytes());
pen.start();

// HERE YOU CAN SEE THE MESSAGE PRINTED BY THE ConnectionStateListener AS CONNECTED (BUT THAT
IT IS NOT POSSIBLE BECAUSE THE SERVER IT IS STILL STOPPED)


Thread.sleep(100000);

// Start ZK servers here
Thread.sleep(2000);
// "/abc/pen" ephemeral node is not created

It is expected that once the CuratorFrameowrk is connected the ephemeral node is created

I attach a program that shows the failure

                
> PersistentEphemeralNode does not work when ZK server are not available when the node
is started
> -----------------------------------------------------------------------------------------------
>
>                 Key: CURATOR-53
>                 URL: https://issues.apache.org/jira/browse/CURATOR-53
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.2.0-incubating
>         Environment: Windows, Java 1.7, Zookeeper 3.4.5, Curator 2.1.0
>            Reporter: Evaristo
>             Fix For: 2.3.0-incubating
>
>         Attachments: FailurePenStart.java
>
>
> This sequence is not working:
> // ZK servers are not started here
> ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 1, 2000);
> CuratorFramework zkClient = CuratorFrameworkFactory.newClient("127.0.0.1:30101", 
> 4500,
> 4500,
> retryPolicy);
> zkClient.start();
> Thread.sleep(2000);
> PersistentEphemeralNode pen = new PersistentEphemeralNode(zkClient, Mode.EPHEMERAL, "/abc/pen",
"hello".getBytes());
> Thread.sleep(2000);
> // Start ZK servers here
> Thread.sleep(2000);
> // "/abc/pen" ephemeral node is not created
> It is expected that once the CuratorFrameowrk is connected the ephemeral node is created
> I attach a program that shows the failure

--
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

Mime
View raw message