zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Barlock <barl...@us.ibm.com>
Subject ConnectionLossException
Date Fri, 16 Jan 2015 02:04:51 GMT
We are currently using ZK 3.3.4, which is included in the version of Kafka 
we are using.  I'm seeing a number of exceptions like:

org.apache.zookeeper.KeeperException$ConnectionLossException: 
KeeperErrorCode = ConnectionLoss for /com
        at 
org.apache.zookeeper.KeeperException.create(KeeperException.java:90)
        at 
org.apache.zookeeper.KeeperException.create(KeeperException.java:42)
        at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:815)
        at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:843)
        at 
com.ibm.tivoli.ccm.config.rest.ConfigClient.setValueAtNode(ConfigClient.java:630)

My method setValueAtNode includes a call to this method before I make any 
zk (ZooKeeper) calls:

    private void connectZooKeeper() {
        final String methodName = "connectZooKeeper";
        trace.entry(CLASS_NAME, methodName);
 
        if (zk == null || zk.getState() != States.CONNECTED) {
            if (zk != null) {
                close();
            }
            try {
                zk = new ZooKeeper(connectString, sessionTimeout, this);
                int connectAttempts = 0;
                while (zk.getState() != States.CONNECTED && 
connectAttempts < MAX_ZK_CONNECT_ATTEMPTS) {
                    try {
                        Thread.sleep(ZK_CONNECT_WAIT);
                    } catch (InterruptedException e) {
                        // Ignore
                    }
                    connectAttempts++;
                }
            } catch (IOException e) {
                trace.exception(CLASS_NAME, methodName, e);
            }
        }
 
        trace.exit(CLASS_NAME, methodName); 
    }

I'm totally guessing that the connection is timing out between the time 
this method is called and when I make the following zk method calls.  Is 
there a best practise for ensuring one is connected to ZooKeeper?  My 
session timeout is 3000 ms.

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