File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,11 @@ func (c *Container) Signal(s os.Signal) error {
394394 // https://github.com/opencontainers/runc/pull/4395#pullrequestreview-2291179652
395395 return c .signal (s )
396396 }
397+ // For not rootless container, if there is no init process and no cgroup,
398+ // it means that the container is not running.
399+ if errors .Is (err , ErrCgroupNotExist ) && ! c .hasInit () {
400+ err = ErrNotRunning
401+ }
397402 return fmt .Errorf ("unable to kill all processes: %w" , err )
398403 }
399404 return nil
Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ package libcontainer
33import "errors"
44
55var (
6- ErrExist = errors .New ("container with given ID already exists" )
7- ErrInvalidID = errors .New ("invalid container ID format" )
8- ErrNotExist = errors .New ("container does not exist" )
9- ErrPaused = errors .New ("container paused" )
10- ErrRunning = errors .New ("container still running" )
11- ErrNotRunning = errors .New ("container not running" )
12- ErrNotPaused = errors .New ("container not paused" )
6+ ErrExist = errors .New ("container with given ID already exists" )
7+ ErrInvalidID = errors .New ("invalid container ID format" )
8+ ErrNotExist = errors .New ("container does not exist" )
9+ ErrPaused = errors .New ("container paused" )
10+ ErrRunning = errors .New ("container still running" )
11+ ErrNotRunning = errors .New ("container not running" )
12+ ErrNotPaused = errors .New ("container not paused" )
13+ ErrCgroupNotExist = errors .New ("cgroup not exist" )
1314)
Original file line number Diff line number Diff line change @@ -695,11 +695,9 @@ func setupPersonality(config *configs.Config) error {
695695
696696// signalAllProcesses freezes then iterates over all the processes inside the
697697// manager's cgroups sending the signal s to them.
698- //
699- // signalAllProcesses returns ErrNotRunning when the cgroup does not exist.
700698func signalAllProcesses (m cgroups.Manager , s unix.Signal ) error {
701699 if ! m .Exists () {
702- return ErrNotRunning
700+ return ErrCgroupNotExist
703701 }
704702 // Use cgroup.kill, if available.
705703 if s == unix .SIGKILL {
You can’t perform that action at this time.
0 commit comments