You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Joe Lin <jo...@peaxy.net> on 2012/10/11 03:14:48 UTC

disconnected from zk server upon client start

Hi,

I'm using the zk Java client to connect to zk server on the localhost. 
The client got disconnected right away after the connection is 
established and the session got expired. What is the reason that the 
server terminates the connection? Is there any flag I should specify 
when creating the client? The client is created with:

             zk = new ZooKeeper("127.0.0.1:2181", 7000, new Watcher() {
                 @Override
                 public void process(WatchedEvent event) {
                     KeeperState ks = event.getState();
                     logger.debug("zk state:" + ks);
                     if ( ks == KeeperState.SyncConnected ) {
                         logger.debug("zk client connected");
                         com.peaxy.event.Event e = new 
com.peaxy.event.Event(EventType.DCS_READY, null);
EventService.getInstance().publish(e);
                     }
                 }
             });

And the following is the server log:

012-10-10 18:01:20,548 [myid:] - INFO 
[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@213] - 
Accepted socket connection from /127.0.0.1:59703
2012-10-10 18:01:20,549 [myid:] - INFO 
[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@831] - Client 
attempting to renew session 0x13a4d47eea50003 at /127.0.0.1:59703
2012-10-10 18:01:20,550 [myid:] - INFO 
[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@597] - 
Invalid session 0x13a4d47eea50003 for client /127.0.0.1:59703, probably 
expired
2012-10-10 18:01:20,551 [myid:] - INFO 
[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1000] - Closed 
socket connection for client /127.0.0.1:59703 which had sessionid 
0x13a4d47eea50003