From a9b3f084eea7bd5901b285139365d8681707d1b4 Mon Sep 17 00:00:00 2001 From: dongyuzhen Date: Wed, 23 Jul 2025 11:42:22 +0800 Subject: [PATCH] fix dead loop --- containerd.spec | 8 ++++++- git-commit | 2 +- patch/0043-containerd-fix-dead-loop.patch | 27 +++++++++++++++++++++++ series.conf | 1 + 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 patch/0043-containerd-fix-dead-loop.patch diff --git a/containerd.spec b/containerd.spec index 6810093..010a078 100644 --- a/containerd.spec +++ b/containerd.spec @@ -2,7 +2,7 @@ %global debug_package %{nil} Version: 1.6.22 Name: containerd -Release: 20 +Release: 21 Summary: An industry-standard container runtime License: ASL 2.0 URL: https://containerd.io @@ -68,6 +68,12 @@ install -D -p -m 0644 %{S:7} %{buildroot}%{_sysconfdir}/containerd/config.toml %exclude %{_bindir}/containerd-stress %changelog +* Wed Jul 23 2025 dongyuzhen - 1.6.22-21 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix dead loop + * Tue Jul 22 2025 dongyuzhen - 1.6.22-20 - Type:bugfix - ID:NA diff --git a/git-commit b/git-commit index 19b166a..cd8ad28 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -c348b5745e13bc7873ac8a960e4fb9a4405263d6 +ce9edd5049a834b799e3f343f42e4e4fa89adc9d diff --git a/patch/0043-containerd-fix-dead-loop.patch b/patch/0043-containerd-fix-dead-loop.patch new file mode 100644 index 0000000..c9a3806 --- /dev/null +++ b/patch/0043-containerd-fix-dead-loop.patch @@ -0,0 +1,27 @@ +From f6a17df6cdaeb9ae1474b2dfc43ff52026608ef4 Mon Sep 17 00:00:00 2001 +From: zhongjiawei +Date: Fri, 4 Jul 2025 16:36:42 +0800 +Subject: [PATCH] containerd: fix dead loop + +when we kill shim process,will attach shim pid to wait shim exit +successful. However, if a new process reuses the pid of the shim process after the shim process exits before attach, it will cause dead loop. +--- + runtime/v1/shim/client/client.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/runtime/v1/shim/client/client.go b/runtime/v1/shim/client/client.go +index fdbc1964..ef6fea13 100644 +--- a/runtime/v1/shim/client/client.go ++++ b/runtime/v1/shim/client/client.go +@@ -433,7 +433,7 @@ func (c *Client) waitForExit(ctx context.Context, pid int) <-chan struct{} { + ticker := time.NewTicker(10 * time.Millisecond) + defer ticker.Stop() + +- for { ++ for i := 0; i < 1000; i++ { + // use kill(pid, 0) here because the shim could have been reparented + // and we are no longer able to waitpid(pid, ...) on the shim + if err := unix.Kill(pid, 0); err == unix.ESRCH { +-- +2.33.0 + diff --git a/series.conf b/series.conf index b6d6e34..5c2a0f7 100644 --- a/series.conf +++ b/series.conf @@ -39,3 +39,4 @@ patch/0039-containerd-client-fix-returned-error-in-the-defer-function.patch patch/0040-containerd-do-not-report-error-log-when-skip-otlp-pl.patch patch/0041-containerd-execute-delayKill-when-fd-is-exhausted.patch patch/0042-containerd-delete-task-asynchronously-to-avoid-conta.patch +patch/0043-containerd-fix-dead-loop.patch -- Gitee