FinalVersion opened a new issue #8845: URL: https://github.com/apache/dubbo/issues/8845
- [*] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate. - [*] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate. ### Environment * Dubbo version: 2.7.10 * Operating System version: CentOS 7 * Java version: 1.8.0 ### Expected Result Consumer using Zookeeper registry can get provider instance list updated whenever a provider instance is registered or deregistered. ### Actual Result Provider instance list is never updated when first call to doSubscribe failed with an exception. thread dump below shows that zookeeper event thread is forever waiting on a `CountDownLatch`. ``` "main-EventThread" #109 daemon prio=5 os_prio=0 tid=0x00007f5d67934800 nid=0x95 waiting on condition [0x00007f5b41c5e000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000005c73a9390> (a java.util.concurrent.CountDownLatch$Sync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304) at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231) at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry$RegistryChildListenerImpl.childChanged(ZookeeperRegistry.java:338) at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient$CuratorWatcherImpl.process(CuratorZookeeperClient.java:294) at org.apache.curator.framework.imps.NamespaceWatcher.process(NamespaceWatcher.java:83) at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:531) at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:506) ``` The CountDownLatch is used in `ZookeeperRegistry#doSubscribe()`, which may not be `countDown` if an exception is thrown, like below ``` ... Caused by: org.apache.dubbo.rpc.RpcException: Failed to subscribe consumer://172.17.0.5/..., cause: null at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:186) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:299) ~[dubbo-2.7.10.jar!/:2.7.10] ... 33 more Caused by: java.lang.IllegalStateException at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.addTargetChildListener(CuratorZookeeperClient.java:215) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.addTargetChildListener(CuratorZookeeperClient.java:53) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.addChildListener(AbstractZookeeperClient.java:112) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:176) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:299) ~[dubbo-2.7.10.jar!/:2.7.10] ... 33 more Caused by: java.lang.InterruptedException at java.lang.Object.wait(Native Method) ~[?:1.8.0_111] at java.lang.Object.wait(Object.java:502) ~[?:1.8.0_111] at org.apache.zookeeper.ClientCnxn.submitRequest(ClientCnxn.java:1409) ~[zookeeper-3.4.11.jar!/:3.4.11-37e277162d567b55a07d1755f0b31c32e93c01a0] at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1651) ~[zookeeper-3.4.11.jar!/:3.4.11-37e277162d567b55a07d1755f0b31c32e93c01a0] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:242) ~[curator-framework-4.0.1.jar!/:4.0.1] at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:231) ~[curator-framework-4.0.1.jar!/:4.0.1] at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:64) ~[curator-client-4.0.1.jar!/:?] at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:100) ~[curator-client-4.0.1.jar!/:?] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228) ~[curator-framework-4.0.1.jar!/:4.0.1] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219) ~[curator-framework-4.0.1.jar!/:4.0.1] at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41) ~[curator-framework-4.0.1.jar!/:4.0.1] at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.addTargetChildListener(CuratorZookeeperClient.java:211) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.addTargetChildListener(CuratorZookeeperClient.java:53) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.addChildListener(AbstractZookeeperClient.java:112) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:176) ~[dubbo-2.7.10.jar!/:2.7.10] at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:299) ~[dubbo-2.7.10.jar!/:2.7.10] ... 33 more ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
