-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 - immediately kill all running processes when an init exit is processed, which works for both the shared and private pid-namespace cases (if a 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, or timeout - (in the case of timeout) remove all remaining running processes from `s.running`, so that late exits won't be published - thereby upholding the invariant that the init exit is the last exit published for a container. - publish the stashed away init exit The "timeout" mentioned here works in watchdog fashion - it only times out if there is no progress for the timeout duration. If a running process exits while waiting, the timer is reset. Signed-off-by: Laura Brehm <laurabrehm@hey.com>
- Loading branch information
Showing
1 changed file
with
133 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters