From 1526f1003c6261bcabde06d1c4bf7f7afb655f03 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Mon, 10 Apr 2017 14:56:21 -0700 Subject: [PATCH] Fix a panic during plan evaluation This PR fixes a potential source of a panic while evaluating a plan with all_at_once set to true with partial failures. Fixes #2531 --- nomad/plan_apply.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nomad/plan_apply.go b/nomad/plan_apply.go index 5262eb94edb0..d7449e17b4b8 100644 --- a/nomad/plan_apply.go +++ b/nomad/plan_apply.go @@ -263,6 +263,7 @@ func evaluatePlan(pool *EvaluatePool, snap *state.StateSnapshot, plan *structs.P // Evalute each node in the plan, handling results as they are ready to // avoid blocking. +OUTER: for len(nodeIDList) > 0 { nodeID := nodeIDList[0] select { @@ -276,7 +277,7 @@ func evaluatePlan(pool *EvaluatePool, snap *state.StateSnapshot, plan *structs.P // which may save time processing additional entries. if cancel := handleResult(r.nodeID, r.fit, r.err); cancel { didCancel = true - break + break OUTER } } }