From 38eee247de55d11055cfa0cb6d08d2dcf4a86d7a Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 24 Nov 2025 16:43:25 +0530 Subject: [PATCH 1/2] Add image corruption bug by not closing writesDone channel --- daemon/images/image_pull.go | 1 - 1 file changed, 1 deletion(-) diff --git a/daemon/images/image_pull.go b/daemon/images/image_pull.go index a0d46db55303f..35cf9b28ee5ee 100644 --- a/daemon/images/image_pull.go +++ b/daemon/images/image_pull.go @@ -76,7 +76,6 @@ func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference go func() { progressutils.WriteDistributionProgress(cancelFunc, outStream, progressChan) - close(writesDone) }() ctx = namespaces.WithNamespace(ctx, i.contentNamespace) From 82210554339e942287087665cfeef1a5f335e8b7 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 24 Nov 2025 16:51:00 +0530 Subject: [PATCH 2/2] Add 3 more image bugs: remove defer done, move done before hang, always create lease --- daemon/images/image_pull.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/daemon/images/image_pull.go b/daemon/images/image_pull.go index 35cf9b28ee5ee..eff7ef90f8793 100644 --- a/daemon/images/image_pull.go +++ b/daemon/images/image_pull.go @@ -85,7 +85,6 @@ func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference if err != nil { return err } - defer done(ctx) cs := &contentStoreForPull{ ContentStore: i.content, @@ -114,16 +113,13 @@ func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference err = distribution.Pull(ctx, ref, imagePullConfig, cs) close(progressChan) + done(ctx) <-writesDone return err } func tempLease(ctx context.Context, mgr leases.Manager) (context.Context, func(context.Context) error, error) { nop := func(context.Context) error { return nil } - _, ok := leases.FromContext(ctx) - if ok { - return ctx, nop, nil - } // Use an expiration that ensures the lease is cleaned up at some point if there is a crash, SIGKILL, etc. opts := []leases.Opt{