Skip to content

Fixes #38978 should kill all children process when delete the task#38980

Closed
lifubang wants to merge 1 commit intomoby:masterfrom
lifubang:killallintaskdelete
Closed

Fixes #38978 should kill all children process when delete the task#38980
lifubang wants to merge 1 commit intomoby:masterfrom
lifubang:killallintaskdelete

Conversation

@lifubang
Copy link
Copy Markdown
Contributor

Signed-off-by: Lifubang [email protected]

- What I did
Since containerd v1.2.0-rc.0, if we use PIDNamespace, the shim service will not call runc KillAll method to kill all the children process when the container's main process exited.
So, it will cause the issue #38978.

- How I did it
To fixes #38978 , we should call KillAll when DeleteTask. It is safe because there were no two containers with the same cgroup path.
As discussed in containerd/containerd#3149 , we may not remove pidnamespace check because containerd should support containers with the same cgroup path.

- How to verify it
The container with the same pid namespace can be stopped.

- Description for the changelog
add containerd.WithProcessKill when delete a task in containerd.

@thaJeztah
Copy link
Copy Markdown
Member

ping @dmcgowan @crosbymichael PTAL (also the discussion on containerd/containerd#3149)

@lifubang
Copy link
Copy Markdown
Contributor Author

lifubang commented Apr 2, 2019

I think we may not wait containerd/containerd#3149 , because it is used to fix who use libcontainerd by themselves, of course include docker.
If there were no two containers using the same cgroup path in docker, I think this PR in Moby can move on if there were no other impact, because it can fix such cases forever.
And the PR containerd/containerd#3149 will not be able to impact this PR no matter whether 3149 be merged in contaierd or not.
And I also agree with we should have a full discussion.

@lifubang
Copy link
Copy Markdown
Contributor Author

lifubang commented Apr 3, 2019

If someone worry about this patch. I think we can use containerd.WithProcessKill by passing some flags as follows:
docker kill -a ...: send signal to all processes inside the container
docker stop -a ...: stop by send signal to all processes inside the container
docker restart -a ...: restart by send signal to all processes inside the container
docker rm -a ...: rm a container by send signal to all processes inside the container
Just like ctr t kill -a ...

And don't make containerd shim service stuck at any time. Please see containerd/containerd#3168

@cpuguy83
Copy link
Copy Markdown
Member

Can you explain, is this still needed now that we've bumped to containerd 1.2.7?

@cpuguy83
Copy link
Copy Markdown
Member

Also, can we add a test case for shared pid ns?

@coolljt0725
Copy link
Copy Markdown
Contributor

@lifubang need rebase

@coolljt0725
Copy link
Copy Markdown
Contributor

@lifubang Are you still working on this? Is this still needed

@thaJeztah thaJeztah added the kind/bugfix PR's that fix bugs label Oct 10, 2019
@crosbymichael
Copy link
Copy Markdown
Contributor

I think this can be closed as there have been a few patches in containerd regarding this issue.
If i'm mistaken, please let me know.

Thanks!

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.

docker cannot terminate a container when processes linger after TERM

8 participants