Skip to content

remote kill: don't wait for the container to stop#7572

Merged
openshift-merge-robot merged 2 commits intocontainers:masterfrom
vrothberg:fix-7135
Sep 9, 2020
Merged

remote kill: don't wait for the container to stop#7572
openshift-merge-robot merged 2 commits intocontainers:masterfrom
vrothberg:fix-7135

Conversation

@vrothberg
Copy link
Copy Markdown
Member

Invert the branch logic to match the comment. Docker seems to wait for
the container while Podman does not.

Fixes: #7135
Signed-off-by: Valentin Rothberg rothberg@redhat.com

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 9, 2020
@edsantiago
Copy link
Copy Markdown
Member

Would you mind removing the "FIXME: pending #7135" skip in test/system/130-kill.bats? (I know it kills the elegance of a one-character patch, sorry!)

Invert the branch logic to match the comment.  Docker seems to wait for
the container while Podman does not.

Enable the remote-disabled system test as well.

Fixes: containers#7135
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
@vrothberg
Copy link
Copy Markdown
Member Author

Would you mind removing the "FIXME: pending #7135" skip in test/system/130-kill.bats? (I know it kills the elegance of a one-character patch, sorry!)

Done!

@jwhonce, the kill-wait code has been added with commit d924494 but I found no sign in docker that it would actually wait. Did the behaviour change over time?

@vrothberg
Copy link
Copy Markdown
Member Author

@jwhonce, the kill-wait code has been added with commit d924494 but I found no sign in docker that it would actually wait. Did the behaviour change over time?

Ah, Docker is only waiting on sigkill:

// ContainerKill sends signal to the container
// If no signal is given (sig 0), then Kill with SIGKILL and wait
// for the container to exit.
// If a signal is given, then just send it to the container and return.
func (daemon *Daemon) ContainerKill(name string, sig uint64) error {
        container, err := daemon.GetContainer(name)
        if err != nil {
                return err
        }

        if sig != 0 && !signal.ValidSignalForPlatform(syscall.Signal(sig)) {
                return fmt.Errorf("The %s daemon does not support signal %d", runtime.GOOS, sig)
        }

        // If no signal is passed, or SIGKILL, perform regular Kill (SIGKILL + wait())
        if sig == 0 || syscall.Signal(sig) == syscall.SIGKILL {
                return daemon.Kill(container)
        }
        return daemon.killWithSignal(container, int(sig))
}

@vrothberg
Copy link
Copy Markdown
Member Author

/hold

Let me fix that before

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 9, 2020
Docker does not wait unconditionally.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
@vrothberg
Copy link
Copy Markdown
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 9, 2020
// side of things and mimic that behavior
// Docker waits for the container to stop if the signal is 0 or
// SIGKILL.
if !utils.IsLibpodRequest(r) && (signal == 0 || syscall.Signal(signal) == syscall.SIGKILL) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why would signal=0 stop the container? I though signal==0 means just check if the PID exists?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

signal == 0 in docker terms means default which in turn is SIGKILL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's my understanding too: sig0 is never delivered to the target, it's only used as a check by calling code (for existence, also for EPERM). Good catch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Sep 9, 2020

LGTM

1 similar comment
@mheon
Copy link
Copy Markdown
Member

mheon commented Sep 9, 2020

LGTM

@mheon
Copy link
Copy Markdown
Member

mheon commented Sep 9, 2020

I'm going to hold/LGTM and hope tests go green.
/hold
/lgtm

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 9, 2020
@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Sep 9, 2020
@vrothberg
Copy link
Copy Markdown
Member Author

@mheon, can you /lgtm again. I accidentally added another commit on top but Cirrus is smart enough to cache results :)

@mheon
Copy link
Copy Markdown
Member

mheon commented Sep 9, 2020 via email

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2020
@vrothberg
Copy link
Copy Markdown
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 9, 2020
@openshift-merge-robot openshift-merge-robot merged commit 9c4c883 into containers:master Sep 9, 2020
@vrothberg vrothberg deleted the fix-7135 branch September 10, 2020 06:32
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

podman-remote: kill -s: hangs

6 participants