-
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: Replace "process is stopped" with "process exits" #465
Conversation
Looks fine. Needs rebase. |
* `running` : the container has been created and the user-specified code is running | ||
* `stopped` : the container has been created and the user-specified code has been executed but is no longer running | ||
* `created` : the container process has neither exited nor executed the user-specified code | ||
* `running` : the container process has executed the user-specified code but has not exited |
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.
meaning of user-specified code
vs container process
here seems confusing to me. For example, if container process
is some init piece of the runtime, does this mean that the init piece has to be run for the lifetime of the user process because stopped
only happens when the container process has exited ? Or did I understand this incorrectly ?
What do you think about replacing user-specified code
with container process
completely. Something like
* `created` : the container has been created but the container process has not yet been executed.
* `running`: the container process has been executed but has not exited.
* `stopped`: the container process has exited.
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 Wed, Jul 13, 2016 at 09:43:58AM -0700, Daniel, Dao Quang Minh wrote:
@@ -15,9 +15,9 @@ This MUST be unique across all containers on this host.
There is no requirement that it be unique across hosts.
status
: (string) is the runtime state of the container.
The value MAY be one of:
- *
created
: the container has been created but the user-specified code has not yet been executed- *
running
: the container has been created and the user-specified code is running- *
stopped
: the container has been created and the user-specified code has been executed but is no longer running- *
created
: the container process has neither exited nor executed the user-specified code- *
running
: the container process has executed the user-specified code but has not exitedmeaning of
user-specified code
vscontainer process
here seems
confusing to me.
This terminology issue is being hashed out in #466. Maybe we should
handle that first?
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.
* `stopped`: the container has been created and the user-specified code has been executed but is no longer running | ||
* `created`: the container process has neither exited nor executed the user-specified code | ||
* `running`: the container process has executed the user-specified code but has not exited | ||
* `stopped`: the container process has exited |
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.
Why remove the container has been created
phrase? I don't think that redundant, especially for the created
status.
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.
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.
It would be better to state that in the stopped state the container has ran the container's main process and it has exited leaving the container in the stopped state
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.
If create fails the container should be destroyed and will be by the runtimes.
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.
It would be better to state that in the stopped state the container has ran the container's main process…
This is not necessarily true, since the container process may have died during creation or between creation and the start
call.
If create fails the container should be destroyed and will be by the runtimes.
Agreed, but we need to define the status
passed to any post-stop hooks, which run after the container process exits. That happens even if the container process dies during creation.
* `created`: the container has been created but the user-specified code has not yet been executed | ||
* `running`: the container has been created and the user-specified code is running | ||
* `stopped`: the container has been created and the user-specified code has been executed but is no longer running | ||
* `created`: the container process has neither exited nor executed the user-specified code |
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.
Its not user-specified code
, we went over this many times.
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.
This is not a good description of the created state. The container is in a created state when it has been fully initialized but is not yet running the containers main process
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.
Its not user-specified code, we went over this many times.
As I pointed out after #466 was closed, all of the changes proposed by #466 are already live. So I'd rather keep the currently-live “user-specified code” language. If you feel like that language is unclear, adjusting to something else seems orthogonal to the stopped → exists fix that this PR is focused on. Maybe open a different PR?
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.
The container is in a created state when it has been fully initialized but is not yet running the containers main process.
#507 addresses this by adding a creating
state, and that seems orthogonal to the stopped → exists fix which I'm focusing on here. Until then, created
seems like the best stand in (a container being created is certainly not running
or stopped
).
* `running`: the container has been created and the user-specified code is running | ||
* `stopped`: the container has been created and the user-specified code has been executed but is no longer running | ||
* `created`: the container process has neither exited nor executed the user-specified code | ||
* `running`: the container process has executed the user-specified code but has not exited |
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.
container process not user-specified code
* `stopped`: the container has been created and the user-specified code has been executed but is no longer running | ||
* `created`: the container process has neither exited nor executed the user-specified code | ||
* `running`: the container process has executed the user-specified code but has not exited | ||
* `stopped`: the container process has exited |
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.
It would be better to state that in the stopped state the container has ran the container's main process and it has exited leaving the container in the stopped state
* `stopped`: the container has been created and the user-specified code has been executed but is no longer running | ||
* `created`: the container process has neither exited nor executed the user-specified code | ||
* `running`: the container process has executed the user-specified code but has not exited | ||
* `stopped`: the container process has exited |
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.
If create fails the container should be destroyed and will be by the runtimes.
5. The container's process is stopped. | ||
This MAY happen due to them erroring out, exiting, crashing or the runtime's [`kill`](runtime.md#kill) operation being invoked. | ||
5. The container process exits. | ||
This MAY happen due to erroring out, exiting, crashing or the runtime's [`kill`](runtime.md#kill) operation being invoked. |
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.
This is not correct as the runtime's kill command can sent non terminating signals.
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.
This is not correct as the runtime's kill command can sent non terminating signals.
I agree, but this MAY does not list all possible triggers nor does it require listed triggers to cause container exit. And it's the existing language and is orthogonal to the stopped → exited I'm focusing on here. Maybe file a new PR with your suggested wording?
proc(5) describes the following state entries in proc/[pid]/stat [1] (for modern kernels): * R Running * S Sleeping in an interruptible wait * D Waiting in uninterruptible disk sleep * Z Zombie * T Stopped (on a signal) * t Tracing stop * X Dead and ps(1) has a bit more context [2] (for modern kernels): * D uninterruptible sleep (usually IO) * R running or runnable (on run queue) * S interruptible sleep (waiting for an event to complete) * T stopped by job control signal * t stopped by debugger during the tracing * X dead (should never be seen) * Z defunct ("zombie") process, terminated but not reaped by its parent So I expect "stopped" to mean "process still exists but is paused, e.g. by SIGSTOP". And I expect "exited" to mean "process has finished and is either a zombie or dead". After this commit, 'git grep -i stop' only turns up the "stopped" state (which I've left alone for backwards compat), some poststop-hook stuff, a reference in principles.md, a "stoppage" in LICENSE, and some ChangeLog entries. Also replace "container's process" with "container process" to match usage in the rest of the repository. After this commit: $ git grep -i "container process" | wc -l 20 $ git grep -i "container's process" | wc -l 1 Also reword status entries to avoid "running", which is less precise in our spec (e.g. it also includes "sleeping", "waiting", ...). Also removes a "them" leftover from a partial plural -> singular reroll of be59415 (Split create and start, 2016-04-01, opencontainers#384). [1]: http://man7.org/linux/man-pages/man5/proc.5.html [2]: http://man7.org/linux/man-pages/man1/ps.1.html Signed-off-by: W. Trevor King <wking@tremily.us>
Rebased onto master with 7797b33 → 9eb32c0. Some of @crosbymichael's
concerns have been addressed in the meantime (e.g. by #629's “code” →
“program”), but some are still unresolved:
* Whether ‘created’ applies before the container is fully created [1].
My preferred approach to this is in #507, and until then I think we
should use ‘created’ as our best approximation [2].
* Whether ‘stopped’ should depend on the execution (or not) of the
user-specified program [3]. I think ‘stopped’ should also include
containers which have died during creation, etc. [4].
* Whether the list of possible terminators is exhaustive [5]. I think
it is not, and also think that wording is orthogonal to this PR [6].
I'm happy to dig into any of these outstanding points if my positions
are unclear or poorly motivated.
[1]: #465 (comment)
[2]: #465 (comment)
[3]: #465 (comment)
[4]: #465 (comment)
[5]: #465 (comment)
[6]: #465 (comment)
|
@crosbymichael PTAL |
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.
LGTM
@hqhq, @mrunalp, now that @crosbymichael has LGTMed this, do either of you want to re-approve it? |
proc(5) describes the following state entries in
proc/[pid]/stat
(for modern kernels):and ps(1) has a bit more context (for modern kernels):
parent
So I expect "stopped" to mean "process still exists but is paused,
e.g. by SIGSTOP". And I expect "exited" to mean "process has finished
and is either a zombie or dead".
After this commit,
git grep -i stop
only turns up poststop-hookstuff, a reference in principles.md, a "stoppage" in LICENSE, and some
ChangeLog entries.
This also replaces "container's process" with "container process" to
match usage in the rest of the repository. After this commit: