Skip to content
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

Runc kill #178

Merged
merged 3 commits into from
Aug 4, 2015
Merged

Runc kill #178

merged 3 commits into from
Aug 4, 2015

Conversation

crosbymichael
Copy link
Member

Closes #176
Closes #124

This is a carry of #176 with fixed cross compile.

@rajasec thanks, i have you commits included in this PR.

rajasec added 2 commits August 3, 2015 16:12
Signed-off-by: rajasec <rajasec79@gmail.com>
Signed-off-by: rajasec <rajasec79@gmail.com>
@crosbymichael crosbymichael force-pushed the runc-kill branch 2 times, most recently from 4df6103 to 1f21f91 Compare August 4, 2015 18:28
if err == nil {
return syscall.Signal(s), nil
}
signal, ok := signalMap[strings.TrimPrefix(rawSignal, "SIG")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linux kill command also supports lowercase, so maybe strings.ToUpper first?

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
@crosbymichael
Copy link
Member Author

@LK4D4 added the ToUpper

@LK4D4
Copy link
Contributor

LK4D4 commented Aug 4, 2015

LGTM

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented Aug 4, 2015

LGTM

mrunalp pushed a commit that referenced this pull request Aug 4, 2015
@mrunalp mrunalp merged commit aa6aa41 into opencontainers:master Aug 4, 2015
@crosbymichael crosbymichael deleted the runc-kill branch August 4, 2015 19:31
@rajasec
Copy link
Contributor

rajasec commented Aug 5, 2015

@crosbymichael
Thanks

@apatil
Copy link

apatil commented Nov 16, 2015

What are the intended cleanup semantics of runc kill vs killing the container by killing its process 1? Should I expect runc to remove all kernel state that was set up to support the container in either case or both cases, and does it depend on which signal I send?

On version 48fdc50, when I did runc kill 9 root, I saw:

# runc start
ERRO[0019] Failed to remove paths: map[devices:/sys/fs/cgroup/devices/user/1000.user/22.session/root cpuacct:/sys/fs/cgroup/cpuacct/user/1000.user/22.session/root perf_event:/sys/fs/cgroup/perf_event/user/1000.user/22.session/root freezer:/sys/fs/cgroup/freezer/user/1000.user/22.session/root cpuset:/sys/fs/cgroup/cpuset/user/1000.user/22.session/root memory:/sys/fs/cgroup/memory/user/1000.user/22.session/root cpu:/sys/fs/cgroup/cpu/user/1000.user/22.session/root blkio:/sys/fs/cgroup/blkio/user/1000.user/22.session/root hugetlb:/sys/fs/cgroup/hugetlb/user/1000.user/22.session/root]

whereas when I did kill -KILL <pid>, with the pid of the process running in the container, I didn't see those messages.

As noted in #39, if I kill the runc process itself, /var/run/opencontainer/containers/root/state.json remains and runc start didn't work. That's an unclean shutdown, but in case it does happen, do I just need to remove state.json or is there kernel state that I need to clean up as well?

Thanks!

@rajasec
Copy link
Contributor

rajasec commented Nov 16, 2015

Removing state.json should suffice to start back the container.

@apatil
Copy link

apatil commented Nov 16, 2015

I just checked and it does suffice to start the cotnainer. It's really nice that only one simple action is required to get up and running again after an unclean shutdown.

Putting my question another way, after any of those shutdown scenarios, will there be cgroups, namespaces, mounts, network objects or other things left around? If so, is it possible that the leak will eventually cause problems?

@crosbymichael
Copy link
Member Author

runc kill should be the same semantics as doing a kill on the pid1 of the container. You really don't want to kill the runc process, only the process inside the container.

@apatil
Copy link

apatil commented Nov 17, 2015

OK, got it. As I noted in my comment above, it looks like runc kill is different than kill on pid1 at the moment.

When the runc process does happen to get killed, it would be very helpful if either runc automatically cleans up the next time it runs, or else there's some kind of runc cleanup command that lets me do it manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants