From a1ae2bd9004d9d0a75278b5bc35738cbb17959a4 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 27 Mar 2023 16:06:57 -0700 Subject: [PATCH] fileop: create new fileOpSolver instance per Exec call FileOpSolver keeps internal state about the vertex that has been loaded into it and should not be reused. Signed-off-by: Tonis Tiigi (cherry picked from commit e7caa2e8422b1faaefe6c4504a38d428e7cc881b) --- solver/llbsolver/ops/file.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/solver/llbsolver/ops/file.go b/solver/llbsolver/ops/file.go index 7bbb3276797c..4f80ddfb65b5 100644 --- a/solver/llbsolver/ops/file.go +++ b/solver/llbsolver/ops/file.go @@ -30,9 +30,8 @@ const fileCacheType = "buildkit.file.v0" type fileOp struct { op *pb.FileOp - md cache.MetadataStore w worker.Worker - solver *FileOpSolver + refManager *file.RefManager numInputs int parallelism *semaphore.Weighted } @@ -41,12 +40,12 @@ func NewFileOp(v solver.Vertex, op *pb.Op_File, cm cache.Manager, parallelism *s if err := opsutils.Validate(&pb.Op{Op: op}); err != nil { return nil, err } + refManager := file.NewRefManager(cm, v.Name()) return &fileOp{ op: op.File, - md: cm, - numInputs: len(v.Inputs()), w: w, - solver: NewFileOpSolver(w, &file.Backend{}, file.NewRefManager(cm, v.Name())), + refManager: refManager, + numInputs: len(v.Inputs()), parallelism: parallelism, }, nil } @@ -168,7 +167,8 @@ func (f *fileOp) Exec(ctx context.Context, g session.Group, inputs []solver.Resu inpRefs = append(inpRefs, workerRef.ImmutableRef) } - outs, err := f.solver.Solve(ctx, inpRefs, f.op.Actions, g) + fs := NewFileOpSolver(f.w, &file.Backend{}, f.refManager) + outs, err := fs.Solve(ctx, inpRefs, f.op.Actions, g) if err != nil { return nil, err }