From ee4598891f7183ea4cf9822d36c6f80c594b9c8f 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 46583c5de5..603118a107 100644 --- a/controller/engine_controller.go +++ b/controller/engine_controller.go @@ -349,7 +349,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 }