RE: Semantics of ConnectionLoss exception

2009-03-26 Thread Benjamin Reed
it is possible for the time to pass without the session expiring. Imagine a 
session timeout of 15 seconds. there is correlated power outage affecting the 
zookeeper servers. lets say it takes 5 minutes to recover power and reboot. 
when the service recovers, it resets expiration times, so when the servers 
start back up and the client reconnects (assuming it is retrying every few 
seconds), the session will be recovered and everything will proceed as normal. 
if the client library generates a session expired, the client could connect 
with a new session after the service recovers and see its own ephemeral nodes 
for 15 seconds.

ben

From: Nitay [nit...@gmail.com]
Sent: Thursday, March 26, 2009 12:09 PM
To: zookeeper-user@hadoop.apache.org
Subject: Re: Semantics of ConnectionLoss exception

Why is it done that way? How am I supposed to reliably detect that my
ephemeral nodes are gone? Why not deliver the Session Expired event on the
client side after the right time has passed without communication to any
server?

On Thu, Mar 26, 2009 at 10:58 AM, Mahadev Konar wrote:

> >
> > Isn't it the case that the client won't get session expired until it's
> > able to connect to a server, right? So what might happen is that the
> > client loses connection to the server, the server eventually expires the
> > client and deletes ephemerals (notifying all watchers) but the client
> > won't see the "session expiration" until it is able to reconnect to one
> > of the servers. ie the client doesn't know it's been expired until it's
> > able to reconnect to the cluster, at which point it's notified that it's
> > been expired.
> You are right pat!
>
> mahadev
>
> >
> >>
> http://hadoop.apache.org/zookeeper/docs/r3.0.1/zookeeperProgrammers.html
> >> Has this information scattered around, but we should put it in the FAQ
> >> specifically.
> >
> > 3.0.1 is a bit old, try this for the latest docs:
> >
> http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html
> >
> >> - Is the ZooKeeper handle I'm using dead after this event?
> >> Again no. your handle is valid until you get an session expiry event or
> you
> >> do a zoo_close on your handle.
> >>
> >>
> >> Thanks
> >> mahadev
> >>
> >>
> >>
> >>
> >> On 3/25/09 5:42 PM, "Nitay"  wrote:
> >>
> >>> I'm a little unclear about the ConnectionLoss exception as it's
> described in
> >>> the FAQ and would like some clarification.
> >>>
> >>> From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1,
> there
> >>> are three events that cause a ConnectionLoss:
> >>>
> >>> 1) In Connecting state, call close().
> >>> 2) In Connected state, call close().
> >>> 3) In Connected state, get disconnected.
> >>>
> >>> It's the third one I'm unclear about.
> >>>
> >>> - Does this event happening mean my ephemeral nodes will go away?
> >>> - Is the ZooKeeper handle I'm using dead after this event? Meaning
> that,
> >>> similar to the SessionExpired case, I need to construct a new
> connection
> >>> handle to ZooKeeper and take care of the restarting myself. It seems
> from
> >>> the diagram that this should not be the case. Rather, seeing as the
> >>> disconnected event sends the user back to the Connecting state, my
> handle
> >>> should be fine and the library will keep trying to reconnect to
> ZooKeeper
> >>> internally? I understand my current operation may have failed, what I'm
> >>> asking about is future operations.
> >>>
> >>> Thanks,
> >>> -n
> >>
>
>


Re: Semantics of ConnectionLoss exception

2009-03-26 Thread Mahadev Konar
The problem is that we cannot differentiate between the servers being down
and a network problem from the client to servers.

If the servers are down and we expire the session for a client on the client
side -- the servers would come up and would still have the session as valid
(though it will be expired in a few session timeout seconds) but we pre
maturely would have expired the session at the client.

You can look at it this way -- the client does not know whats going on with
the zookeeper service, so instead of giving back a false answer to the
application it waits for a true answer from the servers. Also, we are
assuming that the client would not be able to proceed further neway if it
cannot contact the servers.


Hope this answers your question.

mahadev

On 3/26/09 12:09 PM, "Nitay"  wrote:

> Why is it done that way? How am I supposed to reliably detect that my
> ephemeral nodes are gone? Why not deliver the Session Expired event on the
> client side after the right time has passed without communication to any
> server?
> 
> On Thu, Mar 26, 2009 at 10:58 AM, Mahadev Konar wrote:
> 
>>> 
>>> Isn't it the case that the client won't get session expired until it's
>>> able to connect to a server, right? So what might happen is that the
>>> client loses connection to the server, the server eventually expires the
>>> client and deletes ephemerals (notifying all watchers) but the client
>>> won't see the "session expiration" until it is able to reconnect to one
>>> of the servers. ie the client doesn't know it's been expired until it's
>>> able to reconnect to the cluster, at which point it's notified that it's
>>> been expired.
>> You are right pat!
>> 
>> mahadev
>> 
>>> 
 
>> http://hadoop.apache.org/zookeeper/docs/r3.0.1/zookeeperProgrammers.html
 Has this information scattered around, but we should put it in the FAQ
 specifically.
>>> 
>>> 3.0.1 is a bit old, try this for the latest docs:
>>> 
>> http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html
>>> 
 - Is the ZooKeeper handle I'm using dead after this event?
 Again no. your handle is valid until you get an session expiry event or
>> you
 do a zoo_close on your handle.
 
 
 Thanks
 mahadev
 
 
 
 
 On 3/25/09 5:42 PM, "Nitay"  wrote:
 
> I'm a little unclear about the ConnectionLoss exception as it's
>> described in
> the FAQ and would like some clarification.
> 
> From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1,
>> there
> are three events that cause a ConnectionLoss:
> 
> 1) In Connecting state, call close().
> 2) In Connected state, call close().
> 3) In Connected state, get disconnected.
> 
> It's the third one I'm unclear about.
> 
> - Does this event happening mean my ephemeral nodes will go away?
> - Is the ZooKeeper handle I'm using dead after this event? Meaning
>> that,
> similar to the SessionExpired case, I need to construct a new
>> connection
> handle to ZooKeeper and take care of the restarting myself. It seems
>> from
> the diagram that this should not be the case. Rather, seeing as the
> disconnected event sends the user back to the Connecting state, my
>> handle
> should be fine and the library will keep trying to reconnect to
>> ZooKeeper
> internally? I understand my current operation may have failed, what I'm
> asking about is future operations.
> 
> Thanks,
> -n
 
>> 
>> 



Re: Semantics of ConnectionLoss exception

2009-03-26 Thread Nitay
Why is it done that way? How am I supposed to reliably detect that my
ephemeral nodes are gone? Why not deliver the Session Expired event on the
client side after the right time has passed without communication to any
server?

On Thu, Mar 26, 2009 at 10:58 AM, Mahadev Konar wrote:

> >
> > Isn't it the case that the client won't get session expired until it's
> > able to connect to a server, right? So what might happen is that the
> > client loses connection to the server, the server eventually expires the
> > client and deletes ephemerals (notifying all watchers) but the client
> > won't see the "session expiration" until it is able to reconnect to one
> > of the servers. ie the client doesn't know it's been expired until it's
> > able to reconnect to the cluster, at which point it's notified that it's
> > been expired.
> You are right pat!
>
> mahadev
>
> >
> >>
> http://hadoop.apache.org/zookeeper/docs/r3.0.1/zookeeperProgrammers.html
> >> Has this information scattered around, but we should put it in the FAQ
> >> specifically.
> >
> > 3.0.1 is a bit old, try this for the latest docs:
> >
> http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html
> >
> >> - Is the ZooKeeper handle I'm using dead after this event?
> >> Again no. your handle is valid until you get an session expiry event or
> you
> >> do a zoo_close on your handle.
> >>
> >>
> >> Thanks
> >> mahadev
> >>
> >>
> >>
> >>
> >> On 3/25/09 5:42 PM, "Nitay"  wrote:
> >>
> >>> I'm a little unclear about the ConnectionLoss exception as it's
> described in
> >>> the FAQ and would like some clarification.
> >>>
> >>> From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1,
> there
> >>> are three events that cause a ConnectionLoss:
> >>>
> >>> 1) In Connecting state, call close().
> >>> 2) In Connected state, call close().
> >>> 3) In Connected state, get disconnected.
> >>>
> >>> It's the third one I'm unclear about.
> >>>
> >>> - Does this event happening mean my ephemeral nodes will go away?
> >>> - Is the ZooKeeper handle I'm using dead after this event? Meaning
> that,
> >>> similar to the SessionExpired case, I need to construct a new
> connection
> >>> handle to ZooKeeper and take care of the restarting myself. It seems
> from
> >>> the diagram that this should not be the case. Rather, seeing as the
> >>> disconnected event sends the user back to the Connecting state, my
> handle
> >>> should be fine and the library will keep trying to reconnect to
> ZooKeeper
> >>> internally? I understand my current operation may have failed, what I'm
> >>> asking about is future operations.
> >>>
> >>> Thanks,
> >>> -n
> >>
>
>


Re: Semantics of ConnectionLoss exception

2009-03-26 Thread Mahadev Konar
> 
> Isn't it the case that the client won't get session expired until it's
> able to connect to a server, right? So what might happen is that the
> client loses connection to the server, the server eventually expires the
> client and deletes ephemerals (notifying all watchers) but the client
> won't see the "session expiration" until it is able to reconnect to one
> of the servers. ie the client doesn't know it's been expired until it's
> able to reconnect to the cluster, at which point it's notified that it's
> been expired.
You are right pat!

mahadev

> 
>> http://hadoop.apache.org/zookeeper/docs/r3.0.1/zookeeperProgrammers.html
>> Has this information scattered around, but we should put it in the FAQ
>> specifically. 
> 
> 3.0.1 is a bit old, try this for the latest docs:
> http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html
> 
>> - Is the ZooKeeper handle I'm using dead after this event?
>> Again no. your handle is valid until you get an session expiry event or you
>> do a zoo_close on your handle.
>> 
>> 
>> Thanks 
>> mahadev
>> 
>> 
>> 
>> 
>> On 3/25/09 5:42 PM, "Nitay"  wrote:
>> 
>>> I'm a little unclear about the ConnectionLoss exception as it's described in
>>> the FAQ and would like some clarification.
>>> 
>>> From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1, there
>>> are three events that cause a ConnectionLoss:
>>> 
>>> 1) In Connecting state, call close().
>>> 2) In Connected state, call close().
>>> 3) In Connected state, get disconnected.
>>> 
>>> It's the third one I'm unclear about.
>>> 
>>> - Does this event happening mean my ephemeral nodes will go away?
>>> - Is the ZooKeeper handle I'm using dead after this event? Meaning that,
>>> similar to the SessionExpired case, I need to construct a new connection
>>> handle to ZooKeeper and take care of the restarting myself. It seems from
>>> the diagram that this should not be the case. Rather, seeing as the
>>> disconnected event sends the user back to the Connecting state, my handle
>>> should be fine and the library will keep trying to reconnect to ZooKeeper
>>> internally? I understand my current operation may have failed, what I'm
>>> asking about is future operations.
>>> 
>>> Thanks,
>>> -n
>> 



Re: Semantics of ConnectionLoss exception

2009-03-25 Thread Patrick Hunt

Mahadev Konar wrote:

Hi Nitay,
 > 

- Does this event happening mean my ephemeral nodes will go away?

No. the client will try connecting to other servers and if its not able to
reconnect to the servers within the remaining session timeout.

If the client is not able to connect within the remaining session timeout,
the session will expire and you will get a session expired event.


Isn't it the case that the client won't get session expired until it's 
able to connect to a server, right? So what might happen is that the 
client loses connection to the server, the server eventually expires the 
client and deletes ephemerals (notifying all watchers) but the client 
won't see the "session expiration" until it is able to reconnect to one 
of the servers. ie the client doesn't know it's been expired until it's 
able to reconnect to the cluster, at which point it's notified that it's 
been expired.



http://hadoop.apache.org/zookeeper/docs/r3.0.1/zookeeperProgrammers.html
Has this information scattered around, but we should put it in the FAQ
specifically. 


3.0.1 is a bit old, try this for the latest docs:
http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html


- Is the ZooKeeper handle I'm using dead after this event?
Again no. your handle is valid until you get an session expiry event or you
do a zoo_close on your handle.


Thanks 
mahadev





On 3/25/09 5:42 PM, "Nitay"  wrote:


I'm a little unclear about the ConnectionLoss exception as it's described in
the FAQ and would like some clarification.

From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1, there
are three events that cause a ConnectionLoss:

1) In Connecting state, call close().
2) In Connected state, call close().
3) In Connected state, get disconnected.

It's the third one I'm unclear about.

- Does this event happening mean my ephemeral nodes will go away?
- Is the ZooKeeper handle I'm using dead after this event? Meaning that,
similar to the SessionExpired case, I need to construct a new connection
handle to ZooKeeper and take care of the restarting myself. It seems from
the diagram that this should not be the case. Rather, seeing as the
disconnected event sends the user back to the Connecting state, my handle
should be fine and the library will keep trying to reconnect to ZooKeeper
internally? I understand my current operation may have failed, what I'm
asking about is future operations.

Thanks,
-n




Re: Semantics of ConnectionLoss exception

2009-03-25 Thread Mahadev Konar
Hi Nitay,
 > 
> - Does this event happening mean my ephemeral nodes will go away?
No. the client will try connecting to other servers and if its not able to
reconnect to the servers within the remaining session timeout.

If the client is not able to connect within the remaining session timeout,
the session will expire and you will get a session expired event.

http://hadoop.apache.org/zookeeper/docs/r3.0.1/zookeeperProgrammers.html
Has this information scattered around, but we should put it in the FAQ
specifically. 

- Is the ZooKeeper handle I'm using dead after this event?
Again no. your handle is valid until you get an session expiry event or you
do a zoo_close on your handle.


Thanks 
mahadev




On 3/25/09 5:42 PM, "Nitay"  wrote:

> I'm a little unclear about the ConnectionLoss exception as it's described in
> the FAQ and would like some clarification.
> 
> From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1, there
> are three events that cause a ConnectionLoss:
> 
> 1) In Connecting state, call close().
> 2) In Connected state, call close().
> 3) In Connected state, get disconnected.
> 
> It's the third one I'm unclear about.
> 
> - Does this event happening mean my ephemeral nodes will go away?
> - Is the ZooKeeper handle I'm using dead after this event? Meaning that,
> similar to the SessionExpired case, I need to construct a new connection
> handle to ZooKeeper and take care of the restarting myself. It seems from
> the diagram that this should not be the case. Rather, seeing as the
> disconnected event sends the user back to the Connecting state, my handle
> should be fine and the library will keep trying to reconnect to ZooKeeper
> internally? I understand my current operation may have failed, what I'm
> asking about is future operations.
> 
> Thanks,
> -n



Semantics of ConnectionLoss exception

2009-03-25 Thread Nitay
I'm a little unclear about the ConnectionLoss exception as it's described in
the FAQ and would like some clarification.

>From the state diagram, http://wiki.apache.org/hadoop/ZooKeeper/FAQ#1, there
are three events that cause a ConnectionLoss:

1) In Connecting state, call close().
2) In Connected state, call close().
3) In Connected state, get disconnected.

It's the third one I'm unclear about.

- Does this event happening mean my ephemeral nodes will go away?
- Is the ZooKeeper handle I'm using dead after this event? Meaning that,
similar to the SessionExpired case, I need to construct a new connection
handle to ZooKeeper and take care of the restarting myself. It seems from
the diagram that this should not be the case. Rather, seeing as the
disconnected event sends the user back to the Connecting state, my handle
should be fine and the library will keep trying to reconnect to ZooKeeper
internally? I understand my current operation may have failed, what I'm
asking about is future operations.

Thanks,
-n