Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions solver/llbsolver/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ func (h *HistoryQueue) Update(ctx context.Context, e *controlapi.BuildHistoryEve
h.mu.Lock()
defer h.mu.Unlock()

e = e.CloneVT()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this happen outside of the lock?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The race is not with this function itself. It is that the record gets saved in the actives and remains there after this function has returned.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't which is why I approved it but it might benefit to perform an action that doesn't require the lock outside of the lock so it doesn't hold the lock as long.

Probably not a hotspot though so doesn't matter much.


if e.Type == controlapi.BuildHistoryEventType_STARTED {
h.active[e.Record.Ref] = e.Record
h.ps.Send(e)
Expand Down
Loading