zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matteo Casadei - Diennea <matteo.casa...@diennea.com>
Subject R: Code to Simulate ZooKeeper Session Expiration does not Work
Date Wed, 13 Apr 2016 09:08:32 GMT
Hi Flavio,

thanks for replying.

Yes, pretty much sure serviceZKSessionId value corresponds to a valid ZooKeeper session: on
the target ZooKeeper handle side I can see a few log lines upon running the previous code:

16-04-13-09-15-52  ZK event: WatchedEvent state:Disconnected type:None path:null.
16-04-13-09-15-58  ZK event: WatchedEvent state:SyncConnected type:None path:null.
16-04-13-09-15-58  ZK Session connected. State:CONNECTED Timeout:40000 sessionid:0x15408ce9fb6c36b
..... queuedevents:0; session id: xxxxxxxxxxxxxx; session password: xxxxxxxxx

These are lines present for debug purpose on the Watcher set on the target ZooKeeper handle;
current sessionID and password are also printed: these are the same value exploited on the
code to trigger session expiration.

>From the above log lines, looks like target handle disconnects upon init of the "expiration"
handle and then immediately reconnects (instead of expiring as we should expect) leading at
the same time to session expiration on the same "expiration" handle.

This seems strange given that we adopted the very same code on several unit tests and we got
no issue of any sort.

Any help is going to be appreciated.

Thanks again,

-----Messaggio originale-----
Da: Flavio Junqueira [mailto:fpj@apache.org]
Inviato: mercoledì 13 aprile 2016 10:20
A: user@zookeeper.apache.org
Oggetto: Re: Code to Simulate ZooKeeper Session Expiration does not Work

Are you sure serviceZKSessionId is valid?


> On 13 Apr 2016, at 08:39, Matteo Casadei - Diennea <matteo.casadei@diennea.com>
> Hi everybody,
> I have an issue on testing ZooKeeper's session expiration.
> Basically, I am using the chunk of code below to make a "target"
> ZooKeeper handle expire:
> ...
> final ZooKeeper zk = new ZooKeeper(zkAddress , zkTimeout, new Watcher() {
>                    @Override
>                    public void process(WatchedEvent event) {
>                        System.out.println("Received event: " + event);
>                    }
>        }, serviceZKSessionId, serviceZKpasswd);
>        while (zk.getState() != States.CONNECTED) {
>            Thread.sleep(100);
>          }
>        zk.close();
> ...
> however when running the code above, the only event a receive is an expired event while
the target ZooKeeper handle (the one I want to actually expire) simply gets disconnected and
immediately reconnected afterwards.
> Can anybody give me a clue on what is actually wrong with this code?
> Thanks in advance,
> Matteo
> --
> Matteo Casadei
> ________________________________


Iscriviti alla nostra newsletter per rimanere aggiornato su digital ed email marketing! http://www.magnews.it/newsletter/

The information in this email is confidential and may be legally privileged. If you are not
the intended recipient please notify the sender immediately and destroy this email. Any unauthorized,
direct or indirect, disclosure, copying, storage, distribution or other use is strictly forbidden.

View raw message