summaryrefslogtreecommitdiff
path: root/libpod/events
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-06-10 14:12:30 -0400
committerMatthew Heon <mheon@redhat.com>2021-06-10 14:17:41 -0400
commit62f4b0a1955853592c01310a2cf7e0ae041b9566 (patch)
treee3f2eb7cf3155760e4b0d9f878ec4f058dbcc1a2 /libpod/events
parent341e6a1628a35198500fcfc1bb65b377ff9b270b (diff)
downloadpodman-62f4b0a1955853592c01310a2cf7e0ae041b9566.tar.gz
podman-62f4b0a1955853592c01310a2cf7e0ae041b9566.tar.bz2
podman-62f4b0a1955853592c01310a2cf7e0ae041b9566.zip
Add ExecDied event and use it to retrieve exit codes
When making Exec Cleanup processes mandatory, I introduced a race wherein attached exec sessions could be cleaned up and removed by the cleanup process before the frontend had a chance to get their exit code. Fortunately, we've dealt with this issue before in containers, and the same solution can be applied here. I added an event for an exec session's process exiting, `exec_died` (Docker has an identical event, so this actually improves our compatibility there) that includes the exit code of the exec session. If the race happens and the exec session no longer exists when we go to remove it, pick up exit code from the event and exit cleanly. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/events')
-rw-r--r--libpod/events/config.go2
-rw-r--r--libpod/events/events.go2
2 files changed, 4 insertions, 0 deletions
diff --git a/libpod/events/config.go b/libpod/events/config.go
index 085fa9d52..d88d7b6e3 100644
--- a/libpod/events/config.go
+++ b/libpod/events/config.go
@@ -127,6 +127,8 @@ const (
Create Status = "create"
// Exec ...
Exec Status = "exec"
+ // ExecDied indicates that an exec session in a container died.
+ ExecDied Status = "exec_died"
// Exited indicates that a container's process died
Exited Status = "died"
// Export ...
diff --git a/libpod/events/events.go b/libpod/events/events.go
index 01ea6a386..e03215eff 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -149,6 +149,8 @@ func StringToStatus(name string) (Status, error) {
return Create, nil
case Exec.String():
return Exec, nil
+ case ExecDied.String():
+ return ExecDied, nil
case Exited.String():
return Exited, nil
case Export.String():