Skip to content

Commit

Permalink
Make sure signalAllProcesses is invoked in the function of destroy
Browse files Browse the repository at this point in the history
It's expect that signalAllProcesses is invoked when container shares
pid namespace. share pid ns contains the following conditions:

{
    // no specify pid ns
}
{
    "type": "pid",
    "path": "/proc/${num}/ns/pid"
}

Signed-off-by: Shukui Yang <[email protected]>
Signed-off-by: Shukui Yang <[email protected]>
  • Loading branch information
keloyang authored and crosbymichael committed Sep 3, 2020
1 parent 09ddc63 commit cbb0a79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libcontainer/state_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ type containerState interface {
}

func destroy(c *linuxContainer) error {
if !c.config.Namespaces.Contains(configs.NEWPID) {
if !c.config.Namespaces.Contains(configs.NEWPID) ||
c.config.Namespaces.PathOf(configs.NEWPID) != "" {
if err := signalAllProcesses(c.cgroupManager, unix.SIGKILL); err != nil {
logrus.Warn(err)
}
Expand Down

0 comments on commit cbb0a79

Please sign in to comment.