curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 阳海涛 <>
Subject i think there maybe has a bug in curator framework all version,contians the lasest version(2.8.0),hope to get your reply
Date Thu, 10 Sep 2015 09:09:57 GMT

  hello,when i use the curatorFramework connnect to zookeeper successed,if the Network instability,it's
occured org.apache.zookeeper.KeeperException$SessionExpiredException:****   error  frequently.and
the worst

case is the curator client could not reconnected the zookeeper server again,unless i restart
my i read the curator source code,i think there has a bug.

curator version:2.8.0

code Class:org.apache.curator.HandleHolder

code method:

 private void internalClose() throws Exception
            ZooKeeper zooKeeper = (helper != null) ? helper.getZooKeeper() : null;
            if ( zooKeeper != null )
                Watcher dummyWatcher = new Watcher()
                    public void process(WatchedEvent event)
                zooKeeper.register(dummyWatcher);   // clear the default watcher so that no
new events get processed by mistake

              //TODO:i think we should set ConnectionState isConnected=false in here by manualHand,in
case of
              //the old zookeeper instance notified a old event in the interval of dummyWatcher
not registed

        catch ( InterruptedException dummy )

hello, everyone,please see the red code,

first,ConnectionState is isConnected=false,when the red color code will excute but not excuted
, the old zookeeper instance connect to zookeeper server successed, so  ConnectionState is
isConnected=true,and then the red code begin excute,but becuase of network not used again,
the new zookeeper instance not success to connect zookeerper server,so i think   ConnectionState
is isConnected=true is a invalid state, and the invalid state will cause curator framework
never connect to zookeeper server.please see the code of down:

code Class:org.apache.curator.ConnectionState

code method:

 ZooKeeper getZooKeeper() throws Exception
        if ( SessionFailRetryLoop.sessionForThreadHasFailed() )
            throw new SessionFailRetryLoop.SessionFailedException();

        Exception exception = backgroundExceptions.poll();
        if ( exception != null )
            tracer.get().addCount("background-exceptions", 1);
            throw exception;

        boolean localIsConnected = isConnected.get();
        if ( !localIsConnected )

        return zooKeeper.getZooKeeper();

   please see the red code, becuase of the isConnected=true(invalid state),so its cause new
reset zookeeper instance again.

  The information contained or attached in this email may be confidential. If you are not
the appointed recipient of this email, please delete and destroy all copies (including all
the attachments) in your possession. And you are hereby notified that any disclosure, duplication
or dissemination of this email, is expressly forbidden.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message