Skip to content

Commit

Permalink
Call container.Terminate() on shutdown timeouts
Browse files Browse the repository at this point in the history
We were logging if HcsShutdownComputeSystem failed, but we weren't
trying to force kill the container via Terminate after if we timed
out waiting for it to complete. Shutdown is async and we wait for
a notification for success, so most of the time the call itself will
return nil, but it doesn't indicate indicate success until we can
see that the system exited. So now we will fallback to Terminate for:

1. Shutdown returning an error that doesn't indicate the result is
to be waited on.
2. The async result of shutdown was non-nil
3. Waiting for the result passed the timeout we set.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
  • Loading branch information
dcantah authored and Kirtana Ashok committed Oct 29, 2022
1 parent c04a450 commit ab3c7a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/containerd-shim-runhcs-v1/task_hcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ func (ht *hcsTask) close(ctx context.Context) {
log.G(ctx).WithError(err).Error("failed to wait for container shutdown")
}
case <-t.C:
log.G(ctx).WithError(hcs.ErrTimeout).Error("failed to wait for container shutdown")
err = hcs.ErrTimeout
log.G(ctx).WithError(err).Error("failed to wait for container shutdown")
}
}

Expand Down

0 comments on commit ab3c7a3

Please sign in to comment.