zrlw opened a new issue #8993:
URL: https://github.com/apache/dubbo/issues/8993


   * Dubbo version: 3.0 / master
   搜zookeeper not connected可以搜到很多issue,现在github构建依然有:
   ```
   2021-10-08T07:35:43.7080332Z [ERROR] integrate  Time elapsed: 4.058 s  <<< 
ERROR!
   2021-10-08T07:35:43.7081792Z java.lang.IllegalStateException: 
java.lang.IllegalStateException: zookeeper not connected
   2021-10-08T07:35:43.7087481Z         at 
org.apache.dubbo.integration.single.SingleRegistryCenterDubboProtocolIntegrationTest.integrate(SingleRegistryCenterDubboProtocolIntegrationTest.java:138)
   ```
   问题原因很简单,就是连接zk慢,设置的超时时间短,还没连接上就超时了。
   
AbstractZookeeperClient的DEFAULT_CONNECTION_TIMEOUT_MS是5000ms,实际上这个默认值用不上,url不设置timeout就会被ConfigCenterConfig的checkDefault方法设为3000ms。
   下面是3.0分支debug SingleRegistryCenterDubboProtocolIntegrationTest的调用栈:
   ```
        ConfigCenterConfig.checkDefault() line: 128   <=== timeout为null时设为3000 
        ConfigCenterConfig(AbstractConfig).postProcessRefresh() line: 714       
        ConfigCenterConfig(AbstractConfig).refresh() line: 620  
        DefaultApplicationDeployer.startConfigCenter() line: 253        
        DefaultApplicationDeployer.initialize() line: 195       
        DefaultApplicationDeployer.start() line: 538    
        DubboBootstrap.start(boolean) line: 230 
        DubboBootstrap.start() line: 220
   ```
   checkDefault代码片段:
   ```
       protected void checkDefault() {
           super.checkDefault();
   
           if (namespace == null) {
               namespace = CommonConstants.DUBBO;
           }
           if (group == null) {
               group = CommonConstants.DUBBO;
           }
           if (timeout == null) {
               timeout = 3000L; 
           }
          ...
       }
   ```


-- 
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]

Reply via email to