docker: Add an ExitPid field for State struct to record exit process id
fix #I5OBUW
This commit is contained in:
parent
72ff37aec5
commit
214570099c
@ -1 +1 @@
|
||||
18.09.0.307
|
||||
18.09.0.308
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: docker-engine
|
||||
Version: 18.09.0
|
||||
Release: 307
|
||||
Release: 308
|
||||
Summary: The open-source application container engine
|
||||
Group: Tools/Docker
|
||||
|
||||
@ -212,6 +212,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Sep 13 2022 chenjiankun<chenjiankun1@huawei.com> - 18.09.0-308
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:Add an ExitPid field for State struct to record exit process id
|
||||
|
||||
* Tue Sep 13 2022 chenjiankun<chenjiankun1@huawei.com> - 18.09.0-307
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
@ -1 +1 @@
|
||||
2cd0f3c6c09e973e3f65dc0051f4fdebe2349fb4
|
||||
385c3a952ec017d7fadb9ec83983f8284bb35eb2
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
From ebe1a56fb28e7de7128167973a99061e6aa0222a Mon Sep 17 00:00:00 2001
|
||||
From: chenjiankun <chenjiankun1@huawei.com>
|
||||
Date: Thu, 7 Jul 2022 10:18:03 +0800
|
||||
Subject: [PATCH] docker: Add an ExitPid field for State struct to record exit
|
||||
process id
|
||||
|
||||
---
|
||||
components/engine/container/state.go | 1 +
|
||||
components/engine/daemon/monitor.go | 4 ++++
|
||||
2 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/components/engine/container/state.go b/components/engine/container/state.go
|
||||
index da19cc49e..292b0ec0b 100644
|
||||
--- a/components/engine/container/state.go
|
||||
+++ b/components/engine/container/state.go
|
||||
@@ -27,6 +27,7 @@ type State struct {
|
||||
RemovalInProgress bool // Not need for this to be persistent on disk.
|
||||
Dead bool
|
||||
Pid int
|
||||
+ ExitPid uint32 // record exit process id.
|
||||
ExitCodeValue int `json:"ExitCode"`
|
||||
ErrorMsg string `json:"Error"` // contains last known error during container start, stop, or remove
|
||||
StartedAt time.Time
|
||||
diff --git a/components/engine/daemon/monitor.go b/components/engine/daemon/monitor.go
|
||||
index a5c7ff5c8..89c05f3da 100644
|
||||
--- a/components/engine/daemon/monitor.go
|
||||
+++ b/components/engine/daemon/monitor.go
|
||||
@@ -57,6 +57,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc
|
||||
|
||||
daemon.LogContainerEvent(c, "oom")
|
||||
case libcontainerd.EventExit:
|
||||
+ c.ExitPid = ei.Pid
|
||||
if int(ei.Pid) == c.Pid {
|
||||
logrus.Infof("handle container %s exit event pid=%d", c.ID, c.Pid)
|
||||
c.Lock()
|
||||
@@ -169,6 +170,9 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc
|
||||
|
||||
// This is here to handle start not generated by docker
|
||||
if !c.Running {
|
||||
+ if c.ExitPid == ei.Pid && time.Now().UTC().Sub(c.FinishedAt).Seconds() < 3 {
|
||||
+ return nil
|
||||
+ }
|
||||
c.SetRunning(int(ei.Pid), false)
|
||||
c.HasBeenManuallyStopped = false
|
||||
c.HasBeenStartedBefore = true
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -227,4 +227,5 @@ patch/0226-docker-chrootarchive-don-t-create-parent-dirs-outside-of-ch.patch
|
||||
patch/0227-docker-Lock-down-docker-root-dir-perms.patch
|
||||
patch/0228-docker-registry-ensure-default-auth-config-has-address.patch
|
||||
patch/0229-docker-fix-terminal-abnormal-after-docker-run.patch
|
||||
patch/0230-docker-Add-an-ExitPid-field-for-State-struct-to-reco.patch
|
||||
#end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user