From 80ebf2d7b253730ffece28018705c3e0b4247bb2 Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Tue, 31 Aug 2021 15:11:32 -0600 Subject: [PATCH] Add a comment to explain that we want to make a copy of the config Signed-off-by: Ivan Kozlovic --- server/monitor.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/monitor.go b/server/monitor.go index 7349bc87345..40eb67dac4e 100644 --- a/server/monitor.go +++ b/server/monitor.go @@ -1262,6 +1262,8 @@ func (s *Server) HandleRoot(w http.ResponseWriter, r *http.Request) { func (s *Server) updateJszVarz(js *jetStream, v *JetStreamVarz, doConfig bool) { if doConfig { js.mu.RLock() + // We want to snapshot the config since it will then be available outside + // of the js lock. So make a copy first, then point to this copy. cfg := js.config v.Config = &cfg js.mu.RUnlock()