Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7CCBC17BAB for ; Wed, 22 Apr 2015 04:36:38 +0000 (UTC) Received: (qmail 37312 invoked by uid 500); 22 Apr 2015 04:36:37 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 37263 invoked by uid 500); 22 Apr 2015 04:36:37 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 37252 invoked by uid 99); 22 Apr 2015 04:36:37 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2015 04:36:37 +0000 Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 1F1B91A0386 for ; Wed, 22 Apr 2015 04:36:37 +0000 (UTC) Received: by lbbzk7 with SMTP id zk7so170979435lbb.0 for ; Tue, 21 Apr 2015 21:36:35 -0700 (PDT) X-Received: by 10.112.168.102 with SMTP id zv6mr1050279lbb.45.1429677395392; Tue, 21 Apr 2015 21:36:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.87.75 with HTTP; Tue, 21 Apr 2015 21:35:55 -0700 (PDT) In-Reply-To: References: From: Patrick Hunt Date: Tue, 21 Apr 2015 21:35:55 -0700 Message-ID: Subject: Re: Intermittent connection loss error To: UserZooKeeper Content-Type: multipart/alternative; boundary=001a11c33d324bc08c051448b56d --001a11c33d324bc08c051448b56d Content-Type: text/plain; charset=UTF-8 Did you check the server logs? There might be an indication why it keeps closing the connection. Patrick On Tue, Apr 21, 2015 at 7:43 AM, Lahiru Ginnaliya Gamathige < glahiru@gmail.com> wrote: > 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 > --001a11c33d324bc08c051448b56d--