File tree 3 files changed +14
-10
lines changed
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 {
394
394
// https://github.com/opencontainers/runc/pull/4395#pullrequestreview-2291179652
395
395
return c .signal (s )
396
396
}
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
+ }
397
402
return fmt .Errorf ("unable to kill all processes: %w" , err )
398
403
}
399
404
return nil
Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ package libcontainer
3
3
import "errors"
4
4
5
5
var (
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" )
13
14
)
Original file line number Diff line number Diff line change @@ -695,11 +695,9 @@ func setupPersonality(config *configs.Config) error {
695
695
696
696
// signalAllProcesses freezes then iterates over all the processes inside the
697
697
// manager's cgroups sending the signal s to them.
698
- //
699
- // signalAllProcesses returns ErrNotRunning when the cgroup does not exist.
700
698
func signalAllProcesses (m cgroups.Manager , s unix.Signal ) error {
701
699
if ! m .Exists () {
702
- return ErrNotRunning
700
+ return ErrCgroupNotExist
703
701
}
704
702
// Use cgroup.kill, if available.
705
703
if s == unix .SIGKILL {
You can’t perform that action at this time.
0 commit comments