Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove goto statements causing failed edges to never unpark #2556

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion solver/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type edge struct {
index *edgeIndex

secondaryExporters []expDep

failedOnce sync.Once
}

// dep holds state for a dependant edge
Expand Down Expand Up @@ -375,7 +377,9 @@ func (e *edge) makeExportable(k *CacheKey, records []*CacheRecord) ExportableCac

func (e *edge) markFailed(f *pipeFactory, err error) {
e.err = err
e.postpone(f)
e.failedOnce.Do(func() {
e.postpone(f)
})
}

// processUpdate is called by unpark for every updated pipe request
Expand Down
3 changes: 0 additions & 3 deletions solver/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func (s *scheduler) dispatch(e *edge) {
debugSchedulerPostUnpark(e, inc)
}

postUnpark:
// set up new requests that didn't complete/were added by this run
openIncoming := make([]*edgePipe, 0, len(inc))
for _, r := range s.incoming[e] {
Expand Down Expand Up @@ -189,11 +188,9 @@ postUnpark:
// unpark(), not for any external input.
if len(openIncoming) > 0 && len(openOutgoing) == 0 {
e.markFailed(pf, errors.New("buildkit scheduler error: return leaving incoming open. Please report this with BUILDKIT_SCHEDULER_DEBUG=1"))
goto postUnpark
}
if len(openIncoming) == 0 && len(openOutgoing) > 0 {
e.markFailed(pf, errors.New("buildkit scheduler error: return leaving outgoing open. Please report this with BUILDKIT_SCHEDULER_DEBUG=1"))
goto postUnpark
}
}

Expand Down