zrlw commented on issue #13675:
URL: https://github.com/apache/dubbo/issues/13675#issuecomment-2561674712

   the issue is trigged when both consumer and provider start up at the same 
time by these steps:
   ```
              consumer-A (running at NacosRegistry#doSubscribe)                 
                        provider-B and nacos registration center
        1.   get empty instance list of the provider 
              by namingService.getAllInstances.
        3.   set the value of forbidden to true
              by calling notifySubscriber -> RegistryDirectory#refreshInvoker
                                                                                
                                                   4. register instance to 
nacos registration center
                                                                                
                                                   5. nacos registration center 
send instance info
                                                                                
                                                       to the subcribers except 
consumer-A
                                                                                
                                                       as it does not subscribe 
yet.
        4. subsribe instance info of provider-B later.
            but it will receive nothing and  'No provider' RpcException
            will be thrown whenever calling provider-B as the value of 
forbidden is always true.
   ```
    @laywin 
   the issue might be fixed by calling notifySubscriber before getAllInstances 
like this?
   ```
                   // subscribe first to avoid missing event notice?
                   for (String serviceName : serviceNames) {
                       subscribeEventListener(serviceName, url, listener);
                   }
                   
                   for (String serviceName : serviceNames) {
                       List<Instance> instances =
                               namingService.getAllInstances(serviceName, 
getUrl().getGroup(Constants.DEFAULT_GROUP));
                       notifySubscriber(url, serviceName, listener, instances);
                   }
   ```
   


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