You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "huangqy17 (via GitHub)" <gi...@apache.org> on 2025/08/13 10:42:40 UTC

[I] [Bug] cannot Remove duplicated invokers in registry notification [dubbo]

huangqy17 opened a new issue, #15632:
URL: https://github.com/apache/dubbo/issues/15632

   ### 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
   
   dubbo3.3.5  nacos2.2.4
   
   ### Steps to reproduce this issue
   
   Shut down the virtual machine where the abnormal dubbo provider is located and restart this virtual machine and the dubbo provider. Then the nacos server will push two identical registration messages, but with different timestamps. The duplicate removal of refreshinvoker in seviceDiscoveryRegistryDirectory will not delete the duplicate invoker because the received url object type is instanceAddressUrl, and its equals method will determine whether the internal instance is equal.
   https://github.com/apache/dubbo/pull/15060 cannot resolve the problem
   
   ### What you expected to happen
   
   Remove duplicated invokers in registry notification
   
   ### Anything else
   
   _No response_
   
   ### 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: notifications-unsubscribe@dubbo.apache.org.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


Re: [I] [Bug] cannot Remove duplicated invokers in registry notification [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on issue #15632:
URL: https://github.com/apache/dubbo/issues/15632#issuecomment-3345289563

   it might out of dubbo responsibility, we don't know which one should be kept in invokers if nacos server pushed two similar instances that only timestamp of them are different.
   maybe the latest nacos will solve the issue.


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


Re: [I] [Bug] cannot Remove duplicated invokers in registry notification [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on issue #15632:
URL: https://github.com/apache/dubbo/issues/15632#issuecomment-3190382594

   by the way, these codes at ```DefaultServiceInstance#equals``` should be optimized like this
   ```
       @Override
       public boolean equals(Object o) {
           ...     
           for (Map.Entry<String, String> entry : this.getMetadata().entrySet()) {
               ...
               if (entry.getValue() == null) {
                   if  (null != that.getMetadata().get(entry.getKey())) {
                       return false;
                   }
               } else {
                   if (!entry.getValue().equals(that.getMetadata().get(entry.getKey())) {
                       return false;
                   }
               }
           }
           return true;
   }
   ```


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


Re: [I] [Bug] cannot Remove duplicated invokers in registry notification [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw closed issue #15632: [Bug] cannot Remove duplicated invokers in registry notification
URL: https://github.com/apache/dubbo/issues/15632


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


Re: [I] [Bug] cannot Remove duplicated invokers in registry notification [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on issue #15632:
URL: https://github.com/apache/dubbo/issues/15632#issuecomment-3190375116

   do you mean the ```equals``` method of DefaultServiceInstance should not check timestamp?
   ```
       @Override
       public boolean equals(Object o) {
           if (this == o) {
               return true;
           }
           if (!(o instanceof DefaultServiceInstance)) {
               return false;
           }
           DefaultServiceInstance that = (DefaultServiceInstance) o;
           boolean equals = Objects.equals(getServiceName(), that.getServiceName())
                   && Objects.equals(getHost(), that.getHost())
                   && Objects.equals(getPort(), that.getPort());
           for (Map.Entry<String, String> entry : this.getMetadata().entrySet()) {
               if (entry.getKey().equals(EXPORTED_SERVICES_REVISION_PROPERTY_NAME)) {
                   continue;
               }
               
               // don't compare timestamp?
               if (entry.getKey().equals("timestamp") {
                   continue;               
               }
   
   
               if (entry.getValue() == null) {
                   equals = equals && (entry.getValue() == that.getMetadata().get(entry.getKey()));
               } else {
                   equals = equals && entry.getValue().equals(that.getMetadata().get(entry.getKey()));
               }
           }
   
           return equals;
       }
   ```


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


Re: [I] [Bug] cannot Remove duplicated invokers in registry notification [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on issue #15632:
URL: https://github.com/apache/dubbo/issues/15632#issuecomment-3196373154

   @huangqy17 could you test #15633 and check whether it fixs your issue or not?


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