From 37b492ae1b2ba5f84cd0b795dbc68804d7b2fec5 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Thu, 16 Feb 2017 17:52:02 -0800 Subject: [PATCH] Shutdown leaks an error when the container was never started I found that sometimes tasks would end up in a rejected state when trying to update them quickly. The problem was that Shutdown could fail if called before the container was started. Instead of returning an error in this case, Shutdown should succeed. This allows tasks to progress to the "shutdown" state as expected. Signed-off-by: Aaron Lehmann --- daemon/cluster/executor/container/controller.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/cluster/executor/container/controller.go b/daemon/cluster/executor/container/controller.go index 0ecf58e62b..da09d2ee47 100644 --- a/daemon/cluster/executor/container/controller.go +++ b/daemon/cluster/executor/container/controller.go @@ -317,8 +317,10 @@ func (r *controller) Shutdown(ctx context.Context) error { // remove container from service binding if err := r.adapter.deactivateServiceBinding(); err != nil { - log.G(ctx).WithError(err).Errorf("failed to deactivate service binding for container %s", r.adapter.container.name()) - return err + log.G(ctx).WithError(err).Warningf("failed to deactivate service binding for container %s", r.adapter.container.name()) + // Don't return an error here, because failure to deactivate + // the service binding is expected if the container was never + // started. } if err := r.adapter.shutdown(ctx); err != nil {