From c27b7cdc933f7102a3d093fa303f3ddb48209838 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Fri, 10 Aug 2018 11:50:25 +0200 Subject: removeContainer: fix deadlock When checking if the container has already been removed, use c.state.HasContainer() instead of the runtime's API to avoid trying to take the already acquired lock. Fixes: #1245 Signed-off-by: Valentin Rothberg Closes: #1251 Approved by: baude --- libpod/runtime_ctr.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpod') diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index ffad9d649..051b3e85e 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -174,7 +174,7 @@ func (r *Runtime) RemoveContainer(ctx context.Context, c *Container, force bool) // Locks the container, but does not lock the runtime func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool) error { if !c.valid { - if ok, _ := r.HasContainer(c.ID()); !ok { + if ok, _ := r.state.HasContainer(c.ID()); !ok { // Container probably already removed // Or was never in the runtime to begin with return nil -- cgit v1.2.3-54-g00ecf