From 7e23fb6c5d252c61125388ec3c7e1313b7f6bb85 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 2 Oct 2018 13:39:33 -0400 Subject: Fix cleanupRuntime to only save if container is valid We call cleanup() (which calls cleanupRuntime()) as part of removing containers, after the container has already been removed from the database. cleanupRuntime() tries to update and save the state, which obviously fails if the container no longer exists. Make the save() conditional on the container not being in the process of being removed. Signed-off-by: Matthew Heon --- libpod/container_internal.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libpod') diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 60e83576a..c2ed67a82 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -561,8 +561,11 @@ func (c *Container) cleanupRuntime(ctx context.Context) error { // Our state is now Exited, as we've removed ourself from // the runtime. c.state.State = ContainerStateExited - if err := c.save(); err != nil { - return err + + if c.valid { + if err := c.save(); err != nil { + return err + } } logrus.Debugf("Successfully cleaned up container %s", c.ID()) -- cgit v1.2.3-54-g00ecf