curator
curator copied to clipboard
[CURATOR-381] PersistentNode.start() fails if CuratorFramework unable to connect, when using namespace
Encountered the following exception
2017-01-27 17:41:49.515 ERROR [org.apache.curator.framework.imps.CuratorFrameworkImpl] {main} Ensure path threw exception
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /bids
at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1846)
at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1874)
at org.apache.curator.utils.ZKPaths.mkdirs(ZKPaths.java:274)
at org.apache.curator.framework.imps.NamespaceImpl$1.call(NamespaceImpl.java:90)
at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:100)
at org.apache.curator.framework.imps.NamespaceImpl.fixForNamespace(NamespaceImpl.java:83)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.fixForNamespace(CuratorFrameworkImpl.java:695)
at org.apache.curator.framework.imps.WatcherRemovalFacade.fixForNamespace(WatcherRemovalFacade.java:176)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:488)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:44)
at org.apache.curator.framework.recipes.nodes.PersistentNode.createNode(PersistentNode.java:414)
at org.apache.curator.framework.recipes.nodes.PersistentNode.start(PersistentNode.java:276)
....
For context, the calling code started a CuratorFramework, and then started a PersistentNode. There was no quorum of servers available at that time.
From the PersistentNode code, you would expect start() to operate in the background. However, the step NamespaceImpl.fixForNamespace is in the foreground. In addition to fixing up the path, this method also does an ensure if required, in a retry loop.
The retry loop eventually terminated w/ the above error, apparently because the CuratorFramework decided it wasn't going to be able to connect any time soon. (And until that point the PersistentNode.start() call would not have returned.)
Originally reported by ryarran, imported from: PersistentNode.start() fails if CuratorFramework unable to connect, when using namespace
- status: Open
- priority: Major
- resolution: Unresolved
- imported: 2025-01-21