Hi Devs,
We are using ZK in Apache Airavata and when we run it for sometime some
connections are get lost and never get reconnect. I get following error and
since I try to reconnect in my process method it keeps trying and exhaust
the log. Of course I can fix the log issue but I am not sure why this is
happening . I am using ZK in standalone mode just single instance and below
is the code I use to reconnect and the log.
2015-04-08 09:43:10,785 [main-SendThread(gw111.iu.xsede.org:2181)] WARN
org.apache.zookeeper.ClientCnxn - Session 0x0 for server
gw111.iu.xsede.org/149.165.228.109:2181, unexpected error, closing socket
connection and attempting reconnect
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at
org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:66)
at
org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:291)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1041)
@Override
synchronized public void process(WatchedEvent watchedEvent) {
logger.info(watchedEvent.getPath());
synchronized (mutex) {
Event.KeeperState state = watchedEvent.getState();
logger.info(state.name());
switch(state){
case SyncConnected:
mutex.notify();
case Expired:case Disconnected:
try {
mutex = -1;
zk = new
ZooKeeper(AiravataZKUtils.getZKhostPort(),
AiravataZKUtils.getZKTimeout(), this);
synchronized (mutex) {
mutex.wait(); // waiting for the syncConnected event
}
storeServerConfig();
} catch (IOException e) {
logger.error("Error while synchronizing with zookeeper", e);
} catch (ApplicationSettingsException e) {
logger.error("Error while synchronizing with zookeeper", e);
} catch (InterruptedException e) {
logger.error("Error while synchronizing with zookeeper", e);
} catch (AiravataSystemException e) {
logger.error("Error while synchronizing with zookeeper", e);
}
}
}
}
Lahiru
--
Research Assistant
Science Gateways Group
Indiana University
|