From e62990d017ac5d27c7c5f4da51ef4dfe4cd8bc0f Mon Sep 17 00:00:00 2001 From: Maurice van Veen Date: Wed, 20 Nov 2024 09:33:24 +0100 Subject: [PATCH] Fix data race when updating leader Signed-off-by: Maurice van Veen --- server/jetstream_cluster_4_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/jetstream_cluster_4_test.go b/server/jetstream_cluster_4_test.go index 94d9952d81..b3ef31b1b6 100644 --- a/server/jetstream_cluster_4_test.go +++ b/server/jetstream_cluster_4_test.go @@ -3967,7 +3967,9 @@ func TestJetStreamClusterDesyncAfterErrorDuringCatchup(t *testing.T) { for _, n := range server.raftNodes { rn := n.(*raft) if rn.accName == "$G" { + rn.Lock() rn.updateLeader(noLeader) + rn.Unlock() } }