Skip to content

Commit 09325e7

Browse files
author
Alex Couture-Beil
committed
solver: lock before using actives
Job.walkProvenance needs to acquire a read lock before accessing j.list.actives. The actual lock is acquired/released under WalkProvenance to prevent multiple locks/unlocks while walkProvenance recurses. Signed-off-by: Alex Couture-Beil <[email protected]>
1 parent 40c5efa commit 09325e7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

solver/jobs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@ func (wp *withProvenance) WalkProvenance(ctx context.Context, f func(ProvenanceP
533533
if wp.j == nil {
534534
return nil
535535
}
536+
wp.j.list.mu.RLock()
537+
defer wp.j.list.mu.RUnlock()
536538
m := map[digest.Digest]struct{}{}
537539
return wp.j.walkProvenance(ctx, wp.e, f, m)
538540
}

0 commit comments

Comments
 (0)