Skip to content

Commit 37b492a

Browse files
author
Aaron Lehmann
committed
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 <[email protected]>
1 parent 1ad165d commit 37b492a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

daemon/cluster/executor/container/controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,10 @@ func (r *controller) Shutdown(ctx context.Context) error {
317317

318318
// remove container from service binding
319319
if err := r.adapter.deactivateServiceBinding(); err != nil {
320-
log.G(ctx).WithError(err).Errorf("failed to deactivate service binding for container %s", r.adapter.container.name())
321-
return err
320+
log.G(ctx).WithError(err).Warningf("failed to deactivate service binding for container %s", r.adapter.container.name())
321+
// Don't return an error here, because failure to deactivate
322+
// the service binding is expected if the container was never
323+
// started.
322324
}
323325

324326
if err := r.adapter.shutdown(ctx); err != nil {

0 commit comments

Comments
 (0)