AsperforMias opened a new pull request, #3479: URL: https://github.com/apache/dubbo-go/pull/3479
### Description Fixes #3468 **EXIGENCY!!!** This PR fixes a long-standing Nacos interface-level registry bug introduced after `LoadSubscribeInstances` was added in v3.0.5. Since v3.0.5, `RegistryDirectory` loads the initial provider list through `LoadSubscribeInstances` before starting the async Nacos subscription. That initial load notifies the directory and creates invokers, but the Nacos listener's local `instanceMap` still starts empty. Because of that, when a provider is replaced later, for example during a Kubernetes rolling update where the provider IP changes, the first Nacos push may only be treated as an add/update from the listener's perspective. The old provider loaded during startup can be missed by the listener diff and remain in the directory, causing consumers to route traffic to an offline provider and produce request failures or timeouts. **This can affect dubbo-go versions from v3.0.5 to current main in Nacos interface-level registry scenarios. This is a high-severity production availability issue because rolling updates and provider IP changes are common in Kubernetes deployments, and stale provider addresses can directly cause consumer-side request failures or timeouts !!!** The fix seeds the Nacos listener cache with the instances returned by `LoadSubscribeInstances` before subscribing to Nacos push events. With the initial snapshot as the diff baseline, later Nacos pushes can correctly produce both add and delete events. This PR also adds a regression test covering the stale initial provider case: - initial provider is loaded first - Nacos later pushes a different provider list - listener emits add for the new provider and delete for the stale initial provider ### Checklist - [x] I confirm the target branch is `main` - [x] Code has passed local testing - [x] I have added tests that prove my fix is effective or that my feature works -- 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]
