From e2e59b6e5624634d6c1623e39ac65c57beed754e Mon Sep 17 00:00:00 2001 From: jikui Date: Fri, 19 Nov 2021 17:24:07 +0800 Subject: [PATCH] kata-runtime: increase delete cgroup retry times Signed-off-by: jikui --- kata-containers.spec | 8 ++- ...s-increase-delete-cgroup-retry-times.patch | 63 +++++++++++++++++++ series.conf | 1 + 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 patches/0013-kata-containers-increase-delete-cgroup-retry-times.patch diff --git a/kata-containers.spec b/kata-containers.spec index 0bc9ba6..f80360d 100644 --- a/kata-containers.spec +++ b/kata-containers.spec @@ -2,7 +2,7 @@ %global debug_package %{nil} %define VERSION 2.1.0 -%define RELEASE 9 +%define RELEASE 10 Name: kata-containers Version: %{VERSION} @@ -108,6 +108,12 @@ strip %{buildroot}/usr/bin/containerd-shim-kata-v2 %doc %changelog +* Fri Nov 24 2021 jikui - 2.1.0-10 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:increase delete cgroup retry times + * Sat Nov 20 2021 yangfeiyu - 2.1.0-9 - Type:bugfix - ID:NA diff --git a/patches/0013-kata-containers-increase-delete-cgroup-retry-times.patch b/patches/0013-kata-containers-increase-delete-cgroup-retry-times.patch new file mode 100644 index 0000000..fdd1677 --- /dev/null +++ b/patches/0013-kata-containers-increase-delete-cgroup-retry-times.patch @@ -0,0 +1,63 @@ +From 13aec526360797b3bce776f35b7e5f5976961b47 Mon Sep 17 00:00:00 2001 +From: jikui +Date: Fri, 5 Nov 2021 11:46:17 +0800 +Subject: [PATCH 4/8] kata-runtime: increase delete cgroup retry times + +Signed-off-by: jikui +--- + .../vendor/github.com/containerd/cgroups/cgroup.go | 4 ++-- + .../vendor/github.com/containerd/cgroups/utils.go | 9 ++++++--- + 2 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/src/runtime/vendor/github.com/containerd/cgroups/cgroup.go b/src/runtime/vendor/github.com/containerd/cgroups/cgroup.go +index 5386668..69612b0 100644 +--- a/src/runtime/vendor/github.com/containerd/cgroups/cgroup.go ++++ b/src/runtime/vendor/github.com/containerd/cgroups/cgroup.go +@@ -223,7 +223,7 @@ func (c *cgroup) Delete() error { + return err + } + if err := d.Delete(sp); err != nil { +- errors = append(errors, string(s.Name())) ++ errors = append(errors, fmt.Sprintf("delete %s get error: %v", string(s.Name()), err.Error())) + } + continue + } +@@ -234,7 +234,7 @@ func (c *cgroup) Delete() error { + } + path := p.Path(sp) + if err := remove(path); err != nil { +- errors = append(errors, path) ++ errors = append(errors, fmt.Sprintf("remove path %s get error: %v", path, err.Error())) + } + } + } +diff --git a/src/runtime/vendor/github.com/containerd/cgroups/utils.go b/src/runtime/vendor/github.com/containerd/cgroups/utils.go +index 8a97d04..82dbe2d 100644 +--- a/src/runtime/vendor/github.com/containerd/cgroups/utils.go ++++ b/src/runtime/vendor/github.com/containerd/cgroups/utils.go +@@ -99,16 +99,19 @@ func defaults(root string) ([]Subsystem, error) { + // retrying the remove after a exp timeout + func remove(path string) error { + delay := 10 * time.Millisecond +- for i := 0; i < 5; i++ { ++ var err error ++ var count int = 0 ++ for i := 0; i < 10; i++ { + if i != 0 { + time.Sleep(delay) + delay *= 2 + } +- if err := os.RemoveAll(path); err == nil { ++ if err = os.RemoveAll(path); err == nil { + return nil + } ++ count++ + } +- return fmt.Errorf("cgroups: unable to remove path %q", path) ++ return fmt.Errorf("cgroups: unable to remove path %q, err: %v, count:%d", path, err, count) + } + + // readPids will read all the pids of processes in a cgroup by the provided path +-- +2.25.1 + diff --git a/series.conf b/series.conf index 45b45f4..387dcf2 100644 --- a/series.conf +++ b/series.conf @@ -10,3 +10,4 @@ 0010-kata-containers-fix-kata-runtime-skip-read-lines-in-pro.patch 0011-kata-containers-keep-the-process-name-of-qemu-same-as-c.patch 0012-kata-containers-modify-kernel-and-image-path-in-conf.patch +0013-kata-containers-increase-delete-cgroup-retry-times.patch -- Gitee