Jordan Zimmerman created CURATOR-365:
----------------------------------------
Summary: backgroundCreateParentsThenNode() is ignore exceptions
too crudely
Key: CURATOR-365
URL: https://issues.apache.org/jira/browse/CURATOR-365
Project: Apache Curator
Issue Type: Bug
Components: Framework
Affects Versions: 2.11.1, 3.2.0
Reporter: Jordan Zimmerman
Assignee: Jordan Zimmerman
Priority: Critical
Fix For: 3.2.2, 2.11.2
backgroundCreateParentsThenNode() in CreateBuilderImpl,java is ignoring all
KeeperExceptions. This can cause an infinite loop if the KeeperException is not
an ignorable one.
Here's a code snippet that shows the problem:
```
@Test
public void testIt() throws Exception
{
ACLProvider provider = new ACLProvider()
{
@Override
public List<ACL> getDefaultAcl()
{
return ZooDefs.Ids.OPEN_ACL_UNSAFE;
}
@Override
public List<ACL> getAclForPath(String path)
{
if ( path.equals("/ns/one") )
{
try
{
return Collections.singletonList(new ACL(ZooDefs.Perms.ALL,
new Id("digest", DigestAuthenticationProvider.generateDigest("test"))));
}
catch ( NoSuchAlgorithmException e )
{
e.printStackTrace();
}
}
return getDefaultAcl();
}
};
try ( CuratorFramework client = createClient(provider, new
AuthInfo("digest",
DigestAuthenticationProvider.generateDigest("test").getBytes())) )
{
LeaderLatch latch = new LeaderLatch(client, "/one/two");
latch.start();
latch.await();
System.err.println("hdeherherhe");
}
}
private CuratorFramework createClient(ACLProvider provider, AuthInfo
authInfo) throws Exception
{
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
CuratorFrameworkFactory.Builder builder =
CuratorFrameworkFactory.builder()
.namespace("ns")
.connectString(server.getConnectString())
.retryPolicy(retryPolicy)
;
if ( provider != null )
{
builder = builder.aclProvider(provider);
}
if ( authInfo != null )
{
builder = builder.authorization(authInfo.getScheme(),
authInfo.getAuth());
}
CuratorFramework client = builder.build();
client.start();
return client;
}
```
While this is running you can put a breakpoint on
CreateBuilderImpl#findProtectedNodeInForeground() and see it get called over
and over.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)