containerd/cmd/containerd-shim-runc-v2/task
Laura Brehm 421a4b568c
runc-shim: handle pending execs as running
This commit rewrites and simplifies a lot of this logic to reduce it's
complexity, and also handle the case where the container doesn't have
it's own pid-namespace, which means that we're not guaranteed to receive
the init exit last.

This is achieved by replacing `s.pendingExecs` with `s.runningExecs`,
for which both (previously) pending and de facto running execs are
considered.

The new exit handling logic can be summed up by:
- when we receive an init exit, stash it it in `s.containerInitExit`,
  and if a container's init process has exited, refuse new execs.
- (if the container does not have it's own pidns) kill all running
  processes (if the container has a private pid-namespace, then all
  processes will be dead already).
- wait for the container's running exec count (which includes execs
  which have been started but might still early exit) to get to 0.
- publish the stashed away init exit.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-04 11:47:12 +01:00
..
plugin Move shim package to pkg 2024-03-07 10:05:26 -08:00
service.go runc-shim: handle pending execs as running 2024-09-04 11:47:12 +01:00