haoyann opened a new issue #8372:
URL: https://github.com/apache/dubbo/issues/8372


   - [x] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   - [x] I have checked the 
[FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository 
and believe that this is not a duplicate.
   
   ### Steps to reproduce this issue
   
   1. Registry center uses nacos. 
   2. Dubbo default  enable local file cache. ` putPropertyIfAbsent(url, 
properties, NAMING_LOAD_CACHE_AT_START, "true")`
   3. When consumer cache service message, stop the consumer and change the 
provider port.
   4. Restart consumer, get service from the local cache not remote can't get 
latest provider.
   5. Get metadata error.
   ```
   [29/07/21 22:50:30:621 CST] main ERROR 
listener.ServiceInstancesChangedListener:  [DUBBO] Failed to get MetadataInfo 
for instance 
192.168.1.3:20882?revision=9e01c93d27cdeeca3d269453cc930929&cluster=null, wait 
for retry., dubbo version: 3.0.2-SNAPSHOT, current host: 192.168.1.3
   
   ```
   ***
   The key point is to dubbo query the service information before subscribing 
to the service. But nacos refreshes the local information after subscribing to 
the service. So if the consumer has a local cache service, and the remote 
provider is inconsistent with the local cache. The first time you get metadata, 
it will be abnormal.
   
   
https://github.com/apache/dubbo/blob/4149543bed77fb9d4f859c766c4d90aa09bc81af/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java#L309
   
   
https://github.com/apache/dubbo/blob/4149543bed77fb9d4f859c766c4d90aa09bc81af/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java#L323
   ***
   This method should be used. Call the remote when there is no subscribe.
   
`com.alibaba.nacos.api.naming.NamingService#getAllInstances(java.lang.String, 
java.lang.String, boolean)`


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