From 610498df750c3b30b137ddb4ab236e5b0a84ceda Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 3 Jul 2024 17:13:31 -0400 Subject: [PATCH] Fix for `[cri] ttrpc: closed` during ListPodSandboxStats Signed-off-by: Davanum Srinivas --- pkg/cri/server/sandbox_stats_list.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cri/server/sandbox_stats_list.go b/pkg/cri/server/sandbox_stats_list.go index 7757925c5f99..4e070bddc279 100644 --- a/pkg/cri/server/sandbox_stats_list.go +++ b/pkg/cri/server/sandbox_stats_list.go @@ -18,11 +18,13 @@ package server import ( "context" + "errors" "fmt" sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox" "github.com/containerd/errdefs" "github.com/containerd/log" + "github.com/containerd/ttrpc" runtime "k8s.io/cri-api/pkg/apis/runtime/v1" "github.com/hashicorp/go-multierror" @@ -42,6 +44,8 @@ func (c *criService) ListPodSandboxStats( switch { case errdefs.IsUnavailable(err), errdefs.IsNotFound(err): log.G(ctx).WithField("podsandboxid", sandbox.ID).Debugf("failed to get pod sandbox stats, this is likely a transient error: %v", err) + case errors.Is(err, ttrpc.ErrClosed): + log.G(ctx).WithField("podsandboxid", sandbox.ID).Debugf("failed to get pod sandbox stats, connection closed: %v", err) case err != nil: errs = multierror.Append(errs, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err)) default: