Skip to content

Commit

Permalink
Merge pull request #3066 from jedevc/fix-shared-op-sigsegv-followup
Browse files Browse the repository at this point in the history
solver: correct cache nil return value in Exec
  • Loading branch information
tonistiigi committed Aug 26, 2022
2 parents 46c8b9e + 0347fc3 commit 611137a
Showing 1 changed file with 8 additions and 6 deletions.
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

0 comments on commit 611137a

Please sign in to comment.