curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-365) backgroundCreateParentsThenNode() ignores exceptions too crudely
Date Mon, 19 Dec 2016 19:45:58 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15762113#comment-15762113
] 

ASF GitHub Bot commented on CURATOR-365:
----------------------------------------

Github user cammckenzie commented on the issue:

    https://github.com/apache/curator/pull/178
  
    Looks good to me.


> 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)

Mime
View raw message