This is an automated email from the ASF dual-hosted git repository.
tew pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go.git
The following commit(s) were added to refs/heads/master by this push:
new 8632371d fix: Data Race in ConsistentHash LoadBalance (#998)
8632371d is described below
commit 8632371dc93a507bf1597c59c0a871eee0c56e53
Author: xuzifu666 <[email protected]>
AuthorDate: Mon Nov 24 16:29:43 2025 +0800
fix: Data Race in ConsistentHash LoadBalance (#998)
Co-authored-by: Tew <[email protected]>
---
pkg/remoting/loadbalance/consistent_hash_loadbalance.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pkg/remoting/loadbalance/consistent_hash_loadbalance.go
b/pkg/remoting/loadbalance/consistent_hash_loadbalance.go
index 626a0104..54f696c3 100644
--- a/pkg/remoting/loadbalance/consistent_hash_loadbalance.go
+++ b/pkg/remoting/loadbalance/consistent_hash_loadbalance.go
@@ -89,6 +89,8 @@ func (c *Consistent) refreshHashCircle(sessions *sync.Map) {
var sortedHashNodes []int64
hashCircle := make(map[int64]getty.Session)
var session getty.Session
+ c.RLock()
+ defer c.RUnlock()
sessions.Range(func(key, value interface{}) bool {
session = key.(getty.Session)
for i := 0; i < defaultVirtualNodeNumber; i++ {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]