Michi -- 

On Nov 5, 2012, at 11:24 PM, Michi Mutsuzaki <mi...@cs.stanford.edu> wrote:

> On Mon, Nov 5, 2012 at 2:16 PM, Yunong Xiao <yjx...@gmail.com> wrote:
>> What happens if the server is offline? In the scenario you described, 
>> select()
>> will never succeed, and zookeeper_interest() will never inform the upstream
>> consumer that the server is down. That's the crux of the problem here, when 
>> the
>> server is unavailable, the client needs to know after some amount of time 
>> that
>> the connection has failed. Otherwise the upstream consumer has no idea the
>> connection to zookeeper has been severed and will hang indefinitely.
> 
> If the server is offline, zookeeper client keeps trying to connect to
> the server indefinitely. It's up to the caller to decide when to give
> up. One possibility is to poll the connection state using zoo_state()
> and give up on the handle if it doesn't become connected after certain
> time.

I certainly don't disagree here. What you're suggesting makes sense here -- 
indeed my patch does a variation of this -- however, it relies on the consuming 
client to keep track of the time since the client was last connected to the 
server. I dare say it'd be more preferable for zookeeper.c to keep track of 
this time internally, and inform the consuming client when this time has 
exceeded a certain threshold, such as session_timeout. The consuming client can 
then decide to give up. It seems like common functionality that all consumers 
would like to have as part of using the C client. 

Reply via email to