You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Minh Tran (JIRA)" <ji...@apache.org> on 2016/04/11 01:40:25 UTC

[jira] [Created] (CAMEL-9851) Zookeeper RoutePolicy failing to create znode

Minh Tran created CAMEL-9851:
--------------------------------

             Summary: Zookeeper RoutePolicy failing to create znode
                 Key: CAMEL-9851
                 URL: https://issues.apache.org/jira/browse/CAMEL-9851
             Project: Camel
          Issue Type: Bug
          Components: camel-zookeeper
    Affects Versions: 2.17.0
         Environment: mac
            Reporter: Minh Tran


I am trying to setup a ZooKeeper route policy like this

ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy("zookeeper:localhost/regexTest1?create=true", 1);
from("direct:start").routePolicy(policy).to(“mock:end”);

And when I run my unit test to trigger the route, I get the following exception in my logs

{noformat}
Node '/regexTest1/192.168.202.25-3306c9d2-1354-4dbe-aaff-846eee5bb60d' did not exist, creating it.
Error setting up election node /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:111) ~[zookeeper-3.4.8.jar:3.4.8--1]
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.8.jar:3.4.8--1]
	at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783) ~[zookeeper-3.4.8.jar:3.4.8--1]
	at org.apache.camel.component.zookeeper.operations.CreateOperation.getResult(CreateOperation.java:52) ~[camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.operations.ZooKeeperOperation.get(ZooKeeperOperation.java:70) ~[camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.ZookeeperProducer.createNode(ZookeeperProducer.java:222) ~[camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.ZookeeperProducer.synchronouslySetData(ZookeeperProducer.java:238) ~[camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.ZookeeperProducer.process(ZookeeperProducer.java:88) ~[camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:412) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:380) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:270) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:380) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:205) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:119) [camel-core-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.policy.ZooKeeperElection.createCandidateNode(ZooKeeperElection.java:146) [camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.policy.ZooKeeperElection.testAndCreateCandidateNode(ZooKeeperElection.java:116) [camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.policy.ZooKeeperElection.isMaster(ZooKeeperElection.java:92) [camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.component.zookeeper.policy.ZooKeeperRoutePolicy.onExchangeBegin(ZooKeeperRoutePolicy.java:79) [camel-zookeeper-2.17.0.jar:2.17.0]
	at org.apache.camel.processor.CamelInternalProcessor$RoutePolicyAdvice.before(CamelInternalProcessor.java:483) [camel-core-2.17.0.jar:2.17.0]
{noformat}

It looks like it knows the znode doesn’t exist but seems to be unable to create it? From the zookeeper server side logs, I can see incoming connections and it returning the error that the znode doesn’t exist but doesn’t look like there’s any attempts to create it after that.

I’ve tried using the zookeeper component directly in my route and I am able to create/write/read from a znode fine so it seems like it’s just failing in the route policy for some reason.

I am using Camel 2.17.0 and zookeeper 3.4.8


I’ve investigated this further and the exception is thrown from the ZooKeeper.create method. Camel is actually trying to create a znode with a path /regexTest1/192.168.202.25-25829641-de1f-4389-9bb6-2967ea60de1a without creating the parent node /regexTest1 first. 

According to the Zookeeper.create method documentation 

"If the parent node does not exist in the ZooKeeper, a KeeperException
    * with error code KeeperException.NoNode will be thrown."

And I don’t see anywhere in Camel’s code where it is creating the parent nodes first before attempting to create the final node for master election.

So I removed the path off the uri for the route policy like this

ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy("zookeeper:localhost", 1);

And it has gotten past that error but now has encountered a different error where it has trouble creating a threadpool.

{noformat}
2016-04-08 11:47:15,071 [main] ERROR org.apache.camel.component.zookeeper.policy.ZooKeeperElection - Error configuring ZookeeperElection
java.lang.IllegalArgumentException: id for thread pool org.apache.camel.util.concurrent.RejectableThreadPoolExecutor@1ec912d7[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0][Camel-Zookeeper Ops executor] must be specified and not empty
	at org.apache.camel.util.ObjectHelper.notEmpty(ObjectHelper.java:351) ~[camel-core-2.16.0.jar:2.16.0]
	at org.apache.camel.impl.DefaultExecutorServiceManager.onThreadPoolCreated(DefaultExecutorServiceManager.java:522) ~[camel-core-2.16.0.jar:2.16.0]
	at org.apache.camel.impl.DefaultExecutorServiceManager.newThreadPool(DefaultExecutorServiceManager.java:191) ~[camel-core-2.16.0.jar:2.16.0]
	at org.apache.camel.impl.DefaultExecutorServiceManager.newFixedThreadPool(DefaultExecutorServiceManager.java:230) ~[camel-core-2.16.0.jar:2.16.0]
	at org.apache.camel.component.zookeeper.ZooKeeperConsumer.doStart(ZooKeeperConsumer.java:72) ~[camel-zookeeper-2.16.0.jar:2.16.0]
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.16.0.jar:2.16.0]
	at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3219) ~[camel-core-2.16.0.jar:2.16.0]
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)