You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jordan Zimmerman (JIRA)" <ji...@apache.org> on 2016/12/19 15:37:59 UTC
[jira] [Comment Edited] (CURATOR-365)
backgroundCreateParentsThenNode() ignores exceptions too crudely
[ https://issues.apache.org/jira/browse/CURATOR-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15761477#comment-15761477 ]
Jordan Zimmerman edited comment on CURATOR-365 at 12/19/16 3:37 PM:
--------------------------------------------------------------------
The issue would only occur if an async create() with creatingParentContainersIfNeeded() was called with a connection that wasn't properly authorized to create the parent nodes. {{backgroundCreateParentsThenNode()}} was treating all KeeperExceptions as ignorable (i.e. retry-able) which would cause an infinite loop.
was (Author: randgalt):
The issue would only occur if an async create() with creatingParentContainersIfNeeded() was called with a connection that wasn't properly authorized to create the parent nodes. {code}backgroundCreateParentsThenNode(){code} was treating all KeeperExceptions as ignorable (i.e. retry-able) which would cause an infinite loop.
> backgroundCreateParentsThenNode() ignores 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: 3.2.0, 2.11.1
> 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:
> {code}
> @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;
> }
> {code}
> 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)