mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-19 05:44:35 +08:00
Merge pull request #3217 from kolyshkin/delete-paused
runc delete -f: fix for cg v1 + paused container
This commit is contained in:
@@ -393,6 +393,14 @@ func (c *linuxContainer) Signal(s os.Signal, all bool) error {
|
||||
if err := c.initProcess.signal(s); err != nil {
|
||||
return fmt.Errorf("unable to signal init: %w", err)
|
||||
}
|
||||
if status == Paused {
|
||||
// For cgroup v1, killing a process in a frozen cgroup
|
||||
// does nothing until it's thawed. Only thaw the cgroup
|
||||
// for SIGKILL.
|
||||
if s, ok := s.(unix.Signal); ok && s == unix.SIGKILL {
|
||||
_ = c.cgroupManager.Freeze(configs.Thawed)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return ErrNotRunning
|
||||
|
@@ -50,6 +50,16 @@ function teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "runc delete --force [paused container]" {
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" ct1
|
||||
[ "$status" -eq 0 ]
|
||||
testcontainer ct1 running
|
||||
|
||||
runc pause ct1
|
||||
runc delete --force ct1
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "runc delete --force in cgroupv1 with subcgroups" {
|
||||
requires cgroups_v1 root cgroupns
|
||||
set_cgroups_path
|
||||
|
Reference in New Issue
Block a user