Skip to content

Commit 0db46f6

Browse files
Iceberk8s-infra-cherrypick-robot
authored and
k8s-infra-cherrypick-robot
committed
client: fix tasks with PID 0 cannot be forced to delete
Signed-off-by: Iceber Gu <[email protected]>
1 parent 54b9c74 commit 0db46f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

task_opts.go

+6
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ type ProcessDeleteOpts func(context.Context, Process) error
158158

159159
// WithProcessKill will forcefully kill and delete a process
160160
func WithProcessKill(ctx context.Context, p Process) error {
161+
// Skip killing tasks with PID 0
162+
// https://github.com/containerd/containerd/issues/10441
163+
if p.Pid() == 0 {
164+
return nil
165+
}
166+
161167
ctx, cancel := context.WithCancel(ctx)
162168
defer cancel()
163169
// ignore errors to wait and kill as we are forcefully killing

0 commit comments

Comments
 (0)