Hello, I have a 3 nodes ensemble (3.5.1-alpha), and I use this code for the client:
System.setProperty("readonlymode.enabled", "true"); String cs = "QA-E8WIN11:2181,QA-E8WIN12:2181,QA-E8WIN13:2181"; ZooKeeper zk = new ZooKeeper(cs, 30000, null, true); while(!zk.getState().isConnected()) { Thread.sleep(1000); logger.error(zk.getState()); } byte[] data = zk.getData("/", false, new Stat()); QA-E8WIN11 is the only node where ZK is actually started. The other 2 machines are started (pingable), but ZK has been stopped. I verified that the ZK that is started is responsive and can be browsed. The above code works well when ZK picks the online ZK server first. However when it picks up a node where ZK is not started, it seems to connect properly into CONNECTEDREADONLY state, but then it hangs and fails on the getData call. Below is the relevant part of the client log: 21816 ERROR Test:31 - CONNECTEDREADONLY 148240 INFO o.a.z.ClientCnxn:1231 - Unable to read additional data from server sessionid *0x1000129d58a0025*, likely server has closed socket, closing socket connection and attempting reconnect Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for / at org.apache.zookeeper.KeeperException.create(KeeperException.java:99) at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) at org.apache.zookeeper.ZooKeeper.getData(ZooKeeper.java:1956) at org.apache.zookeeper.ZooKeeper.getData(ZooKeeper.java:1985) at TestCuratorReadOnly.main(TestCuratorReadOnly.java:33) And here is the relevant part of the server log: 2016-10-11T15:03:02,660 [myid:] - INFO [NIOServerCxnFactory.AcceptThread:/0.0.0.0:2181 :NIOServerCnxnFactory$AcceptThread@296] - Accepted socket connection from / 10.11.12.4:43494 2016-10-11T15:03:02,666 [myid:] - INFO [NIOWorkerThread-5:ZooKeeperServer@969] - Client attempting to establish new session at /10.11.12.4:43494 2016-10-11T15:03:02,667 [myid:] - INFO [ProcessThread(sid:1 cport:-1)::ZooKeeperServer@678] - Established session *0x1000129d58a0025* with negotiated timeout 30000 for client /10.11.12.4:43494 (...) *2016-10-11T15:03:33,517 [myid:] - INFO [SessionTracker:ZooKeeperServer@384] - Expiring session 0x1000129d58a0025, timeout of 30000ms exceeded* 2016-10-11T15:03:33,517 [myid:] - INFO [ProcessThread(sid:1 cport:-1)::PrepRequestProcessor@649] - Processed session termination for sessionid: 0x1000129d58a0025 2016-10-11T15:03:33,517 [myid:] - INFO [ProcessThread(sid:1 cport:-1)::MBeanRegistry@128] - Unregister MBean [org.apache.ZooKeeperService:name0=ReplicatedServer_id1,name1=replica.1,name2=ReadOnlyServer,name3=Connections,name4=10.11.12.4,name5=0x1000129d58a0025] 2016-10-11T15:03:33,517 [myid:] - INFO [ProcessThread(sid:1 cport:-1)::NIOServerCnxn@606] - Closed socket connection for client / 10.11.12.4:43494 which had sessionid 0x1000129d58a0025 Any idea what might be going on?