Skip to content

Commit fafab60

Browse files
committed
llbsolver: take copy of history record to avoid marshal race
For active builds these records get stored in the memory and marshalled on user request. This leads to possibility that the original record may be updated while the marshalling is happening, leading to a crash. Signed-off-by: Tonis Tiigi <[email protected]>
1 parent 78bcf8d commit fafab60

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

solver/llbsolver/history.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,8 @@ func (h *HistoryQueue) Update(ctx context.Context, e *controlapi.BuildHistoryEve
680680
h.mu.Lock()
681681
defer h.mu.Unlock()
682682

683+
e = e.CloneVT()
684+
683685
if e.Type == controlapi.BuildHistoryEventType_STARTED {
684686
h.active[e.Record.Ref] = e.Record
685687
h.ps.Send(e)

0 commit comments

Comments
 (0)