Forráskód Böngészése

daemon: identify container exits by ProcessID

The Pid field of an exit event cannot be relied upon to differentiate
exits of the container's task from exits of other container processes,
i.e. execs. The Pid is reported by the runtime and is implementation-
defined so there is no guarantee that a task's pid is distinct from the
pids of any other process in the same container. In particular,
kata-containers reports the pid of the hypervisor for all exit events.
ContainerD guarantees that the process ID of a task is set to the
corresponding container ID, so use that invariant to distinguish task
exits from other process exits.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 2 éve
szülő
commit
0e4d3feb94
1 módosított fájl, 1 hozzáadás és 1 törlés
  1. 1 1
      daemon/monitor.go

+ 1 - 1
daemon/monitor.go

@@ -156,7 +156,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei
 
 		daemon.LogContainerEvent(c, "oom")
 	case libcontainerdtypes.EventExit:
-		if int(ei.Pid) == c.Pid {
+		if ei.ProcessID == ei.ContainerID {
 			return daemon.handleContainerExit(c, &ei)
 		}