Merge pull request #41625 from sparrc/delete-task-timeout
handleContainerExit: timeout on containerd DeleteTask
This commit is contained in:
commit
e1b15e1e5b
1 changed files with 6 additions and 4 deletions
|
@ -26,15 +26,17 @@ func (daemon *Daemon) setStateCounter(c *container.Container) {
|
|||
|
||||
func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
|
||||
c.Lock()
|
||||
|
||||
ec, et, err := daemon.containerd.DeleteTask(context.Background(), c.ID)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
ec, et, err := daemon.containerd.DeleteTask(ctx, c.ID)
|
||||
cancel()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warnf("failed to delete container %s from containerd", c.ID)
|
||||
logrus.WithError(err).WithField("container", c.ID).Warnf("failed to delete container from containerd")
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second)
|
||||
c.StreamConfig.Wait(ctx)
|
||||
cancel()
|
||||
|
||||
c.Reset(false)
|
||||
|
||||
exitStatus := container.ExitStatus{
|
||||
|
|
Loading…
Add table
Reference in a new issue