1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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 <aaron.lehmann@docker.com>
(cherry picked from commit 37b492ae1b)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Aaron Lehmann 2017-02-16 17:52:02 -08:00 committed by Victor Vieux
parent 4fa77953f8
commit ff70cbf5ea

View file

@ -323,8 +323,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 {