ConnectonState keep throw out ConnectionLossException per (connectionTimeout+1) seconds problem

72 views
Skip to first unread message

George Cao

unread,
Apr 17, 2013, 5:38:45 AM4/17/13
to curato...@googlegroups.com
Hi all,
  
I am use curator 1.2.4 and I keep getting ConnectionLossException when I want to monitor one znode for it's children changes.

So I implemented a watcher like this
   public class CuratorChildWatcherImpl implements CuratorWatcher {

        private CuratorFramework client;

        public CuratorChildWatcherImpl(CuratorFramework client) {
            this.client = client;
        }

        @Override
        public void process(WatchedEvent event) throws Exception {
           List<String> children=client.getChildren().usingWatcher(this).forPath(event.getPath());
           // Do other stuff with the children znode.
        }
    }

Strange things happened, every 11 seconds I gets a ConnectionLossException if i set the connectionTimeout to 10 seconds. It happened to be connectionTimeout in seconds plus 1. Why?

I checked the source code found that GetChildrenBuilderImpl will call the CuratorZookeeperClient's blockUntilConnectedOrTimeout method which will check the connection state every 1 second.

2013-04-17 17:22:08 [ERROR]-[com.netflix.curator.ConnectionState.getZooKeeper(ConnectionState.java:97)] Connection timed out for connection string (...) and timeout (10000) / elapsed (10317913)
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
    at com.netflix.curator.ConnectionState.getZooKeeper(ConnectionState.java:94)
    at com.netflix.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:107)
    at com.netflix.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:413)
    at com.netflix.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:213)
    at com.netflix.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:202)
    at com.netflix.curator.RetryLoop.callWithRetry(RetryLoop.java:106)
    at com.netflix.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:198)
    at com.netflix.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:190)
    at com.netflix.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:37)
    at com.netflix.curator.framework.imps.NamespaceWatcher.process(NamespaceWatcher.java:56)
    at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:521)

Jordan Zimmerman

unread,
Apr 29, 2013, 11:28:26 AM4/29/13
to curato...@googlegroups.com
I apologize for not replying sooner…

Why are you using such an old version of Curator. Please try with 1.3.3.

-JZ

--
You received this message because you are subscribed to the Google Groups "curator-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to curator-user...@googlegroups.com.
To post to this group, send email to curato...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/curator-users/-/Jzu_TQnU_08J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages