-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Labels
area/apiAPIAPIkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.Enhancements are not bugs or new features but can improve usability or performance.
Description
Description
Creating a Moby/Docker client using client.NewClientWithOpts(client.WithAPIVersionNegotiation())
and then using this client from multiple goroutines (such as indirectly by requesting an event stream) reproducibly triggers go's race detector in
Line 251 in 74286cb
func (cli *Client) negotiateAPIVersionPing(pingResponse types.Ping) { |
The go Docker client dependency is:
github.com/docker/docker v20.10.17+incompatible
Steps to reproduce the issue:
- check out the repository https://github.com/thediveo/whalewatcher
- in the root of the repository run
go test -v -race ./watcher/moby
Describe the results you received:
WARNING: DATA RACE
Write at 0x00c0000a0372 by goroutine 24:
github.com/docker/docker/client.(*Client).negotiateAPIVersionPing()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/client.go:244 +0x184
github.com/docker/docker/client.(*Client).NegotiateAPIVersion()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/client.go:208 +0xe4
github.com/docker/docker/client.(*Client).getAPIPath()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/client.go:184 +0x84
github.com/docker/docker/client.(*Client).sendRequest()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/request.go:109 +0x7c
github.com/docker/docker/client.(*Client).get()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/request.go:37 +0x16c
github.com/docker/docker/client.(*Client).Events.func1()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/events.go:35 +0x1dc
Previous write at 0x00c0000a0372 by goroutine 23:
github.com/docker/docker/client.(*Client).negotiateAPIVersionPing()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/client.go:244 +0x184
github.com/docker/docker/client.(*Client).NegotiateAPIVersion()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/client.go:208 +0xe4
github.com/docker/docker/client.(*Client).getAPIPath()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/client.go:184 +0x84
github.com/docker/docker/client.(*Client).sendRequest()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/request.go:109 +0x7c
github.com/docker/docker/client.(*Client).get()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/request.go:37 +0x584
github.com/docker/docker/client.(*Client).ContainerList()
/home/.../go/pkg/mod/github.com/docker/docker@v20.10.17+incompatible/client/container_list.go:48 +0x5c8
github.com/thediveo/whalewatcher/engineclient/moby.(*MobyWatcher).List()
/home/.../workspaces/namespaces/whalewatcher/engineclient/moby/moby.go:138 +0x9c
github.com/thediveo/whalewatcher/watcher.(*watcher).list()
/home/.../workspaces/namespaces/whalewatcher/watcher/watcher.go:424 +0x94
github.com/thediveo/whalewatcher/watcher.(*watcher).Watch.func1.1()
/home/.../workspaces/namespaces/whalewatcher/watcher/watcher.go:232 +0x50
Describe the results you expected:
Go's race detector doesn't get triggered.
Additional information you deem important (e.g. issue happens only occasionally):
- reproducible
Output of docker version
:
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:36 2022
OS/Arch: linux/arm64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:00 2022
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
compose: Docker Compose (Docker Inc., v2.6.0)
Server:
Containers: 6
Running: 0
Paused: 0
Stopped: 6
Images: 30
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc version: v1.1.2-0-ga916309
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
cgroupns
Kernel Version: 5.13.0-1031-raspi
Operating System: Ubuntu 21.10
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 7.625GiB
Name: ****
ID: ****
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
Metadata
Metadata
Assignees
Labels
area/apiAPIAPIkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.Enhancements are not bugs or new features but can improve usability or performance.