Skip to content

Commit dde4c10

Browse files
authored
Merge pull request #3265 from Random-Liu/cherry-pick-#3244-#3263-release-1.1
[release/1.1] Return NotFound error for kill and delete in deleted state.
2 parents b72eee4 + 7417645 commit dde4c10

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

linux/proc/deleted_state.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"context"
2323

2424
"github.com/containerd/console"
25+
"github.com/containerd/containerd/errdefs"
2526
google_protobuf "github.com/gogo/protobuf/types"
2627
"github.com/pkg/errors"
2728
)
@@ -54,11 +55,11 @@ func (s *deletedState) Start(ctx context.Context) error {
5455
}
5556

5657
func (s *deletedState) Delete(ctx context.Context) error {
57-
return errors.Errorf("cannot delete a deleted process")
58+
return errors.Wrap(errdefs.ErrNotFound, "cannot delete a deleted process")
5859
}
5960

6061
func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error {
61-
return errors.Errorf("cannot kill a deleted process")
62+
return errors.Wrap(errdefs.ErrNotFound, "cannot kill a deleted process")
6263
}
6364

6465
func (s *deletedState) SetExited(status int) {

linux/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (r *Runtime) Delete(ctx context.Context, c runtime.Task) (*runtime.Exit, er
320320
)
321321

322322
rsp, err := lc.shim.Delete(ctx, empty)
323-
if err != nil {
323+
if err != nil && !errdefs.IsNotFound(err) {
324324
if cerr := r.cleanupAfterDeadShim(ctx, bundle, namespace, c.ID(), lc.pid); cerr != nil {
325325
log.G(ctx).WithError(err).Error("unable to cleanup task")
326326
}

0 commit comments

Comments
 (0)