Skip to content

Commit

Permalink
Merge pull request #12047 from mheon/remove_infra_from_db
Browse files Browse the repository at this point in the history
[NO NEW TESTS NEEDED] Remove infra ID from DB before removing containers
  • Loading branch information
openshift-merge-robot authored Oct 21, 2021
2 parents 54f2c9a + 30245f5 commit c09fab5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libpod/runtime_pod_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool,
}
}

// Clear infra container ID before we remove the infra container.
// There is a potential issue if we don't do that, and removal is
// interrupted between RemoveAllContainers() below and the pod's removal
// later - we end up with a reference to a nonexistent infra container.
p.state.InfraContainerID = ""
if err := p.save(); err != nil {
return err
}

// Remove all containers in the pod from the state.
if err := r.state.RemovePodContainers(p); err != nil {
// If this fails, there isn't much more we can do.
Expand Down

0 comments on commit c09fab5

Please sign in to comment.