Skip to content

Commit

Permalink
Remove goto statements causing failed edges to never unpark
Browse files Browse the repository at this point in the history
Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
  • Loading branch information
hinshun committed Jan 12, 2022
1 parent ffe2301 commit e93e2b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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
2 changes: 0 additions & 2 deletions solver/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,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

0 comments on commit e93e2b5

Please sign in to comment.