Skip to content

Commit 55faa5e

Browse files
committed
task delete: Closes task IO before waiting
After containerd restarts, it will try to recover its sandboxes, containers, and images. If it detects a task in the Created or Stopped state, it will be removed. This will cause the containerd process it hang on Windows on the t.io.Wait() call. Calling t.io.Close() beforehand will solve this issue. Additionally, the same issue occurs when trying to stopp a sandbox after containerd restarts. This will solve that case as well. Signed-off-by: Claudiu Belu <[email protected]>
1 parent d58542a commit 55faa5e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pkg/cri/io/helpers_windows.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func openPipe(ctx context.Context, fn string, flag int, perm os.FileMode) (io.Re
5050
}
5151
p.con = c
5252
}()
53+
go func() {
54+
<-ctx.Done()
55+
p.Close()
56+
}()
5357
return p, nil
5458
}
5559

task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
315315
return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task must be stopped before deletion: %s", status.Status)
316316
}
317317
if t.io != nil {
318+
t.io.Close()
318319
t.io.Cancel()
319320
t.io.Wait()
320321
}

0 commit comments

Comments
 (0)