From f1e8addbdf177188194171ffa8edf805b15b6d7a Mon Sep 17 00:00:00 2001 From: Freddy Date: Thu, 30 Jul 2020 11:11:10 -0600 Subject: [PATCH] Avoid panics during shutdown routine (#8412) --- agent/consul/server.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/agent/consul/server.go b/agent/consul/server.go index 9a7ca78eaf..ba492326bd 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -958,15 +958,21 @@ func (s *Server) Shutdown() error { } // Close the connection pool - s.connPool.Shutdown() + if s.connPool != nil { + s.connPool.Shutdown() + } - s.acls.Close() + if s.acls != nil { + s.acls.Close() + } if s.config.NotifyShutdown != nil { s.config.NotifyShutdown() } - s.fsm.State().Abandon() + if s.fsm != nil { + s.fsm.State().Abandon() + } return nil }