From b2968a1fbbbb7253a898a5cf74dd83db4a3e692f Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Fri, 9 Jun 2017 11:50:56 -0700 Subject: [PATCH] orchestrator: Check that service's SpecVersion exists before dereferencing IsTaskDirty assumed that if a task had a SpecVersion, the corresponding service must also have a SpecVersion, since that is where the task's field is copied from. However, there are mixed-version scenarios where a service could get updated by a manager running an older version of swarmkit than the manager that created the task. Add a check to avoid a crash in this case. Signed-off-by: Aaron Lehmann --- manager/orchestrator/task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manager/orchestrator/task.go b/manager/orchestrator/task.go index 54a069e199..32a22d5f5a 100644 --- a/manager/orchestrator/task.go +++ b/manager/orchestrator/task.go @@ -63,7 +63,7 @@ func IsTaskDirty(s *api.Service, t *api.Task) bool { // If the spec version matches, we know the task is not dirty. However, // if it does not match, that doesn't mean the task is dirty, since // only a portion of the spec is included in the comparison. - if t.SpecVersion != nil && *s.SpecVersion == *t.SpecVersion { + if t.SpecVersion != nil && s.SpecVersion != nil && *s.SpecVersion == *t.SpecVersion { return false }