From 6095e8f46d6042c4dacc461290bdd73960c8edfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pi=C3=B1a?= Date: Fri, 26 Mar 2021 10:30:16 -0700 Subject: [PATCH] Guard account client map --- server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index e39d5952..30b8f04c 100644 --- a/server/server.go +++ b/server/server.go @@ -1236,6 +1236,7 @@ func (s *Server) registerAccountNoLock(acc *Account) *Account { // Finish account setup and store. s.setAccountSublist(acc) + acc.mu.Lock() if acc.clients == nil { acc.clients = make(map[*client]struct{}) } @@ -1245,7 +1246,6 @@ func (s *Server) registerAccountNoLock(acc *Account) *Account { // During config reload, it is possible that account was // already created (global account), so use locking and // make sure we create only if needed. - acc.mu.Lock() // TODO(dlc)- Double check that we need this for GWs. if acc.rm == nil && s.opts != nil && s.shouldTrackSubscriptions() { acc.rm = make(map[string]int32)