zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Jaton <benjamin.ja...@gmail.com>
Subject Connection to read only ensemble times out
Date Tue, 11 Oct 2016 22:19:16 GMT

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()) {
  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:

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"
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
:NIOServerCnxnFactory$AcceptThread@296] - Accepted socket connection from /
2016-10-11T15:03:02,666 [myid:] - INFO
[NIOWorkerThread-5:ZooKeeperServer@969] - Client attempting to establish
new session at /
2016-10-11T15:03:02,667 [myid:] - INFO  [ProcessThread(sid:1
cport:-1)::ZooKeeperServer@678] - Established session *0x1000129d58a0025*
with negotiated timeout 30000 for client /
*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
2016-10-11T15:03:33,517 [myid:] - INFO  [ProcessThread(sid:1
cport:-1)::NIOServerCnxn@606] - Closed socket connection for client / which had sessionid 0x1000129d58a0025

Any idea what might be going on?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message