[sandbox] Fix panic when waiting for sandbox controller
@@ -296,7 +296,11 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
// but we don't care about sandbox TaskOOM right now, so it is fine.
go func() {
resp, err := controller.Wait(context.Background(), id)
- if err != nil && err != context.Canceled && err != context.DeadlineExceeded {
+ if err != nil {
+ log.G(ctx).WithError(err).Error("failed to wait for sandbox controller, skipping exit event")
+ return
+ }
+
e := &eventtypes.TaskExit{
ContainerID: id,
ID: id,
@@ -306,7 +310,6 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
ExitedAt: resp.ExitedAt,
}
c.eventMonitor.backOff.enBackOff(id, e)
- }
}()
sandboxRuntimeCreateTimer.WithValues(labels["oci_runtime_type"]).UpdateSince(runtimeStart)
