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 51A12C48E for ; Fri, 16 Jan 2015 02:37:23 +0000 (UTC) Received: (qmail 98497 invoked by uid 500); 16 Jan 2015 02:37:24 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 98448 invoked by uid 500); 16 Jan 2015 02:37:24 -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 98436 invoked by uid 99); 16 Jan 2015 02:37:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2015 02:37:24 +0000 X-ASF-Spam-Status: No, hits=-2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_HI,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of barlock@us.ibm.com designates 32.97.110.151 as permitted sender) Received: from [32.97.110.151] (HELO e33.co.us.ibm.com) (32.97.110.151) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2015 02:37:16 +0000 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Jan 2015 19:36:55 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 15 Jan 2015 19:36:53 -0700 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id BC69E19D801C for ; Thu, 15 Jan 2015 19:28:04 -0700 (MST) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t0G2aq2o30212218 for ; Thu, 15 Jan 2015 19:36:52 -0700 Received: from d03av05.boulder.ibm.com (localhost [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t0G2aqKk029733 for ; Thu, 15 Jan 2015 19:36:52 -0700 Received: from d03nm119.boulder.ibm.com (d03nm119.boulder.ibm.com [9.63.40.225]) by d03av05.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t0G2aqF1029730 for ; Thu, 15 Jan 2015 19:36:52 -0700 In-Reply-To: <201501161016340236671@163.com> References: <201501161016340236671@163.com> To: user@zookeeper.apache.org MIME-Version: 1.0 Subject: Re: ConnectionLossException X-KeepSent: F9211E11:F2B1D3F8-85257DCF:000E0FCE; type=4; name=$KeepSent X-Mailer: IBM Notes Release 9.0.1FP2 SHF37 August 25, 2014 From: Chris Barlock Message-ID: Date: Thu, 15 Jan 2015 21:36:50 -0500 X-MIMETrack: Serialize by Router on D03NM119/03/M/IBM(Release 9.0.1FP1|April 03, 2014) at 01/15/2015 19:36:52, Serialize complete at 01/15/2015 19:36:52 Content-Type: multipart/alternative; boundary="=_alternative 000E5CA985257DCF_=" X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15011602-0009-0000-0000-000008071FEF X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 000E5CA985257DCF_= Content-Type: text/plain; charset="US-ASCII" My ensemble is a single ZK node running on the same computer as the rest of my application. I think it is a "good state" because my configuration data does get loaded into ZK. Does ZK create the ConnectionLossException if the session timed out and I tried to use it after this happened? If so, it would be related to the timeout. If not, what causes ConnectionLossException? Chris IBM Tivoli Systems Research Triangle Park, NC (919) 224-2240 Internet: barlock@us.ibm.com From: "bit1129@163.com" To: "user@zookeeper.apache.org" Date: 01/15/2015 09:18 PM Subject: Re: ConnectionLossException Connection loss is not related with the session timeout. If it frequently ocurrs, then it indicates that the ensemble of zookeeper are not in a good state. bit1129@163.com From: Chris Barlock Date: 2015-01-16 10:04 To: user Subject: ConnectionLossException 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 --=_alternative 000E5CA985257DCF_=--