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

Don't share the options map #10151

Merged
merged 1 commit into from
Jan 9, 2023
Merged

Don't share the options map #10151

merged 1 commit into from
Jan 9, 2023

Conversation

freeformz
Copy link
Contributor

What I did

docker-compose build

Without this, I get an exception when building multiple images in my compose run.

fatal error: concurrent map writes

goroutine 16 [running]:
github.com/docker/compose/v2/pkg/compose.(*composeService).build.func1({0x2cba4e0, 0xc00019b2c0}, {0xc000233150?, 0xd?})
        github.com/docker/compose/v2/pkg/compose/build.go:95 +0x652
github.com/docker/compose/v2/pkg/compose.(*graphTraversal).run.func1()
        github.com/docker/compose/v2/pkg/compose/dependencies.go:127 +0x63
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
        golang.org/x/[email protected]/errgroup/errgroup.go:72 +0xa5
...

I'm not sure why the map is currently shared, but with this patch applied my docker-compose build run works.

$ docker version
Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.19.4
 Git commit:        3a2c30b63a
 Built:             Thu Dec 15 15:37:38 2022
 OS/Arch:           darwin/amd64
 Context:           colima
 Experimental:      true

Server:
 Engine:
  Version:          20.10.20
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       03df974ae9e6c219862907efdd76ec2e77ec930b
  Built:            Wed Oct 19 02:58:31 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        5fd4c4d144137e991c4acebb2146ab1483a97925
 docker-init:
  Version:          0.19.0
  GitCommit:

$ docker context inspect colima
[
    {
        "Name": "colima",
        "Metadata": {
            "Description": "colima"
        },
        "Endpoints": {
            "docker": {
                "Host": "unix:///Users/emuller/.colima/default/docker.sock",
                "SkipTLSVerify": false
            }
        },
        "TLSMaterial": {},
        "Storage": {
            "MetadataPath": "/Users/emuller/.docker/contexts/meta/f24fd3749c1368328e2b149bec149cb6795619f244c5b584e844961215dadd16",
            "TLSPath": "/Users/emuller/.docker/contexts/tls/f24fd3749c1368328e2b149bec149cb6795619f244c5b584e844961215dadd16"
        }
    }
]

$ docker info
Client:
 Context:    colima
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., 2.15.0)
WARNING: Plugin "/Users/emuller/.docker/cli-plugins/docker-buildx" is not valid: failed to fetch metadata: fork/exec /Users/emuller/.docker/cli-plugins/docker-buildx: no such file or directory
WARNING: Plugin "/Users/emuller/.docker/cli-plugins/docker-dev" is not valid: failed to fetch metadata: fork/exec /Users/emuller/.docker/cli-plugins/docker-dev: no such file or directory
WARNING: Plugin "/Users/emuller/.docker/cli-plugins/docker-sbom" is not valid: failed to fetch metadata: fork/exec /Users/emuller/.docker/cli-plugins/docker-sbom: no such file or directory
WARNING: Plugin "/Users/emuller/.docker/cli-plugins/docker-scan" is not valid: failed to fetch metadata: fork/exec /Users/emuller/.docker/cli-plugins/docker-scan: no such file or directory

Server:
 Containers: 12
  Running: 7
  Paused: 0
  Stopped: 5
 Images: 14
 Server Version: 20.10.20
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925
 init version:
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.15.82-0-virt
 Operating System: Alpine Linux v3.16
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 11.7GiB
 Name: colima
 ID: UJJH:MFKT:KZUZ:PMIZ:7MFA:2XYY:VMAH:7UKP:VRFR:ETM5:ES3Y:5D5N
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Base: 73.89% // Head: 72.79% // Decreases project coverage by -1.10% ⚠️

Coverage data is based on head (4ac6cd7) compared to base (a226d01).
Patch has no changes to coverable lines.

❗ Current head 4ac6cd7 differs from pull request most recent head 73ebbff. Consider uploading reports for the commit 73ebbff to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##               v2   #10151      +/-   ##
==========================================
- Coverage   73.89%   72.79%   -1.11%     
==========================================
  Files           2        2              
  Lines         272      272              
==========================================
- Hits          201      198       -3     
- Misses         60       62       +2     
- Partials       11       12       +1     
Impacted Files Coverage Δ
pkg/e2e/framework.go 70.98% <0.00%> (-1.18%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM

Without this I get an exception when building multiple images in a
compose run.

```
fatal error: concurrent map writes

goroutine 16 [running]:
github.com/docker/compose/v2/pkg/compose.(*composeService).build.func1({0x2cba4e0, 0xc00019b2c0}, {0xc000233150?, 0xd?})
        github.com/docker/compose/v2/pkg/compose/build.go:95 +0x652
github.com/docker/compose/v2/pkg/compose.(*graphTraversal).run.func1()
        github.com/docker/compose/v2/pkg/compose/dependencies.go:127 +0x63
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
        golang.org/x/[email protected]/errgroup/errgroup.go:72 +0xa5
...
```

I'm not sure why the map is currently shared, but with this patch
applied my docker-compose build run works.

Signed-off-by: Edward Muller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants