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

solver: forward nil return value from sharedOp.Exec #3043

Merged
merged 1 commit into from Aug 22, 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: 10 additions & 4 deletions solver/jobs.go
Expand Up @@ -817,8 +817,11 @@ 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.execRes != nil || s.execErr != nil {
return s.execRes, s.execErr
if s.execErr != nil {
return nil, s.execErr
}
if s.execRes != nil {
return s.execRes, nil
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this does not atm cache the nil value correctly and Exec gets called again in that case. This can be addressed in follow up.

Is the only case where this can return nil when loading an image without any layers?

}
release, err := op.Acquire(ctx)
if err != nil {
Expand Down Expand Up @@ -866,9 +869,12 @@ func (s *sharedOp) Exec(ctx context.Context, inputs []Result) (outputs []Result,
}
s.execErr = err
}
return s.execRes, err
if s.execRes == nil || err != nil {
return nil, err
}
return s.execRes, nil
})
if err != nil {
if res == nil || err != nil {
return nil, nil, err
}
r := res.(*execRes)
Expand Down