Skip to content

Commit 9cc5878

Browse files
committed
Check task list to avoid unnecessary cleanup.
Signed-off-by: Lantao Liu <[email protected]>
1 parent 5f4c977 commit 9cc5878

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

runtime/v1/linux/runtime.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,12 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
338338
ctx = namespaces.WithNamespace(ctx, ns)
339339
pid, _ := runc.ReadPidFile(filepath.Join(bundle.path, proc.InitPidFile))
340340
s, err := bundle.NewShimClient(ctx, ns, ShimConnect(r.config, func() {
341-
err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid)
341+
_, err := r.tasks.Get(ctx, id)
342342
if err != nil {
343+
// Task was never started or was already successfully deleted
344+
return
345+
}
346+
if err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid); err != nil {
343347
log.G(ctx).WithError(err).WithField("bundle", bundle.path).
344348
Error("cleaning up after dead shim")
345349
}

0 commit comments

Comments
 (0)