From 9f71f40e9fa1e69680d27fb58a73fcaba366876f Mon Sep 17 00:00:00 2001 From: liuzekun Date: Fri, 10 Apr 2020 10:57:49 +0800 Subject: [PATCH 1/2] docker: 'delete event' is not need to process in daemon processEvent Signed-off-by: liuzekun --- VERSION-openeuler | 2 +- docker-engine-openeuler.spec | 2 +- ...-delete-event-is-not-need-to-process.patch | 27 +++++++++++++++++++ series.conf | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 patch/0162-docker-delete-event-is-not-need-to-process.patch diff --git a/VERSION-openeuler b/VERSION-openeuler index 9ce0e89..fa1cead 100644 --- a/VERSION-openeuler +++ b/VERSION-openeuler @@ -1 +1 @@ -18.09.0.102 +18.09.0.103 diff --git a/docker-engine-openeuler.spec b/docker-engine-openeuler.spec index cb4eaec..9098317 100644 --- a/docker-engine-openeuler.spec +++ b/docker-engine-openeuler.spec @@ -1,6 +1,6 @@ Name: docker-engine Version: 18.09.0 -Release: 102 +Release: 103 Summary: The open-source application container engine Group: Tools/Docker diff --git a/patch/0162-docker-delete-event-is-not-need-to-process.patch b/patch/0162-docker-delete-event-is-not-need-to-process.patch new file mode 100644 index 0000000..fef6e36 --- /dev/null +++ b/patch/0162-docker-delete-event-is-not-need-to-process.patch @@ -0,0 +1,27 @@ +From 0fe29ca9d45ddcb36f009a8da5f858f49a8e2844 Mon Sep 17 00:00:00 2001 +From: liuzekun +Date: Wed, 8 Apr 2020 17:32:03 +0800 +Subject: [PATCH] docker: delete event is not need to access processEvent + +reason: delete event is not need to access processEvent, continue it + +Signed-off-by: liuzekun +--- + components/engine/libcontainerd/client_daemon.go | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/components/engine/libcontainerd/client_daemon.go b/components/engine/libcontainerd/client_daemon.go +index 858d6429..05c439c5 100755 +--- a/components/engine/libcontainerd/client_daemon.go ++++ b/components/engine/libcontainerd/client_daemon.go +@@ -895,6 +895,7 @@ func (c *client) processEventStream(ctx context.Context, ns string) { + "ExitStatus": t.ExitStatus, + "ExitedAt": t.ExitedAt, + }).Infof("event") ++ continue + default: + c.logger.WithFields(logrus.Fields{ + "topic": ev.Topic, +-- +2.19.1 + diff --git a/series.conf b/series.conf index dc86577..d8ce86d 100644 --- a/series.conf +++ b/series.conf @@ -157,3 +157,4 @@ patch/0158-docker-support-private-registry.patch patch/0159-docker-extend-timeout-in-cli-testcases.patch patch/0160-docker-create-a-soft-link-from-runtime-default-to-ru.patch patch/0161-docker-Delete-stale-containerd-object-on-start-f.patch +patch/0162-docker-delete-event-is-not-need-to-process.patch -- Gitee From c0d5f8afd599a93a1b27b6d4f5c1abf941e8da02 Mon Sep 17 00:00:00 2001 From: liuzekun Date: Fri, 10 Apr 2020 17:08:21 +0800 Subject: [PATCH 2/2] docker: check whether exit file is exist before kill process directly kill process directly should check whether exit file is exist already, for avoid kill the new process which reused this pid Signed-off-by: liuzekun --- VERSION-openeuler | 2 +- docker-engine-openeuler.spec | 2 +- ...ess-exit-file-when-kill-process-dire.patch | 36 +++++++++++++++++++ series.conf | 1 + 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch diff --git a/VERSION-openeuler b/VERSION-openeuler index fa1cead..7c351c9 100644 --- a/VERSION-openeuler +++ b/VERSION-openeuler @@ -1 +1 @@ -18.09.0.103 +18.09.0.104 diff --git a/docker-engine-openeuler.spec b/docker-engine-openeuler.spec index 9098317..5a700de 100644 --- a/docker-engine-openeuler.spec +++ b/docker-engine-openeuler.spec @@ -1,6 +1,6 @@ Name: docker-engine Version: 18.09.0 -Release: 103 +Release: 104 Summary: The open-source application container engine Group: Tools/Docker diff --git a/patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch b/patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch new file mode 100644 index 0000000..4fbb7de --- /dev/null +++ b/patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch @@ -0,0 +1,36 @@ +From 3f285224ade14c9d64dfc81cf9b5d969343a641e Mon Sep 17 00:00:00 2001 +From: liuzekun +Date: Wed, 8 Apr 2020 19:49:38 +0800 +Subject: [PATCH] docker: stat process exit file when kill process directly + +reason: stat process exit file when kill process directly + +Signed-off-by: liuzekun +--- + components/engine/daemon/container_operations_unix.go | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/components/engine/daemon/container_operations_unix.go b/components/engine/daemon/container_operations_unix.go +index 2cc2b2e3..df2f3261 100644 +--- a/components/engine/daemon/container_operations_unix.go ++++ b/components/engine/daemon/container_operations_unix.go +@@ -346,6 +346,16 @@ func killProcessDirectly(cntr *container.Container) error { + // Ensure that we don't kill ourselves + if pid := cntr.GetPID(); pid != 0 { + logrus.Infof("Container %s failed to exit within 10 seconds of kill - trying direct SIGKILL", stringid.TruncateID(cntr.ID)) ++ pattern := fmt.Sprintf("/var/run/docker/containerd/exit/moby/%s.%d.*", cntr.ID, pid) ++ efiles, err := filepath.Glob(pattern) ++ if err != nil { ++ logrus.Warnf("Match exit file with pattern %q failed: %s", pattern, err.Error()) ++ } ++ if len(efiles) != 0 { ++ logrus.Infof("Find process exit files with pattern %q: %+v, skip force kill because the process is exit already", pattern, efiles) ++ return errNoSuchProcess{pid, 9} ++ } ++ + if err := unix.Kill(pid, 9); err != nil { + if err != unix.ESRCH { + return err +-- +2.19.1 + diff --git a/series.conf b/series.conf index d8ce86d..4fe3e7e 100644 --- a/series.conf +++ b/series.conf @@ -158,3 +158,4 @@ patch/0159-docker-extend-timeout-in-cli-testcases.patch patch/0160-docker-create-a-soft-link-from-runtime-default-to-ru.patch patch/0161-docker-Delete-stale-containerd-object-on-start-f.patch patch/0162-docker-delete-event-is-not-need-to-process.patch +patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch -- Gitee