fu-cheng1 opened a new issue, #16186: URL: https://github.com/apache/dubbo/issues/16186
### Pre-check - [x] I am sure that all the content I provide is in English. ### Search before asking - [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues. ### Apache Dubbo Component Java SDK (apache/dubbo) ### Dubbo Version dubbo 3.3 branch. jdk 11 ### Steps to reproduce this issue Configure multiple ZooKeeper registries, with one service not started and configured as check=false ### What you expected to happen There is an issue with this approach. When multiple ZooKeeper registries are configured and one of them has check=false, the logic in org.apache.dubbo.remoting.zookeeper.curator5.Curator5ZookeeperClient#Curator5ZookeeperClient was changed from the original behavior of closing the connection when !connected to closing it only when check && !connected. As a result, the subsequent workflow incorrectly assumes that the connection has been successfully established and continues writing node data to that connection. A typical example is node creation in org.apache.dubbo.remoting.zookeeper.curator5.AbstractZookeeperClient#create. Each recursive attempt to create the node fails, which prolongs the application startup time. Eventually, an exception is thrown in org.apache.dubbo.remoting.zookeeper.curator5.Curator5ZookeeperClient#createPersistent(java.lang.String, boolean), causing the application startup to fail. ### Anything else I want to solve this issue, I'm willing to submit a PR. Could you provide me with some ideas on how to approach this problem? My approach is to add a registry != null check to all methods in org.apache.dubbo.registry.ListenerRegistryWrapper, while also passing in the original URL object. When org.apache.dubbo.registry.ListenerRegistryWrapper#getUrl is invoked, if registry == null, it should return the original URL directly. In this way, when the following code is executed in org.apache.dubbo.registry.integration.RegistryDirectory#subscribe: registry.getUrl() .getParameter( RegistryConstants.REGISTRY_CLUSTER_KEY, registry.getUrl().getParameter(PROTOCOL_KEY)); it will no longer trigger a NullPointerException. ### Do you have a (mini) reproduction demo? - [ ] Yes, I have a minimal reproduction demo to help resolve this issue more effectively! ### Are you willing to submit a pull request to fix on your own? - [x] Yes I am willing to submit a pull request on my own! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
