diff --git a/runtime/v1/linux/proc/deleted_state.go b/runtime/v1/linux/proc/deleted_state.go index ab89c3ecb..fe9d7bf55 100644 --- a/runtime/v1/linux/proc/deleted_state.go +++ b/runtime/v1/linux/proc/deleted_state.go @@ -22,6 +22,7 @@ import ( "context" "github.com/containerd/console" + "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/runtime/proc" google_protobuf "github.com/gogo/protobuf/types" "github.com/pkg/errors" @@ -55,11 +56,11 @@ func (s *deletedState) Start(ctx context.Context) error { } func (s *deletedState) Delete(ctx context.Context) error { - return errors.Errorf("cannot delete a deleted process") + return errors.Wrap(errdefs.ErrNotFound, "cannot delete a deleted process") } func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error { - return errors.Errorf("cannot kill a deleted process") + return errors.Wrap(errdefs.ErrNotFound, "cannot kill a deleted process") } func (s *deletedState) SetExited(status int) { diff --git a/runtime/v1/linux/task.go b/runtime/v1/linux/task.go index 38da35c08..e13255e95 100644 --- a/runtime/v1/linux/task.go +++ b/runtime/v1/linux/task.go @@ -87,7 +87,7 @@ func (t *Task) Namespace() string { // Delete the task and return the exit status func (t *Task) Delete(ctx context.Context) (*runtime.Exit, error) { rsp, err := t.shim.Delete(ctx, empty) - if err != nil { + if err != nil && !errdefs.IsNotFound(err) { return nil, errdefs.FromGRPC(err) } t.tasks.Delete(ctx, t.id) diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index 65022390e..a32843b8b 100644 --- a/runtime/v2/shim.go +++ b/runtime/v2/shim.go @@ -152,7 +152,7 @@ func (s *shim) Delete(ctx context.Context) (*runtime.Exit, error) { response, err := s.task.Delete(ctx, &task.DeleteRequest{ ID: s.ID(), }) - if err != nil { + if err != nil && errdefs.IsNotFound(err) { return nil, errdefs.FromGRPC(err) } if err := s.waitShutdown(ctx); err != nil {