From a41e906517565b9377b157c2d96dedfc592f9344 Mon Sep 17 00:00:00 2001 From: Eric Weber Date: Fri, 30 Jun 2023 11:13:56 -0500 Subject: [PATCH] Don't call ReconcileEngineState on an engine we are trying to stop Signed-off-by: Eric Weber (cherry picked from commit 57b45967175769d608b6f08598b5a477df2f94a6) --- controller/engine_controller.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controller/engine_controller.go b/controller/engine_controller.go index 254f73b7bf..b7da4ede8b 100644 --- a/controller/engine_controller.go +++ b/controller/engine_controller.go @@ -348,7 +348,10 @@ func (ec *EngineController) syncEngine(key string) (err error) { // we allow across monitoring temporarily due to migration case if !ec.isMonitoring(engine) { ec.startMonitoring(engine) - } else if engine.Status.ReplicaModeMap != nil { + } else if engine.Status.ReplicaModeMap != nil && engine.Spec.DesireState != longhorn.InstanceStateStopped { + // If engine.Spec.DesireState == longhorn.InstanceStateStopped, we have likely already issued a command to + // shut down the engine. It is potentially dangerous to attempt to communicate with it now, as a new engine + // may start using its address. if err := ec.ReconcileEngineState(engine); err != nil { return err }