From 0e03a64f9956b237812ea11ecab83e1b05f025a0 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Jun 2022 14:41:04 +0200 Subject: pod: ps does not race with rm the "pod ps" command first retrieves the list of all pods, then iterates over the list to inspect each pod. This introduce a race since a pod could be deleted in the meanwhile by another process. Solve it by ignoring the define.ErrNoSuchPod error. Closes: https://github.com/containers/podman/issues/14736 Signed-off-by: Giuseppe Scrivano --- pkg/domain/infra/abi/pods.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 76b0676ed..1dca8c580 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -483,6 +483,9 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti for _, p := range pds { r, err := ic.listPodReportFromPod(p) if err != nil { + if errors.Is(err, define.ErrNoSuchPod) || errors.Is(err, define.ErrNoSuchCtr) { + continue + } return nil, err } reports = append(reports, r) -- cgit v1.2.3-54-g00ecf