Skip to content

Commit

Permalink
orchestrator: Check that service's SpecVersion exists before derefere…
Browse files Browse the repository at this point in the history
…ncing

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 <aaron.lehmann@docker.com>
  • Loading branch information
aaronlehmann committed Jun 9, 2017
1 parent 43b657a commit b2968a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion manager/orchestrator/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b2968a1

Please sign in to comment.