From 673bfe15b5c0c8f7c696b4848945d2bc98ac4fe7 Mon Sep 17 00:00:00 2001 From: jokemanfire Date: Thu, 16 Jan 2025 10:15:09 +0800 Subject: [PATCH] When use crictl rmp -a -f, Avoid excessive coroutines causing context timeout Increase the maximum number of co processes limit Signed-off-by: jokemanfire --- cmd/crictl/sandbox.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/crictl/sandbox.go b/cmd/crictl/sandbox.go index cdc87dbfb2..3ccf9f7edc 100644 --- a/cmd/crictl/sandbox.go +++ b/cmd/crictl/sandbox.go @@ -166,8 +166,13 @@ var removePodCommand = &cli.Command{ } funcs := []func() error{} + // set max concurrency to 10, to avoid too many goroutines + maxConcurrency := 10 + sem := make(chan struct{}, maxConcurrency) for _, id := range ids { funcs = append(funcs, func() error { + sem <- struct{}{} + defer func() { <-sem }() resp, err := InterruptableRPC(nil, func(ctx context.Context) (*pb.PodSandboxStatusResponse, error) { return runtimeClient.PodSandboxStatus(ctx, id, false) })