Dealing with session expired

2009-02-12 Thread Tom Nichols
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 --

Re: Dealing with session expired

2009-02-12 Thread Mahadev Konar
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.

Re: Dealing with session expired

2009-02-12 Thread Tom Nichols
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 maha...@yahoo-inc.com wrote: Hi Tom,

Re: Dealing with session expired

2009-02-12 Thread Mahadev Konar
Hi Tom, The session expired event means that the the server expired the client and that means the watches and ephemrals will go away for that node. How are you running your zookeeper quorum? Session expiry event should be really rare event . If you have a quorum of servers it should rarely

Re: Dealing with session expired

2009-02-12 Thread Patrick Hunt
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

Re: Dealing with session expired

2009-02-12 Thread Patrick Hunt
Regardless of frequency Tom's code still has to handle this situation. I would suggest that the two classes Tom is referring to in his mail, the ones that use ZK client object, should either be able to reinitialize with a new zk session, or they themselves should be discarded and new

RE: Dealing with session expired

2009-02-12 Thread Benjamin Reed
with it by starting with a fresh instance if your session expires. ben From: Tom Nichols [tmnich...@gmail.com] Sent: Thursday, February 12, 2009 11:53 AM To: zookeeper-user@hadoop.apache.org Subject: Re: Dealing with session expired I'm using a timeout

Re: Dealing with session expired

2009-02-12 Thread Patrick Hunt
From: Tom Nichols [tmnich...@gmail.com] Sent: Thursday, February 12, 2009 11:53 AM To: zookeeper-user@hadoop.apache.org Subject: Re: Dealing with session expired I'm using a timeout of 5000ms. Now let me ask this: Suppose all of my clients are waiting on some