containerd/patch/0071-containerd-fix-containerd-shim-residual-when-kill-co.patch
songyanting 19583b7229 containerd: update patches
0069-containerd-add-check-in-spec.patch
0070-containerd-kill-container-init-process-if-runc-start.patch
0071-containerd-fix-containerd-shim-residual-when-kill-co.patch
0072-containerd-fix-deadlock-on-commit-error.patch
0073-containerd-backport-upstream-patches.patch
0074-containerd-fix-exec-event-missing-due-to-pid-reuse.patch
0075-containerd-fix-dm-left-when-pause-contaienr-and-kill-shim.patch
0076-containerd-fix-start-container-failed-with-id-exists.patch
0077-containerd-drop-opt-package.patch
0078-containerd-bump-containerd-ttrpc-699c4e40d1.patch
0079-containerd-fix-race-access-for-mobySubcribed.patch
0080-containerd-improve-log-for-debugging.patch
0081-containerd-reduce-permissions-for-bundle-di.patch
0082-containerd-fix-publish-command-wait-block-for.patch
0083-containerd-optimize-cgo-compile-options.patch

Signed-off-by:songyanting <songyanting@huawei.com>
2022-01-26 20:03:57 +08:00

46 lines
1.7 KiB
Diff

From 5d72fe2c0d6774e94cad6feacec87db703104fe7 Mon Sep 17 00:00:00 2001
From: xiadanni <xiadanni1@huawei.com>
Date: Fri, 19 Feb 2021 16:37:48 +0800
Subject: [PATCH] containerd: fix containerd-shim residual when kill containerd
during starting container
after shim process started, containerd will write shim socket address
to address file, but if containerd is killed before write file, new
containerd process could not get shim socket address, and will not
kill it even if that shim could not work.
so we write address file ahead of starting shim process.
Signed-off-by: xiadanni <xiadanni1@huawei.com>
---
runtime/v1/shim/client/client.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/runtime/v1/shim/client/client.go b/runtime/v1/shim/client/client.go
index 9e63af4..bc9ac92 100644
--- a/runtime/v1/shim/client/client.go
+++ b/runtime/v1/shim/client/client.go
@@ -92,6 +92,10 @@ func WithStart(binary, address, daemonAddress, cgroup string, debug bool, exitHa
go io.Copy(os.Stderr, stderrLog)
}
+ if err := writeFile(filepath.Join(config.Path, "address"), address); err != nil {
+ return nil, nil, err
+ }
+
cmd, err := newCommand(binary, daemonAddress, debug, config, f, stdoutLog, stderrLog)
if err != nil {
return nil, nil, err
@@ -122,9 +126,6 @@ func WithStart(binary, address, daemonAddress, cgroup string, debug bool, exitHa
"debug": debug,
}).Infof("shim %s started", binary)
- if err := writeFile(filepath.Join(config.Path, "address"), address); err != nil {
- return nil, nil, err
- }
if err := writeFile(filepath.Join(config.Path, "shim.pid"), strconv.Itoa(cmd.Process.Pid)); err != nil {
return nil, nil, err
}
--
1.8.3.1