Skip to content

Commit 4c16017

Browse files
authored
Merge pull request #3209 from Random-Liu/fix-v1-shim-cleanup
Shim v1: Check task list to avoid unnecessary cleanup.
2 parents 8722ec0 + 9cc5878 commit 4c16017

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)