xuyuTT opened a new issue, #13675: URL: https://github.com/apache/dubbo/issues/13675
在生产者与提供者一起启动的情况下 ```java private void doSubscribe(final URL url, final NotifyListener listener, final Set<String> serviceNames) { execute(namingService -> { if (isServiceNamesWithCompatibleMode(url)) { List<Instance> allCorrespondingInstanceList = new ArrayList<>(); /** * Get all instances with serviceNames to avoid instance overwrite and but with empty instance mentioned * in https://github.com/apache/dubbo/issues/5885 and https://github.com/apache/dubbo/issues/5899 * * namingService.getAllInstances with {@link org.apache.dubbo.registry.support.AbstractRegistry#registryUrl} * default {@link DEFAULT_GROUP} * * in https://github.com/apache/dubbo/issues/5978 */ for (String serviceName : serviceNames) { List<Instance> instances = namingService.getAllInstances(serviceName, getUrl().getParameter(GROUP_KEY, Constants.DEFAULT_GROUP)); NacosInstanceManageUtil.initOrRefreshServiceInstanceList(serviceName, instances); allCorrespondingInstanceList.addAll(instances); } notifySubscriber(url, listener, allCorrespondingInstanceList); for (String serviceName : serviceNames) { subscribeEventListener(serviceName, url, listener); } } else { List<Instance> instances = new LinkedList<>(); for (String serviceName : serviceNames) { instances.addAll(namingService.getAllInstances(serviceName , getUrl().getParameter(GROUP_KEY, Constants.DEFAULT_GROUP))); notifySubscriber(url, listener, instances); subscribeEventListener(serviceName, url, listener); } } }); } ``` 此代码为消费者启动过程中,订阅服务的逻辑 ```java for (String serviceName : serviceNames) { List<Instance> instances = namingService.getAllInstances(serviceName, getUrl().getParameter(GROUP_KEY, Constants.DEFAULT_GROUP)); NacosInstanceManageUtil.initOrRefreshServiceInstanceList(serviceName, instances); allCorrespondingInstanceList.addAll(instances); } notifySubscriber(url, listener, allCorrespondingInstanceList); ``` 这段代码跑完后,此时由于提供者实例没有注册到nacos上,所以拉取不到服务,此时DynamicDirectory里的forbidden还是true,此时与调用 ```java for (String serviceName : serviceNames) { subscribeEventListener(serviceName, url, listener); } ``` 这段代码之间,生产者注册到了nacos,此时,由于消费者还没向nacos监听服务,所以收不到通知,导致这个情况下forbidden属性不通过外力干涉,一直是true,导致调用no provider,我通过debug能复现此问题,不确定我的分析是否合理? -- 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-unsubscr...@dubbo.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org