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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

solver: correct cache nil return value in Exec #3066

Merged
merged 1 commit into from Aug 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions solver/jobs.go
Expand Up @@ -619,8 +619,9 @@ type sharedOp struct {
subBuilder *subBuilder
err error

execRes *execRes
execErr error
execRes *execRes
execDone bool
execErr error

cacheRes []*CacheMap
cacheDone bool
Expand Down Expand Up @@ -817,10 +818,10 @@ func (s *sharedOp) Exec(ctx context.Context, inputs []Result) (outputs []Result,
}
flightControlKey := "exec"
res, err := s.g.Do(ctx, flightControlKey, func(ctx context.Context) (ret interface{}, retErr error) {
if s.execErr != nil {
return nil, s.execErr
}
if s.execRes != nil {
if s.execDone {
if s.execErr != nil {
return nil, s.execErr
}
return s.execRes, nil
}
release, err := op.Acquire(ctx)
Expand Down Expand Up @@ -857,6 +858,7 @@ func (s *sharedOp) Exec(ctx context.Context, inputs []Result) (outputs []Result,
}
}
if complete {
s.execDone = true
if res != nil {
var subExporters []ExportableCacheKey
s.subBuilder.mu.Lock()
Expand Down