diff --git a/client/allocrunner/group_service_hook.go b/client/allocrunner/group_service_hook.go index 30a698ecdfc4..a63f6f607624 100644 --- a/client/allocrunner/group_service_hook.go +++ b/client/allocrunner/group_service_hook.go @@ -119,12 +119,14 @@ func (h *groupServiceHook) Prerun() error { defer func() { // Mark prerun as true to unblock Updates h.prerun = true + // Mark deregistered as false to allow de-registration + h.deregistered = false h.mu.Unlock() }() return h.preRunLocked() } -// caller must hold h.lock +// caller must hold h.mu func (h *groupServiceHook) preRunLocked() error { if len(h.services) == 0 { return nil @@ -188,6 +190,8 @@ func (h *groupServiceHook) PreTaskRestart() error { defer func() { // Mark prerun as true to unblock Updates h.prerun = true + // Mark deregistered as false to allow de-registration + h.deregistered = false h.mu.Unlock() }() @@ -201,7 +205,7 @@ func (h *groupServiceHook) PreKill() { // implements the PreKill hook // -// caller must hold h.lock +// caller must hold h.mu func (h *groupServiceHook) preKillLocked() { // If we have a shutdown delay deregister group services and then wait // before continuing to kill tasks.