From 70082f6bc8f3e542726734cf838d7c0888ef3776 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Wed, 18 Sep 2019 13:01:59 +0200 Subject: [PATCH] Destroy the temporary export layer before removing it Fix: #696 Signed-off-by: Pierre Tardy --- internal/wclayer/exportlayer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/wclayer/exportlayer.go b/internal/wclayer/exportlayer.go index ab546e6c9e..b344a74a35 100644 --- a/internal/wclayer/exportlayer.go +++ b/internal/wclayer/exportlayer.go @@ -101,6 +101,10 @@ func (r *legacyLayerReaderWrapper) Close() (err error) { defer func() { oc.SetSpanStatus(r.s, err) }() err = r.legacyLayerReader.Close() + // if the layer is not Destroyed at hcs level before removing + // we might enter in a race-condition for large containers + // which end-up in a hang of the os.RemoveAll() call + DestroyLayer(r.ctx, r.root) os.RemoveAll(r.root) return err }