From a9adc7938d98d292d7c2b598b1458551e275a507 Mon Sep 17 00:00:00 2001 From: Samuel Karp Date: Fri, 14 Oct 2022 14:39:52 -0700 Subject: [PATCH] cri: PodSandboxStatus should tolerate missing task Signed-off-by: Samuel Karp (cherry picked from commit 890398677ec64c50c146eb79fe9355f1224cef52) Signed-off-by: Samuel Karp --- pkg/cri/server/sandbox_status.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/cri/server/sandbox_status.go b/pkg/cri/server/sandbox_status.go index 609b559a8820..fd2afc4b55b8 100644 --- a/pkg/cri/server/sandbox_status.go +++ b/pkg/cri/server/sandbox_status.go @@ -155,12 +155,14 @@ func toCRISandboxInfo(ctx context.Context, sandbox sandboxstore.Sandbox) (map[st var processStatus containerd.ProcessStatus if task != nil { - taskStatus, err := task.Status(ctx) - if err != nil { - return nil, fmt.Errorf("failed to get task status: %w", err) + if taskStatus, err := task.Status(ctx); err != nil { + if !errdefs.IsNotFound(err) { + return nil, fmt.Errorf("failed to get task status: %w", err) + } + processStatus = containerd.Unknown + } else { + processStatus = taskStatus.Status } - - processStatus = taskStatus.Status } si := &SandboxInfo{