Skip to content

Zookeeper registry will hang the main thread if it cannot establish to the zookeeper register center #4588

@tswstarplanet

Description

@tswstarplanet
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.4-SNAPSHOT
  • Operating System version: Mac
  • Java version: java11

Steps to reproduce this issue

  1. config in xml like (other config keep the same as the previous version)
<dubbo:registry address="zookeeper://127.0.0.2:2181"/>

<dubbo:config-center address="zookeeper://127.0.0.1:2181"/>
  1. start the provider application

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

The application can log exception and exit

Actual Result

it will hang the main thread in the method of ZookeeperRegistry.java

    @Override
    public void doRegister(URL url) {
        try {
            zkClient.create(toUrlPath(url), url.getParameter(DYNAMIC_KEY, true));
        } catch (Throwable e) {
            throw new RpcException("Failed to register " + url + " to zookeeper " + getUrl() + ", cause: " + e.getMessage(), e);
        }
    }

If there is an exception, please attach the exception trace:

Just put your stack trace here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions