Benjamin Jaton created CURATOR-123:
--------------------------------------
Summary: ConnectionStateListener is confused by READ_ONLY state
Key: CURATOR-123
URL: https://issues.apache.org/jira/browse/CURATOR-123
Project: Apache Curator
Issue Type: Bug
Components: Client
Affects Versions: 2.6.0
Environment: Ubuntu 12.04
3 ZK with readonlymode.enabled
Reporter: Benjamin Jaton
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.
--
This message was sent by Atlassian JIRA
(v6.2#6252)