Skip to content

Commit

Permalink
Merge pull request #3209 from Random-Liu/fix-v1-shim-cleanup
Browse files Browse the repository at this point in the history
Shim v1: Check task list to avoid unnecessary cleanup.
  • Loading branch information
estesp committed Apr 16, 2019
2 parents 8722ec0 + 9cc5878 commit 4c16017
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/v1/linux/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,12 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
ctx = namespaces.WithNamespace(ctx, ns)
pid, _ := runc.ReadPidFile(filepath.Join(bundle.path, proc.InitPidFile))
s, err := bundle.NewShimClient(ctx, ns, ShimConnect(r.config, func() {
err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid)
_, err := r.tasks.Get(ctx, id)
if err != nil {
// Task was never started or was already successfully deleted
return
}
if err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid); err != nil {
log.G(ctx).WithError(err).WithField("bundle", bundle.path).
Error("cleaning up after dead shim")
}
Expand Down

0 comments on commit 4c16017

Please sign in to comment.