Skip to content

Commit 46bca49

Browse files
authored
Merge pull request containerd#9611 from adityaramani/main
Handle failure when stopping a sandbox
2 parents 9f8b845 + d010565 commit 46bca49

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/sandbox/controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,18 @@ func (c *controllerLocal) Stop(ctx context.Context, sandboxID string, opts ...sa
201201
}
202202

203203
svc, err := c.getSandbox(ctx, sandboxID)
204+
if errdefs.IsNotFound(err) {
205+
return nil
206+
}
204207
if err != nil {
205208
return err
206209
}
207210

208211
if _, err := svc.StopSandbox(ctx, req); err != nil {
209-
return fmt.Errorf("failed to stop sandbox: %w", errdefs.FromGRPC(err))
212+
err = errdefs.FromGRPC(err)
213+
if !errdefs.IsNotFound(err) && !errdefs.IsUnavailable(err) {
214+
return fmt.Errorf("failed to stop sandbox: %w", err)
215+
}
210216
}
211217

212218
return nil

0 commit comments

Comments
 (0)