Skip to content

Commit

Permalink
Merge pull request #44892 from corhere/backport-23.0/fix-kata-exec-exit
Browse files Browse the repository at this point in the history
[23.0 backport] Fix exit-event handling for Kata runtime
  • Loading branch information
neersighted committed Feb 6, 2023
2 parents 7df2649 + 975bdb2 commit bacf32d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion daemon/monitor.go
Expand Up @@ -148,7 +148,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 == libcontainerdtypes.InitProcessName {
return daemon.handleContainerExit(c, &ei)
}

Expand Down
5 changes: 4 additions & 1 deletion libcontainerd/remote/client.go
Expand Up @@ -674,7 +674,7 @@ func (c *client) processEvent(ctx context.Context, et libcontainerdtypes.EventTy
}).Error("failed to process event")
}

if et == libcontainerdtypes.EventExit && ei.ProcessID != ei.ContainerID {
if et == libcontainerdtypes.EventExit && ei.ProcessID != libcontainerdtypes.InitProcessName {
p, err := c.getProcess(ctx, ei.ContainerID, ei.ProcessID)
if err != nil {

Expand Down Expand Up @@ -823,6 +823,9 @@ func (c *client) processEventStream(ctx context.Context, ns string) {
ExitCode: t.ExitStatus,
ExitedAt: t.ExitedAt,
}
if t.ID == t.ContainerID {
ei.ProcessID = libcontainerdtypes.InitProcessName
}
case *apievents.TaskOOM:
et = libcontainerdtypes.EventOOM
ei = libcontainerdtypes.EventInfo{
Expand Down

0 comments on commit bacf32d

Please sign in to comment.