Skip to content

Commit 80839f1

Browse files
committed
allow client to remove created tasks with PID 0
Fixes containerd#7357 If a container is restored from a checkpoint that has a configuration error, the task for the restored container is created, but fails to start and is left in the state CREATED with a PID of 0. Before this change, the only way to remove this task was to find the PID of the shim monitoring the task and kill that process. Now, ctr t rm <task> will work on tasks that result in the CREATED state with PID 0. Signed-off-by: Gavin Inglis <[email protected]>
1 parent e1abaeb commit 80839f1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

task.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
311311
// On windows Created is akin to Stopped
312312
break
313313
}
314+
if t.pid == 0 {
315+
// allow for deletion of created tasks with PID 0
316+
// https://github.com/containerd/containerd/issues/7357
317+
break
318+
}
314319
fallthrough
315320
default:
316321
return nil, fmt.Errorf("task must be stopped before deletion: %s: %w", status.Status, errdefs.ErrFailedPrecondition)

0 commit comments

Comments
 (0)