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