Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper, mail # user - session expire closes handle?

Copy link to this message
session expire closes handle?
Mark Gius 2012-02-10, 00:04
According to http://wiki.apache.org/hadoop/ZooKeeper/FAQ#A3:

"SESSION_EXPIRED automatically closes the ZooKeeper handle."

What does it mean that the zookeeper handle is closed?  I'm assuming this
refers to the zookeeper handle that is returned by zookeeper.init.  If that
is the case, then I'm not seeing this handle being "closed" and then
cleaned up.  When I perform the following steps:

 - zookeeper.init
   - handle is 0
 - wait for session to connect
 - force a session expiration
 - wait for client to show session expiration

At this point I can clearly see that handle 0 cannot be used for any real
work.  I can use zoo_client_id to get the now expired session id,
zookeeper.is_unrecoverable(0) returns INVALIDSTATE, but if I call
zookeeper.close(0) the call blocks indefinitely.  Calling zookeeper.init to
get a new session gives me handle "1".  Normally after a successful
close(0) the next call to zookeeper.init gives me handle 0 again.

Am I doing something wrong here?  I feel that I shouldn't have lingering
zookeeper handles every time a session expires, but that's seems to be my
only option right now.