[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17707298#comment-17707298 ] Zili Chen commented on CURATOR-665: --- Thanks for your reproduce [~Ryan0751]! I located the root cause and provided a fix. You can try it out in your environment and help in reviewing https://github.com/apache/curator/pull/453. > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Assignee: Zili Chen >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17707255#comment-17707255 ] Ryan Ruel commented on CURATOR-665: --- Below is a test case which you can drop into TestModeledFramework which reproduces the issue. The issue seems to be related to ACLs and the creation of sub-paths: {code:java} @Test public void testExceptionHandling() throws Exception { final List writeAcl = Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, new Id("digest", DigestAuthenticationProvider.generateDigest("test:test"; // An ACLProvider is used to get the write ACL (for the test user) for any path "/test/**". final ACLProvider aclProvider = new ACLProvider() { @Override public List getDefaultAcl() { return ZooDefs.Ids.READ_ACL_UNSAFE; } @Override public List getAclForPath(String path) { // Any sub-path "/test/**" should only be writeable by the test user. return path.startsWith("/test") ? writeAcl : getDefaultAcl(); } }; try (CuratorFramework authorizedFramework = CuratorFrameworkFactory.builder() .connectString(server.getConnectString()) .retryPolicy(new RetryOneTime(1)) .aclProvider(aclProvider) .authorization("digest", "test:test".getBytes()) .build()) { authorizedFramework.start(); // Create the parent path using the authorized framework, which will initially set the ACL accordingly. authorizedFramework.create().withMode(CreateMode.PERSISTENT).forPath("/test"); } // Now attempt to set the sub-node using an unauthorized client. try (CuratorFramework unauthorizedFramework = CuratorFrameworkFactory.builder() .connectString(server.getConnectString()) .retryPolicy(new RetryOneTime(1)) .aclProvider(aclProvider) .build()) { unauthorizedFramework.start(); // I overrode the TestModel provided path with a multi-component path under the "/test" parent path // (which was previously created with ACL protection). ModelSpec aclModelSpec = ModelSpec.builder(ZPath.parse("/test/foo/bar"), modelSpec.serializer()) .withCreateOptions(EnumSet.of(CreateOption.createParentsIfNeeded, CreateOption.createParentsAsContainers)) .build(); ModeledFramework noAuthClient = ModeledFramework.wrap(AsyncCuratorFramework.wrap(unauthorizedFramework), aclModelSpec); // We would expect this to throw a NoAuth KeeperException, but it instead hangs. noAuthClient.set(new TestModel("John", "Galt", "Galt's Gulch", 42, BigInteger.valueOf(66))).toCompletableFuture().get(); } } {code} > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17707120#comment-17707120 ] Zili Chen commented on CURATOR-665: --- Can you share a minimal reproduce here ((runnable) code snippet)? I change "update" to "set" but still the exception thrown immediately. > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706912#comment-17706912 ] Ryan Ruel commented on CURATOR-665: --- Interestingly, this only seems to happen for NoAuth. If the node doesn't exist and my client (which doesn't have permission) tries to call "update", I DO get a NoNode exception. > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706910#comment-17706910 ] Ryan Ruel commented on CURATOR-665: --- Thanks [~tison]. To confirm, yes I am using 5.4.0. I was able to get the NoAuth exception back using your example test above. In my case, I am using the "set" method with the CreateOption of "createParentsIfNeeded" (instead of update). After some further experimentation, I found that if the node already exists and my client (which doesn't have permission) tries to set or update it, I get the exception back just fine! However, if the node does NOT already exists and my client (again, which doesn't have permission) attempts to set the value, than I see client hang (and the exception is shown in the Curator logs but is swallowed). > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706905#comment-17706905 ] Ryan Ruel commented on CURATOR-665: --- Thanks [~tison] . To confirm, yes I am using 5.4.0. I reproduced your test above, and YES I did get the exception. However, if I change the "update" operation to a "set" (which is what I am using in my test), then I see the hang again. Can you try that in your test? > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CURATOR-665) ModeledFramework does not throw expected exception and instead hangs
[ https://issues.apache.org/jira/browse/CURATOR-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706723#comment-17706723 ] Zili Chen commented on CURATOR-665: --- Hi [~Ryan0751]! Can you provide a reproduce sample and ensure that you're using 5.4.0? I write a test case on master {{org.apache.curator.x.async.modeled.TestModeledFramework#testAcl}} and it throws exception as expected: {code:java} try (CuratorFramework noAuthCurator = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).build()) { noAuthCurator.start(); ModeledFramework authClient = ModeledFramework.wrap(AsyncCuratorFramework.wrap(noAuthCurator), aclModelSpec); authClient.update(new TestModel("John", "Galt", "Galt's Gulch", 42, BigInteger.valueOf(66))).toCompletableFuture().get(); } {code} > ModeledFramework does not throw expected exception and instead hangs > > > Key: CURATOR-665 > URL: https://issues.apache.org/jira/browse/CURATOR-665 > Project: Apache Curator > Issue Type: Bug > Components: Framework >Affects Versions: 5.4.0 >Reporter: Ryan Ruel >Priority: Major > > When writing data to ZooKeeper via Curator, I found that when I was receiving > a KeeperException NoAuth back from ZooKeeper, my call would hang indefinitely. > The NoAuth was expected as I was testing writing to a path where the ACL was > set to prevent my client from writing (X509 authentication scheme). > The call which hangs: > {code:java} > myFramework.set(myModel).toCompletableFuture().get();{code} > The logs from the call: > {code:java} > 2023-03-29 14:20:29,511 [Curator-Framework-0] ERROR imps.CuratorFrameworkImpl > - Background exception was not retry-able or retry gave up > org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = > NoAuth for /test/foo {code} > I'd expect this exception to bubble up wrapped in a CompletionException. > Instead, CuratorFrameworkImpl just logs the exception and then the call to > get() hangs indefinitely. -- This message was sent by Atlassian Jira (v8.20.10#820010)