AsperforMias commented on issue #3468: URL: https://github.com/apache/dubbo-go/issues/3468#issuecomment-4901440415
根据补充的 demo 和日志,初步判断这不是 Nacos 服务端 / nacos-sdk-go / K8s 下线本身的问题,主因更像是 dubbo-go consumer 侧 Nacos registry/listener 的本地状态不一致。 日志里独立的 nacos-sdk-go watch 已经能正确看到实例全量变化:旧 provider removed,新 provider added,说明 Nacos 和 SDK 已经感知并推送了正确实例列表。但同一时间 dubbo-go 侧只处理了新 provider 的 add,没有处理旧 provider 的 delete,导致本地 invoker 里残留旧地址,后续调用仍可能打到已下线实例。 疑似根因是:RegistryDirectory 初始化时会先通过 LoadSubscribeInstances 拉取一次已有 provider 并加入目录,但 nacosListener 自己用于计算 add/delete diff 的 instanceMap 没有同步这批初始实例。后续第一次 Nacos subscribe callback 如果只包含新 provider,listener 因为不知道旧 provider 曾经存在,就只生成 add,不会生成 delete。 K8s 滚动发布会更容易触发这个问题,因为每次 Pod IP 都变化;如果 provider 原地重启、地址不变,就不容易暴露。 修复方向建议:要么让 Nacos callback 按全量实例列表走 NotifyAll 刷新目录;要么在 LoadSubscribeInstances / subscribe 初始化时同步预热 nacosListener.instanceMap,保证后续 diff 能正确生成旧实例 delete。 -- 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]
