-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
state's status detection (based on PID lookups) is imprecise #871
Comments
One clever way of doing it is to |
On Mon, Jun 13, 2016 at 12:36:40PM -0700, Alexander Morozov wrote: #886 means that the imprecise check isn't a concern for ‘start’ |
@wking Yeah I think it's still a valid issue, I'll reopen it. |
Fixes: opencontainers#871 Signed-off-by: Qiang Huang <[email protected]>
Fixes: opencontainers#871 Signed-off-by: Qiang Huang <[email protected]>
Fixes: opencontainers#871 Signed-off-by: Qiang Huang <[email protected]>
config-linux: "may" -> "MAY" for supplying linux.devices
Since a few days ago, the runtime spec has a
status
property in the state (opencontainers/runtime-spec#462). I was curious about how that worked with detached containers, since there's no host-side monitor around to notice the container die. Testing with 1d61abe (the current tip of #827, although I expect this applies to all recent runC code), it looks like thestate
call works around the lack of a monitor (who could waitid(2) or some such on the container process) by looking up the container PID in /proc dynamically for eachstate
call. That's racy though, since “has the same PID in /proc” doesn't mean “is the same process”. For example:In a separate terminal, spawn processes until we match the old container PID:
And then runC thinks (wrongly) that the container is alive again:
One solution is to have the parent process (or an ancestor with
PR_SET_CHILD_SUBREAPER
after the parent dies) waitid(2) on the container process.Another solution is to store more information about the container process (we probably already do) and compare that additional data when deciding whether the process running with the container-process PID was still the container process. For example, the PID and start-time (field 22 in
/proc/[pid]/stat
) form a tuple that is almost certainly unique.The text was updated successfully, but these errors were encountered: