Girard-Reydet created CURATOR-180:
-------------------------------------
Summary: Rare occurences of NoNodeException in
InterPRocessSemaphoreMurex.acquire
Key: CURATOR-180
URL: https://issues.apache.org/jira/browse/CURATOR-180
Project: Apache Curator
Issue Type: Bug
Components: Recipes
Affects Versions: 2.4.1
Environment: Curator 3.4.1
ZooKeeper 3.4.6 + patch ZOOKEEPER-922
Sun JDK 1.7.0_51-b13
SunOS 5.10 Generic_147441-01 i86pc i386
Reporter: Girard-Reydet
On some occasions, acquiring a semaphore will raise a NoNode exception (see
stack below). I don't have statistics, but overs 3 weeks with about 20 test
jobs/day, I observed it only twice.
If I refer to the code, the parent nodes (here {{/locks/-licence}}) should be
created if it does not exist:
{code}
private InternalAcquireResult
internalAcquire1Lease(ImmutableList.Builder<Lease> builder, long startMs,
boolean hasWait, long waitMs) throws Exception
{
// ... skipping to the problematic lines
try
{
PathAndBytesable<String> createBuilder =
client.create().creatingParentsIfNeeded().withProtection().withMode(CreateMode.EPHEMERAL_SEQUENTIAL);
String path = (nodeData != null) ?
createBuilder.forPath(ZKPaths.makePath(leasesPath, LEASE_BASE_NAME), nodeData)
: createBuilder.forPath(ZKPaths.makePath(leasesPath, LEASE_BASE_NAME));
{code}
Here is the observed stack:
{code}
org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode
for /locks/-license/leases
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1590)
at
org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:214)
at
org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:203)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107)
at
org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:199)
at
org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:191)
at
org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:38)
at
org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2.internalAcquire1Lease(InterProcessSemaphoreV2.java:358)
at
org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2.acquire(InterProcessSemaphoreV2.java:281)
at
org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2.acquire(InterProcessSemaphoreV2.java:206)
at
org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex.acquire(InterProcessSemaphoreMutex.java:46)
at
registry.backend.zk.ZooKeeperNodesManager$ZooKeeperRegistryLock.acquire(ZooKeeperNodesManager.java:223)
... 11 more
{code}
Note that I can have several processes concurrently trying to grab the lock at
the same time. It is also possible that they concurrently try to grab it while
the parent path does not yet exist.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)