From a0d4d4a33679d6d55c3be5896b97acdbd55ae01d Mon Sep 17 00:00:00 2001 From: capone212 Date: Thu, 24 May 2018 13:15:06 +0000 Subject: [PATCH] Fixed #3595 (https://github.com/hashicorp/nomad/issues/3595) Stopping heartbeat timer before remove --- nomad/heartbeat.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nomad/heartbeat.go b/nomad/heartbeat.go index 8468c67bd..9a55bb256 100644 --- a/nomad/heartbeat.go +++ b/nomad/heartbeat.go @@ -112,7 +112,10 @@ func (s *Server) invalidateHeartbeat(id string) { defer metrics.MeasureSince([]string{"nomad", "heartbeat", "invalidate"}, time.Now()) // Clear the heartbeat timer s.heartbeatTimersLock.Lock() - delete(s.heartbeatTimers, id) + if timer, ok := s.heartbeatTimers[id]; ok { + timer.Stop() + delete(s.heartbeatTimers, id) + } s.heartbeatTimersLock.Unlock() // Do not invalidate the node since we are not the leader. This check avoids