diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-21 17:58:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 17:58:41 +0000 |
commit | c09fab59ddc6964e1c6afc31fa5f1b04c57a2b8c (patch) | |
tree | 173f3f36ca6b7be0f240a32133d8140093325a14 | |
parent | 54f2c9a54034c01a542b2b1c79bbbceb7d12c260 (diff) | |
parent | 30245f5849901822469a58a13387e2f55415def6 (diff) | |
download | podman-c09fab59ddc6964e1c6afc31fa5f1b04c57a2b8c.tar.gz podman-c09fab59ddc6964e1c6afc31fa5f1b04c57a2b8c.tar.bz2 podman-c09fab59ddc6964e1c6afc31fa5f1b04c57a2b8c.zip |
Merge pull request #12047 from mheon/remove_infra_from_db
[NO NEW TESTS NEEDED] Remove infra ID from DB before removing containers
-rw-r--r-- | libpod/runtime_pod_linux.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go index 9bd6d5e78..7d7fef4d1 100644 --- a/libpod/runtime_pod_linux.go +++ b/libpod/runtime_pod_linux.go @@ -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. |