From 0900a1dbcc3759b8984890ed9e4e83f0deec58c8 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Mon, 2 Apr 2018 16:39:18 -0700 Subject: [PATCH] drain: fix double-close panic on drain future --- nomad/drainer/drainer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nomad/drainer/drainer.go b/nomad/drainer/drainer.go index db345a2ee..b7c7ddf00 100644 --- a/nomad/drainer/drainer.go +++ b/nomad/drainer/drainer.go @@ -6,6 +6,7 @@ import ( "sync" "time" + multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/uuid" "github.com/hashicorp/nomad/nomad/state" @@ -399,11 +400,12 @@ func (n *NodeDrainer) drainAllocs(future *structs.BatchFuture, allocs []*structs var finalIndex uint64 for _, u := range partitionAllocDrain(transistions, evals) { index, err := n.raft.AllocUpdateDesiredTransition(u.Transistions, u.Evals) + var mErr multierror.Error if err != nil { - future.Respond(index, err) + mErr.Errors = append(mErr.Errors, err) } finalIndex = index } - future.Respond(finalIndex, nil) + future.Respond(finalIndex, mErr.ErrorOrNil()) }