-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Description
API clients can hang on a ContainerLogs() call, for example when Follow is true and the container process is short lived. AFAICS, the routines in daemon/logs.go do not hold the requisite lock or locks, e.g. at the point where they verify the container status and access its LogDriver.
Steps to reproduce the issue:
- Add `time.Sleep(10 * time.Second) at https://github.com/docker/docker/blob/87e45626f433e5cecd576c0a6fcae09158d95a5e/daemon/logs.go#L51
- Run the test code below.
Describe the results you received:
Client prints container output.
With the server-side sleep, the client reliably hangs. Without it, the hang happens occasionally under load.
With or without the server-side sleep, after the client exits (after a SIGINT in the case of the hang), the daemon log contains "Error closing logger: invalid argument", which I think is indicative of a logic error.
Describe the results you expected:
Client prints container output. No error in the daemon log. No hang.
Additional information you deem important (e.g. issue happens only occasionally):
In some ways this is a similar issue to #29285 , although that was with the attach path.
Output of docker version:
Client:
Version: 17.04.0-dev
API version: 1.27
Go version: go1.7.5
Git commit: 87e4562
Built: Fri Feb 24 10:46:59 2017
OS/Arch: linux/amd64
Server:
Version: 17.04.0-dev
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: 87e4562
Built: Fri Feb 24 10:46:59 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 17.04.0-dev
Storage Driver: vfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary:
containerd version: 665e84e6c28653a9c29a6db601636a92d46896f3
runc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.5-200.fc25.x86_64
Operating System: Debian GNU/Linux 8 (jessie) (containerized)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.796GiB
Name: de7edd3f4ba9
ID: CGYO:SLJM:5MNC:WP5C:B4HW:ECPC:VBJE:COCN:GMAZ:77ZA:U6CM:UC7C
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
Tested using latest docker master (running under make shell).