From 78a4befa714b0b5b20964a5a71548fdc0300e484 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Mon, 12 Sep 2016 12:56:12 -0700 Subject: [PATCH] Revert "A nil context isn't an error" This reverts commit fe9fe4c26259c1ad3bd7e94bd711418aaf819b20. --- client/alloc_runner.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/alloc_runner.go b/client/alloc_runner.go index 3454450bc95..00d76746422 100644 --- a/client/alloc_runner.go +++ b/client/alloc_runner.go @@ -51,14 +51,13 @@ type AllocRunner struct { dirtyCh chan struct{} - ctx *driver.ExecContext - ctxLock sync.Mutex + ctx *driver.ExecContext + ctxLock sync.Mutex + tasks map[string]*TaskRunner + taskStates map[string]*structs.TaskState + restored map[string]struct{} + taskLock sync.RWMutex - tasks map[string]*TaskRunner - restored map[string]struct{} - taskLock sync.RWMutex - - taskStates map[string]*structs.TaskState taskStatusLock sync.RWMutex updateCh chan *structs.Allocation @@ -127,6 +126,9 @@ func (r *AllocRunner) RestoreState() error { if r.alloc == nil { snapshotErrors.Errors = append(snapshotErrors.Errors, fmt.Errorf("alloc_runner snapshot includes a nil allocation")) } + if r.ctx == nil { + snapshotErrors.Errors = append(snapshotErrors.Errors, fmt.Errorf("alloc_runner snapshot includes a nil context")) + } if e := snapshotErrors.ErrorOrNil(); e != nil { return e }