- [x] I have searched the 
[issues](https://github.com/apache/incubator-dubbo/issues) of this repository 
and believe that this is not a duplicate.
- [x] I have checked the 
[FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md) of this 
repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.6.1

### 原因描述
在 AbstractZookeeperClient 中的 create 方法进行了递归,而子类 CuratorZookeeperClient 的 
checkExists 
方法吃掉了异常,导致应用启动的时候被卡住。该问题还是比较严重的,有个数据中心的注册中心不可以,有可能导致多个注册中心的应用失去重启的能力,以及不变更配置重新部署的能力。
AbstractZookeeperClient:
public void create(String path, boolean ephemeral) {
    if (!ephemeral) {
        //吃掉异常
        if (checkExists(path)) {
            return;
        }
    }
    int i = path.lastIndexOf('/');
    if (i > 0) {
        //递归
        create(path.substring(0, i), false);
    }
    if (ephemeral) {
        createEphemeral(path);
    } else {
        createPersistent(path);
    }
}
CuratorZookeeperClient:
public boolean checkExists(String path) {
    try {
        if (client.checkExists().forPath(path) != null) {
            return true;
        }
    } catch (Exception e) {
    }
    return false;
}



### Expected Result

What do you expected from the above steps?
按照默认的注册中心容错策略,在注册节点时,如果失败会进入定时重试逻辑。程序还会继续往下执行,不会卡住,应用能够成功启动。

### Actual Result

What is actually happen?
在注册节点时失败的异常被吃掉了,然后又递归了之前的逻辑,导致卡住,应用无法启动。

[ Full content available at: 
https://github.com/apache/incubator-dubbo/issues/2342 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to