Skip to content

Conversation

cyphar
Copy link
Contributor

@cyphar cyphar commented Dec 30, 2016

In later versions of runC, runc kill requires the signal parameter
to know what signal needs to be sent.

Signed-off-by: Aleksa Sarai asarai@suse.com

oci/oci.go Outdated
c.opLock.Lock()
defer c.opLock.Unlock()
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "kill", c.name); err != nil {
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "kill", c.name, "KILL"); err != nil {
Copy link

Choose a reason for hiding this comment

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

Is this sending a SIGKILL to the container? If so, it seems more "polite" to send a SIGINT first, to give the application time to clean up, before sending SIGKILL to forcibly kill the processes. Is a forcible/uncatchable termination signal required per the CRI spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The old code used to send SIGKILL. I'm just making it so that the code actually works. If you want to fix the behaviour, we can discuss that separately.

If so, it seems more "polite" to send a SIGINT first, to give the application time to clean up,

Did you mean SIGTERM? SIGINT is for <c-c> interrupts, and usually isn't handled gracefully by daemons.

Copy link

Choose a reason for hiding this comment

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

Makes sense, this change LGTM then. +1 on making this work as intended, will open an issue to discuss whether the current behavior is still what we want.

Did you mean SIGTERM?

Yeah, I guess so - anything kinder than terminating the process with extreme prejudice ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😉

Copy link

Choose a reason for hiding this comment

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

Opened #306

Copy link
Member

Choose a reason for hiding this comment

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

@cyphar My intention in the original code was to sent TERM first and then send KILL if the process is still around after 10 ms. Maybe we could adjust that time or make it configurable but we should send TERM first.

@runcom
Copy link
Member

runcom commented Dec 30, 2016

LGTM, @mrunalp PTAL and merge if it's ok for you as well

In later versions of runC, `runc kill` *requires* the signal parameter
to know what signal needs to be sent.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
@jjlakis
Copy link

jjlakis commented Jan 2, 2017

LGTM

1 similar comment
@mrunalp
Copy link
Member

mrunalp commented Jan 2, 2017

LGTM

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

Successfully merging this pull request may close these issues.

6 participants