gavinWithGu commented on issue #8399: URL: https://github.com/apache/dubbo/issues/8399#issuecomment-904433649
@xiaoheng1 Sorry for the late. I have been busy with other affairs for past few days. Today I checked the source code and find out the reason for this problem is as bellows: 1. There is a State-Machines mechanism in zookeeper client connection  2. When call ` client.start() `, ZK client will start a daemon thread and try to start a client connection to zookeeper server. 3. When call `client.blockUntilConnected(timeout, TimeUnit.MILLISECONDS);` the client will check the state of `currentConnectionState`. if false, the thread will wait until max wait time . Once this happened, **Zookeeper is not connected Exception** will be throw. 4. Meanwhile , once connected, the client will change the `currentConnectionState `and notify the wait thread to return In my scenario, it seems the daemon thread have to spend longer time than the deafult timeout configuration to get the zk connection. So I try to increase the timeout paramter and it must to be set in RegistryConfig as bellows: ``` RegistryConfig registryConfig = new RegistryConfig(); ... registryConfig.setTimeout(30000); ... ``` In GenericService call scenario, Yml setting is useless ``` dubbo: metadata-report: timeout: 30000 config-center: timeout: 30000 ``` Mark it for myself ^_^ -- 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]
