luozongle01 opened a new issue, #8743:
URL: https://github.com/apache/rocketmq/issues/8743

   ### 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
   
   macos: 11.7.10
   
   ### RocketMQ version
   
   5.3.0
   
   ### JDK Version
   
   JDK1.8
   
   ### Describe the Bug
   
   There may be concurrency issues with the value "HashMap<String, Integer>" in 
the brokerVersionTable of MQClientInstance, such as when a new broker node is 
added and other threads are getting or traversing the map. Although the 
likelihood of this happening is relatively low, there is indeed a risk 
involved. 
   <img width="1108" alt="image" 
src="https://github.com/user-attachments/assets/46936240-40df-4e3a-8625-b2d9b8bac2d9";>
   
   Although the brokerAddrTable always replaces the map inside, would it also 
be better to use Concurrent HashMap.
   <img width="827" alt="image" 
src="https://github.com/user-attachments/assets/4c9aea42-1e5d-4fa0-bb2d-bb340edb6325";>
   
   ### Steps to Reproduce
   
   If a new broker is added, when the client obtains the broker version number 
by sending a heartbeat and puts it into the brokerVersionTable, there may be 
exceptions if other threads are querying the brokerVersionTable.
   
   ### What Did You Expect to See?
   
   When adding a broker, both the brokerVersionTable and brokerAddrTable are 
thread safe
   
   ### What Did You See Instead?
   
   There may be thread safety issues with brokerVersionTable and brokerAddrTable
   
   ### 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]

Reply via email to