Skip to content

Commit 1c551a4

Browse files
Alex Couture-Beilalexcb
authored andcommitted
llbsolver: set temporary lease in Commit context
The temporary lease must be passed via the context for the call to w.Commit() to prevent the cleanup of metadata resources before they are fully referenced. This fixes moby#3921 Signed-off-by: Alex Couture-Beil <[email protected]>
1 parent cc2438f commit 1c551a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

solver/llbsolver/history.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ func (w *Writer) Discard() {
579579
func (w *Writer) Commit(ctx context.Context) (*ocispecs.Descriptor, func(), error) {
580580
dgst := w.dgstr.Digest()
581581
sz := int64(w.sz)
582-
if err := w.w.Commit(ctx, int64(w.sz), dgst); err != nil {
582+
if err := w.w.Commit(leases.WithLease(ctx, w.l.ID), int64(w.sz), dgst); err != nil {
583583
if !errdefs.IsAlreadyExists(err) {
584584
w.Discard()
585585
return nil, nil, err

0 commit comments

Comments
 (0)