Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@minotaur.apache.org Received: (qmail 90304 invoked from network); 12 Feb 2009 19:28:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Feb 2009 19:28:52 -0000 Received: (qmail 78599 invoked by uid 500); 12 Feb 2009 19:28:51 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 78585 invoked by uid 500); 12 Feb 2009 19:28:51 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 78570 invoked by uid 99); 12 Feb 2009 19:28:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 11:28:51 -0800 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [207.126.228.149] (HELO rsmtp1.corp.yahoo.com) (207.126.228.149) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 19:28:43 +0000 Received: from [172.21.148.10] (wlanvpn-mc2e-246-10.corp.yahoo.com [172.21.148.10]) (authenticated bits=0) by rsmtp1.corp.yahoo.com (8.13.8/8.13.8/y.rout) with ESMTP id n1CJS6hY077131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Feb 2009 11:28:07 -0800 (PST) Message-ID: <49947845.3030802@apache.org> Date: Thu, 12 Feb 2009 11:28:05 -0800 From: Patrick Hunt User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: zookeeper-user@hadoop.apache.org Subject: Re: Dealing with session expired References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Ephemerals and watches are maintained across disconnect/reconnect btw the client and server however session expiration (or closing the session explicitly) will trigger deletion of ephemeral nodes associated with the session. Right - once the session is expired the id is invalid. You need to create a new session (new id). Btw, the "timeout" value you provide to when constructing the zookeeper client session directly effects the session expiration - the server uses this timeout as the session expiration time. Patrick Tom Nichols wrote: > So if a session expires, my ephemeral nodes and watches have already > disappeared? I suppose creating a new ZK instance with the old > session ID would not do me any good in that case. Correct? > > Thanks. > -Tom > > > > On Thu, Feb 12, 2009 at 2:12 PM, Mahadev Konar wrote: >> Hi Tom, >> We prefer to discard the zookeeper instance if a session expires. >> Maintaining a one to one relationship between a client handle and a session >> makes it much simpler for users to understand the existence and >> disappearance of ephemeral nodes and watches created by a zookeeper client. >> >> thanks >> mahadev >> >> >> On 2/12/09 10:58 AM, "Tom Nichols" wrote: >> >>> I've come across the situation where a ZK instance will have an >>> expired connection and therefore all operations fail. Now AFAIK the >>> only way to recover is to create a new ZK instance with the old >>> session ID, correct? >>> >>> Now, my problem is, the ZK instance may be shared -- not between >>> threads -- but maybe two classes in the same thread synchronize on >>> different nodes by using different watchers. So it makes sense that >>> one ZK client instance can handle this. Except that even if I detect >>> the session expiration by catching the KeeperException, if I want to >>> "resume" the session, I have to create a new ZK instance and pass it >>> to any classes who were previously sharing the same instance. Does >>> this make sense so far? >>> >>> Anyway, bottom line is, it would be nice if a ZK instance could itself >>> recover a session rather than discarding that instance and creating a >>> new one. >>> >>> Thoughts? >>> >>> Thanks in advance, >>> >>> -Tom >>