-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime-config: Require serial hook execution #265
Conversation
Extend [1,2,3] to avoid: hook 1: spawn ---------------> reaped hook 2: spawn ----------------> reaped hook 3: spawn -----> reaped and explicitly require: hook 1: spawn --> reaped hook 2: spawn --> reaped hook 3: spawn --> reaped Folks who do want parallel execution are free to use a parallelizing wrapper: hook 1: spawn ---------------------------> reaped child 1 -----> reaped child 2 ---------> reaped child 3 ---> reaped Although that cuts both ways (with parallel hooks, folks could always use a single hook with a serializing wrapper). Still, I'd guess most current implementations are already taking the serialized approach, so it makes bundle-author life easier if we are explicit about that. [1]: opencontainers#20 (comment) [2]: opencontainers#156 [3]: opencontainers#157 Signed-off-by: W. Trevor King <[email protected]>
@@ -10,7 +10,7 @@ Presently there are `Prestart`, `Poststart` and `Poststop`. | |||
* [`Poststop`](#poststop) is a list of hooks to be run after the container process exits | |||
|
|||
Hooks allow one to run code before/after various lifecycle events of the container. | |||
Hooks MUST be called in the listed order. | |||
Hooks MUST be called in the listed order, with each hook process being reaped before the next hook is executed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this cause confusion if "each hook process" includes the child processes it creates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Thu, Dec 10, 2015 at 10:55:18PM -0800, Qiang Huang wrote:
-Hooks MUST be called in the listed order.
+Hooks MUST be called in the listed order, with each hook process being reaped before the next hook is executed.Wouldn't this cause confusion if "each hook process" includes the
child processes it creates?
What sort of confusion? If the hook wants to explicitly launch a
daemon or some such, I'm fine with:
—
hook 1: spawn ------> reaped
daemon------------------------------------------->
hook 2: spawn --> reaped
hook 3: spawn --> reaped
If folks are worried about hook-children surviving an early hook exit:
—
hook 1: spawn ------(died)-> reaped
child------------------------------------------->
hook 2: spawn --> reaped
hook 3: spawn --> reaped
we can require the runtime to be more shell-like and make a new
process group to contain the hooks (but this will start getting pretty
complicated).
Without some sort of rule about reaping, I don't see much gain to the
“Hooks MUST be called in the listed order” requirement. If they're
all spawned one after the other, you don't have any guarantees that
earlier hooks will have accomplished their task before later hooks are
run.
It might be easier to just separate ‘create’ (most of the container
setup) from ‘exec’ (process launch and possible PID namespace
creation) and ‘destroy’ (remove anything left-over from ‘create’) and
get out of the hook business altogether [1,2,3].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should take out reaped
from the suggested change.
I understand the scenario, it looks good, just wondering if the phrase "with each hook process being reaped" will make some users think the second hook needs to wait until all processes from the first hook are reaped. Because I do have this question when I first read this, maybe just me? |
On Mon, Dec 14, 2015 at 12:38:53AM -0800, Qiang Huang wrote:
Probably not just you ;). Would some more polished version of: |
I don't know, it looks complicated and still not clear enough, and I don't have a better suggestion TBH. Let's also wait for other maintainers' options. |
On Tue, Dec 15, 2015 at 01:24:01AM -0800, Qiang Huang wrote:
My issue here is that config authors who need serialized execution
If phrasing for serialization is too complicated (and we're |
Honestly, serial is the best guarantee without introducing a syntax like On Tue, Dec 15, 2015 at 11:10 AM, W. Trevor King [email protected]
|
On Tue, Dec 15, 2015 at 08:28:55AM -0800, Vincent Batts wrote:
That works for me, and it is where I'm going with the changes |
I am in favor of serial execution of plugins. I am confused about the "reaped" language though. It seems like saying "Hooks will be executed in order and the next hook won't be executed until the previous has exited". |
On Wed, Dec 16, 2015 at 08:46:16AM -0800, Brandon Philips wrote:
Reaped is one step past process-exit, when the zombie's entry is |
that is the fully implication of the current sentence. The act of waiting on a pid is an implementation detail. |
There is no need to tell people that they need to reap processes in the specification. |
On Wed, Jan 13, 2016 at 01:50:49PM -0800, Vincent Batts wrote:
I don't mind if the runtime decides to not collect the PID, but I Anyhow, I'm fine waiting on compliance testing to bring this back |
This drops all instances (outside the ChangeLog) turned up by case-insensitive searches for 'hook'. The desire to drop hooks has been around for a while now [1], but it took a while to land a create/start split. By the time that split did land, dropping hooks was still part of its motivation [2]. Hooks are hard to support robustly [3], and after the create/start split, callers can do whatever they like at those times without having to go through the runtime [4]. There is still a use-case for folks who prefer the old all-in-one UX, but we can support those folks with a higher-level wrapper built on hookless create/start primatives [5]. There was some last-minute discussion of pre-pivot mount propagation needing pre-start hooks [6], but that use case can be addressed by manipulating the mounts array [7]. With those arguments in place, the consensus at today's meeting seemed in favor of removing hooks from the spec [8]. [1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2015/opencontainers.2015-10-28-17.02.log.html#l-71 <wking> if you have a distinct create operation, you can drop the pre-start hooks, which makes a simpler spec [2]: opencontainers#384 Subject: Split create and start In the topic post: > # Motivating usecases: > > * to simplify the flows/interaction patterns by removing hooks, > but still allow for the same functionality [3]: opencontainers#265 Subject: runtime-config: Require serial hook execution [4]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/%23opencontainers.2016-03-24.log.html#t2016-03-24T18:56:15 <vishh> mrunalp: How do I run http hooks? I need a binary wrapper to execute http hooks [5]: https://groups.google.com/a/opencontainers.org/d/msg/dev/Y7p6YW8zr4s/OVaAI_WDBAAJ Subject: Re: Hooks and all-in-one operation Date: Wed, 1 Jun 2016 11:49:07 -0700 Message-ID: <[email protected]> [6]: opencontainers#384 (comment) Subject: Split create and start [7]: opencontainers#384 (comment) Subject: Split create and start [8]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-06-01-17.01.log.html#l-83 Signed-off-by: W. Trevor King <[email protected]>
This drops all instances (outside the ChangeLog) turned up by case-insensitive searches for 'hook'. The desire to drop hooks has been around for a while now [1], but it took a while to land a create/start split. By the time that split did land, dropping hooks was still part of its motivation [2]. Hooks are hard to support robustly [3], and after the create/start split, callers can do whatever they like at those times without having to go through the runtime [4]. There is still a use-case for folks who prefer the old all-in-one UX, but we can support those folks with a higher-level wrapper built on hookless create/start primatives [5]. There was some last-minute discussion of pre-pivot mount propagation needing pre-start hooks [6], but that use case can be addressed by manipulating the mounts array [7]. With those arguments in place, the consensus at today's meeting seemed in favor of removing hooks from the spec [8]. And after some second-guessing [9], we're now back in favor of removing hooks from the spec [10]. [1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2015/opencontainers.2015-10-28-17.02.log.html#l-71 <wking> if you have a distinct create operation, you can drop the pre-start hooks, which makes a simpler spec [2]: opencontainers#384 Subject: Split create and start In the topic post: > # Motivating usecases: > > * to simplify the flows/interaction patterns by removing hooks, > but still allow for the same functionality [3]: opencontainers#265 Subject: runtime-config: Require serial hook execution [4]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/%23opencontainers.2016-03-24.log.html#t2016-03-24T18:56:15 <vishh> mrunalp: How do I run http hooks? I need a binary wrapper to execute http hooks [5]: https://groups.google.com/a/opencontainers.org/d/msg/dev/Y7p6YW8zr4s/OVaAI_WDBAAJ Subject: Re: Hooks and all-in-one operation Date: Wed, 1 Jun 2016 11:49:07 -0700 Message-ID: <[email protected]> [6]: opencontainers#384 (comment) Subject: Split create and start [7]: opencontainers#384 (comment) Subject: Split create and start [8]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-06-01-17.01.log.html#l-83 [9]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/Y7p6YW8zr4s Subject: Hooks and all-in-one operation Date: Wed, 1 Jun 2016 11:38:27 -0700 Message-ID: <CANEZBD69Q4VV4UoBodWjtAR1PrJ1OysaMUHgA5cW_aGj2ZEhLQ@mail.gmail.com> [10]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-08-03-21.01.log.html#l-21 Signed-off-by: W. Trevor King <[email protected]>
Now that we've decided to keep hooks and closed #483, I think we want
|
Extend #157 to avoid:
and explicitly require:
Folks who do want parallel execution are free to use a parallelizing
wrapper:
Although that cuts both ways (with parallel hooks, folks could always
use a single hook with a serializing wrapper). Still, I'd guess most
current implementations are already taking the serialized approach, so
it makes bundle-author life easier if we are explicit about that.