[
https://issues.apache.org/jira/browse/CURATOR-123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jordan Zimmerman updated CURATOR-123:
-------------------------------------
Description:
see Test.java attached.
When there is only 1 out of 3 zookeeper started, the initial state of the
listener is CONNECTED but should be READ_ONLY.
NOTE: this issue got confused with CURATOR-122 and is being reworded to match
CURATOR-122.
was:
see Test.java attached.
To reproduce:
- have a 3 nodes ZK ensemble with readonlymode.enabled
- shut down 2 of the 3 ZK servers
- create curator client with the Builder (keep the timeout reasonably short)
- start it
- create a NodeCache listener on '/'
- start it
-> At that point, you will be in the CONNECTED state but you should be in the
READ_ONLY state (see CURATOR-122).
- start another ZooKeeper
-> the connection goes into SUSPENDED, then RECONNECTED, fine.
- stop one of the 2 ZooKeeper alive
-> the connection goes:
11151 [main-EventThread] INFO
org.apache.curator.framework.state.ConnectionStateManager - State change:
SUSPENDED
13731 [main-EventThread] INFO
org.apache.curator.framework.state.ConnectionStateManager - State change:
READ_ONLY
21946 [main-EventThread] INFO
org.apache.curator.framework.state.ConnectionStateManager - State change:
SUSPENDED
23483 [main-EventThread] INFO
org.apache.curator.framework.state.ConnectionStateManager - State change:
READ_ONLY
23585 [main-EventThread] INFO
org.apache.curator.framework.state.ConnectionStateManager - State change:
SUSPENDED
26027 [main-EventThread] INFO
org.apache.curator.framework.state.ConnectionStateManager - State change:
READ_ONLY
So it's flaky. Sometimes it doesn't switch back and forth, sometimes twice
only, sometimes a lot more.
Depending on the timeout on the client, it might take more time to appear.
I attached a sample code that would reproduce it in 20-30 seconds.
> ConnectionStateListener advertises READ_ONLY instead of CONNECTED the first
> time around
> ---------------------------------------------------------------------------------------
>
> Key: CURATOR-123
> URL: https://issues.apache.org/jira/browse/CURATOR-123
> Project: Apache Curator
> Issue Type: Bug
> Components: Client, Framework
> Affects Versions: 2.6.0
> Environment: Ubuntu 12.04
> 3 ZK with readonlymode.enabled
> Reporter: Benjamin Jaton
> Assignee: Jordan Zimmerman
> Labels: connection, listener
> Fix For: 2.6.1
>
> Attachments: Test.java
>
>
> see Test.java attached.
> When there is only 1 out of 3 zookeeper started, the initial state of the
> listener is CONNECTED but should be READ_ONLY.
> NOTE: this issue got confused with CURATOR-122 and is being reworded to match
> CURATOR-122.
--
This message was sent by Atlassian JIRA
(v6.2#6252)