dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

Dubbo 2.7.7 connect to zk time too long

Open tkec opened this issue 6 years ago • 3 comments

Dubbo with SpringBoot registry to zk, get zookeeper not connected error, set registry timeout to 60000 and then connect to zk success, the real connect time is about 30s, is the connect time normal in local? is the connect time normal if in production environment? How to reduce the time?

Environment

  • Dubbo version: 2.7.7
  • Dubbo Spring Boot Starter Version: 2.7.7
  • Spring Boot Version: 2.2.5
  • Java version: OpenJDK 11.0.3

Steps to reproduce this issue

  1. pom
<dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo</artifactId>
            <version>${dubbo.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>${dubbo.version}</version>
        </dependency>
       <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-dependencies-zookeeper</artifactId>
            <version>${dubbo.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
  1. springboot yml file:
dubbo:
  registry:
    address: zookeeper://ip:2181
    timeout: 60000
  1. logs, program stop at o.a.c.f.imps.CuratorFrameworkImpl : Default schema for about 30s.
2020-06-10 18:28:39.383  INFO 83395 --- [           main] org.apache.zookeeper.ZooKeeper           : Initiating client connection, connectString=ip:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@1b7cae6f
2020-06-10 **18:28:39.401**  INFO 83395 --- [           main] o.a.c.f.imps.CuratorFrameworkImpl        : Default schema
2020-06-10 **18:29:09.399**  INFO 83395 --- [ip:2181)] org.apache.zookeeper.ClientCnxn          : Opening socket connection to server ip/ip:2181. Will not attempt to authenticate using SASL (unknown error)
2020-06-10 18:29:09.412  INFO 83395 --- [ip:2181)] org.apache.zookeeper.ClientCnxn          : Socket connection established to 1ip/ip:2181, initiating session
2020-06-10 18:29:09.423  INFO 83395 --- [ip:2181)] org.apache.zookeeper.ClientCnxn          : Session establishment complete on server ip/ip:2181, sessionid = 0x1006b212bfb0010, negotiated timeout = 40000
2020-06-10 18:29:09.429  INFO 83395 --- [ain-EventThread] o.a.c.f.state.ConnectionStateManager     : State change: CONNECTED

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

Expected Result

connect success quickly

Actual Result

What actually happens?

connected success cost 30s+

tkec avatar Jun 10 '20 10:06 tkec

与问题 https://github.com/apache/dubbo/issues/5474 类似 我也出现了,发现可能是 org.apache.zookeeper.zookeeper 版本导致的,将 zookeeper 版本修改成 3.4.10 后正常 centos 服务器部署的 zookeeper 尝试过 3.4.6 和 3.4.9 至于 zk 为什么会出现这个问题还没深究

dengyanghui avatar Jun 30 '20 04:06 dengyanghui

这和zkserver和你的curator版本有关系,确定来说,使用curator更容易遭受这个问题。zkclient安全性更高,可惜已经被dubbo移除了

CodeIngL avatar Jul 08 '20 11:07 CodeIngL

Try it with the latest version, if you still have problems, you can reopen the issue

CrazyHZM avatar Oct 23 '21 14:10 CrazyHZM