You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/10/11 01:56:48 UTC

[GitHub] [dubbo] zrlw opened a new issue #9014: 注册管理getRegistries获取的Registry有重复

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


   ### Environment
   
   * Dubbo version: 3.0 / master
   3.0的RegistryManager以及master的AbstractRegistryFactory的getRegistries获取的Registry有重复,因为registries里面有的key不同但registry相同,比如这样:
   ```
   zookeeper://127.0.0.1:38936/org.apache.dubbo.registry.RegistryService=
   zookeeper://127.0.0.1:38936/org.apache.dubbo.registry.RegistryService?application=provider-app&dubbo=2.0.2&environment=product&file.cache=false&interface=org.apache.dubbo.registry.RegistryService&pid=11272, service-discovery-registry://127.0.0.1:38936/org.apache.dubbo.registry.RegistryService=
   zookeeper://127.0.0.1:38936/org.apache.dubbo.registry.RegistryService?application=provider-app&dubbo=2.0.2&environment=product&file.cache=false&interface=org.apache.dubbo.registry.RegistryService&pid=11272
   ```
   重复的后果就是重复注册、解注册、destroy,然后抛异常,比如这样:
   ```
   [11/10/21 09:42:05:873 CST] main ERROR zookeeper.ZookeeperRegistry:  [DUBBO] Failed to unregister dubbo://192.168.1.23/org.apache.dubbo.config.api.DemoService?application=consumer-app&background=false&category=consumers&check=false&dubbo=2.0.2&environment=product&file.cache=false&injvm=false&interface=org.apache.dubbo.config.api.DemoService&metadata-type=remote&methods=callInnerClass,sayName,getUsers,echo,getBox,throwDemoException&pid=10228&release=&revision=2.0&side=consumer&sticky=false&timestamp=1633916525391&version=2.0, waiting for retry, cause: Failed to unregister dubbo://192.168.1.23/org.apache.dubbo.config.api.DemoService?application=consumer-app&background=false&category=consumers&check=false&dubbo=2.0.2&environment=product&file.cache=false&injvm=false&interface=org.apache.dubbo.config.api.DemoService&metadata-type=remote&methods=callInnerClass,sayName,getUsers,echo,getBox,throwDemoException&pid=10228&release=&revision=2.0&side=consumer&sticky=false&timestamp=16339165253
 91&version=2.0 to zookeeper zookeeper://127.0.0.1:36010/org.apache.dubbo.registry.RegistryService?application=consumer-app&dubbo=2.0.2&environment=product&file.cache=false&interface=org.apache.dubbo.registry.RegistryService&pid=10228, cause: Expected state [STARTED] was [STOPPED], dubbo version: , current host: 192.168.1.23
   org.apache.dubbo.rpc.RpcException: Failed to unregister dubbo://192.168.1.23/org.apache.dubbo.config.api.DemoService?application=consumer-app&background=false&category=consumers&check=false&dubbo=2.0.2&environment=product&file.cache=false&injvm=false&interface=org.apache.dubbo.config.api.DemoService&metadata-type=remote&methods=callInnerClass,sayName,getUsers,echo,getBox,throwDemoException&pid=10228&release=&revision=2.0&side=consumer&sticky=false&timestamp=1633916525391&version=2.0 to zookeeper zookeeper://127.0.0.1:36010/org.apache.dubbo.registry.RegistryService?application=consumer-app&dubbo=2.0.2&environment=product&file.cache=false&interface=org.apache.dubbo.registry.RegistryService&pid=10228, cause: Expected state [STARTED] was [STOPPED]
   	at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doUnregister(ZookeeperRegistry.java:136)
   	at org.apache.dubbo.registry.support.FailbackRegistry.unregister(FailbackRegistry.java:254)
   	at org.apache.dubbo.registry.support.AbstractRegistry.destroy(AbstractRegistry.java:488)
   	at org.apache.dubbo.registry.support.FailbackRegistry.destroy(FailbackRegistry.java:408)
   	at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.destroy(ZookeeperRegistry.java:114)
   	at org.apache.dubbo.registry.support.RegistryManager.destroyAll(RegistryManager.java:105)
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   要支持多实例,zk client就不能在不同的application之间共享了,按application区分一下应该能解决这个问题,见 #9015 


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw closed issue #9014: 注册管理getRegistries获取的Registry没有去重;以及application共享zookeeper client导致destroy抛异常

Posted by GitBox <gi...@apache.org>.
zrlw closed issue #9014:
URL: https://github.com/apache/dubbo/issues/9014


   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   要支持多实例,zk client就不能在不同的application之间共享了,按application区分一下能够解决这个问题,修改内容见 #9015 


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry有重复

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时有重复操作的问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,这种情况除非合并一个RegistryManager,否则搞不定。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   
   我想把所有获取RegistryManager对象的代码改成:ApplicationModel.defaultModel().getBeanFactory().getBean(RegistryManager.class);
   测试了一下这样做能够解决这个二次注销的问题。
   RegistryManager区分applicationModel是为了什么?不区分貌似也不影响多实例吧?


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   如果要多实例,zk client就不能在provider和consumer之间共享了。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   要支持多实例,zk client就不能在不同的application之间共享了,按application区分一下能够解决这个问题。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重;以及application共享zookeeper client导致destroy抛异常

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   需要打个补丁,没application继续使用时才能关闭,试着改了一下,见  #9015 


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   
   我想把所有获取RegistryManager对象的代码改成:ApplicationModel.defaultModel().getBeanFactory().getBean(RegistryManager.class);
   测试了一下,貌似这样就搞定了。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   
   我想把所有获取RegistryManager对象的代码改成:ApplicationModel.defaultModel().getBeanFactory().getBean(RegistryManager.class);
   destroy的时候,destroy一个registry就从集合里删掉,删光了才关闭zk client。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669






-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有需要去重的问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,这种情况除非合并一个RegistryManager,否则搞不定。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw commented on issue #9014: 注册管理getRegistries获取的Registry有重复

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   问题没有那么简单,同一个URL创建多个Registry实例的情况怎么办,比如其中一个是ZookeeperRegistry,另一个是ServiceDiscoveryRegistry,用的同一个zk URL,这样重复操作zk也抛异常。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #9014: 注册管理getRegistries获取的Registry没有去重

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #9014:
URL: https://github.com/apache/dubbo/issues/9014#issuecomment-939630669


   应用同时作为provider和consumer时也有问题,比如DubboBootstrapMultiInstanceTest的testMultiModuleDeployAndReload测试方法最后providerBootstrap.destroy()解注册一次,consumerBootstrap.destroy()又解注册时就会抛异常,这个问题只改HashSet类型没有用,因为provider和consumer分别有一个RegistryManager,但是它们共享了一个zkClient,一个destroy了就直接把zkClient给关了,另一个unregistry就异常了。
   
   我想把所有获取RegistryManager对象的代码改成:ApplicationModel.defaultModel().getBeanFactory().getBean(RegistryManager.class);
   注册管理全局唯一如何?


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org