chuanxo opened a new issue, #10438: URL: https://github.com/apache/rocketmq/issues/10438
### Before Creating the Bug Report - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions). - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate. - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ. ### Runtime platform environment All (logic bug) ### RocketMQ version branch: develop commit: 7e0cec35a ### JDK Version Not JDK-specific. ### Describe the Bug `TopicConfigManager.buildTopicConfigSerializeWrapper()` 直接将 `this.topicConfigTable` 引用设入 wrapper,而 `dataVersion` 做了 copy。由于 wrapper 持有 live 引用,并发的 `updateTopicConfig()` 会先 `putTopicConfig()` 再 `updateDataVersion()`,导致 wrapper 的消费者(如注册到 NameServer 的逻辑)看到的数据与版本不一致。 两种危险时序: 1. 版本 < 数据:NameServer 认为当前版本已是最新,不再拉取,实际数据已更新 → 路由信息过时 2. 版本 > 数据:NameServer 拉到数据但 version 超前,后续真正变更可能被跳过 ### Steps to Reproduce 1. Broker 有多个 topic,启动后正常注册到 NameServer 2. 并发调用 `updateTopicConfig()` 创建/修改 topic 3. 同时 `buildTopicConfigSerializeWrapper()` 被调用(定时注册心跳) 4. NameServer 侧对比 `DataVersion` 决定是否更新路由 ### What Did You Expect to See? `buildTopicConfigSerializeWrapper()` 返回的 wrapper 中 topicConfigTable 和 dataVersion 是同一时刻的一致快照。 ### What Did You See Instead? wrapper 中 topicConfigTable 是 live 引用,dataVersion 是 snapshot copy,两者可以不一致。 ### Additional Context _No response_ -- 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]
