zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Chitturi <kiran.chitt...@lucidworks.com>
Subject Random connection loss when using command line class
Date Thu, 08 Aug 2013 05:55:18 GMT

I am using zookeeper class and zookeeper command line script (zkCli.sh) to create paths. The
commands look like below.

bin/zkCli.sh -server Testvm1:2181,Testvm2:2181,Testvm3:2181 create /test test

Sometimes, the first request fails and second request succeeds. The failed request throws
the error

Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode
= ConnectionLoss for /test
at org.apache.zookeeper.KeeperException.create(KeeperException.java:90)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:42)
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:643)
at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:678)
at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:581)
at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:342)
at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:270)

Every one request out of 10 commands (approx.) like this fails with the above error. Please
correct me if I am wrong but I have read across the mailing list and documentation that this
happens because the 'create' command is executed before the connection is properly established.

If the command randomly fails, it is hard to rely up on this to create paths. Is there any
parameter or configuration to make sure that the command never fails and 'create' is executed
only after proper connection is established ?

Also, Shouldn't the zookeeperMain wait for 'SyncConnected' and then execute the command ?
Should I switch to writing a java client class to reliably create paths and execute any zookeeper
commands rather than relying on command line client ?

Sorry for the long mail.

Thank you,
Kiran Chitturi

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message