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 2022/04/25 02:01:55 UTC

[GitHub] [dubbo] AlbumenJ commented on issue #9965: 当服务的所有provider下线后,consumer不会释放DubboInvoker及NettyClient等资源,而是不断的重连

AlbumenJ commented on issue #9965:
URL: https://github.com/apache/dubbo/issues/9965#issuecomment-1107986744

   如果注册中心存在空地址的情况会走到下面的逻辑进行销毁
   ```
       private void refreshInvoker(List<URL> invokerUrls) {
           Assert.notNull(invokerUrls, "invokerUrls should not be null, use EMPTY url to clear current addresses.");
           this.originalUrls = invokerUrls;
   
           if (invokerUrls.size() == 1 && EMPTY_PROTOCOL.equals(invokerUrls.get(0).getProtocol())) {
               logger.warn("Received url with EMPTY protocol, will clear all available addresses.");
               this.forbidden = true; // Forbid to access
               routerChain.setInvokers(BitList.emptyList());
               destroyAllInvokers(); // Close all invokers
           } 
   }
   
   ```
   
   即使转订阅为空也会走这里快速返回,不会 destroy
   ```
               if (CollectionUtils.isEmptyMap(newUrlInvokerMap)) {
                   logger.error(new IllegalStateException("Cannot create invokers from url address list (total " + invokerUrls.size() + ")"));
                   return;
               }
   ```
   
   这个应该是触发了注册中心空地址保护的逻辑了,在注册中心地址为空的时候拿前一次非空的结果进行处理,避免由于注册中心不可用造成的抖动,可以通过以下配置关闭
   
   ```
   RegistryConfig.java
       @Parameter(key = ENABLE_EMPTY_PROTECTION_KEY)
       public Boolean getEnableEmptyProtection() {
           return enableEmptyProtection;
       }
   
       public void setEnableEmptyProtection(Boolean enableEmptyProtection) {
           this.enableEmptyProtection = enableEmptyProtection;
       }
   ```


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