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

frontend: fix two data races #498

Merged
merged 1 commit into from
Jul 11, 2018
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
4 changes: 4 additions & 0 deletions frontend/dockerfile/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dockerfile

import (
"context"
"sync"

"github.com/moby/buildkit/cache"
clienttypes "github.com/moby/buildkit/client"
Expand All @@ -19,6 +20,7 @@ func llbBridgeToGatewayClient(ctx context.Context, llbBridge frontend.FrontendLL

type bridgeClient struct {
frontend.FrontendLLBBridge
mu sync.Mutex
opts map[string]string
final *ref
sid string
Expand All @@ -38,6 +40,7 @@ func (c *bridgeClient) Solve(ctx context.Context, req client.SolveRequest, expor
return nil, err
}
rr := &ref{r}
c.mu.Lock()
c.refs = append(c.refs, rr)
if final {
c.final = rr
Expand All @@ -49,6 +52,7 @@ func (c *bridgeClient) Solve(ctx context.Context, req client.SolveRequest, expor
}
c.exporterAttr = exporterAttr
}
c.mu.Unlock()
return rr, nil
}
func (c *bridgeClient) Opts() map[string]string {
Expand Down
5 changes: 3 additions & 2 deletions solver/llbsolver/vertex.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ func WithCacheSources(cms []solver.CacheManager) LoadOpt {

func RuntimePlatforms(p []specs.Platform) LoadOpt {
var defaultPlatform *pb.Platform
pp := make([]specs.Platform, len(p))
for i := range p {
p[i] = platforms.Normalize(p[i])
pp[i] = platforms.Normalize(p[i])
}
return func(op *pb.Op, _ *pb.OpMetadata, opt *solver.VertexOptions) error {
if op.Platform == nil {
Expand All @@ -67,7 +68,7 @@ func RuntimePlatforms(p []specs.Platform) LoadOpt {
}
if _, ok := op.Op.(*pb.Op_Exec); ok {
var found bool
for _, pp := range p {
for _, pp := range pp {
if pp.OS == op.Platform.OS && pp.Architecture == op.Platform.Architecture && pp.Variant == op.Platform.Variant {
found = true
break
Expand Down