Merge pull request #10442 from Iceber/fix_ctr_delete_force

client: fix tasks with PID 0 cannot be forced to delete
This commit is contained in:
Maksym Pavlenko 2024-07-30 20:14:08 +00:00 committed by GitHub
commit fd2a7676a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,6 +151,12 @@ type ProcessDeleteOpts func(context.Context, Process) error
// WithProcessKill will forcefully kill and delete a process // WithProcessKill will forcefully kill and delete a process
func WithProcessKill(ctx context.Context, p Process) error { func WithProcessKill(ctx context.Context, p Process) error {
// Skip killing tasks with PID 0
// https://github.com/containerd/containerd/issues/10441
if p.Pid() == 0 {
return nil
}
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
defer cancel() defer cancel()
// ignore errors to wait and kill as we are forcefully killing // ignore errors to wait and kill as we are forcefully killing