moby: Intermittent hang with docker exec near container exit

We intermittently see docker exec ... hanging when we use it near container process exit. We see this both with the python SDK and the cli tool.

Steps to reproduce the issue:

Run this test harness for a while:

import time
import itertools
from subprocess import check_output, CalledProcessError


def docker(*args):
    return check_output(('docker', ) + args)

for i in itertools.count():
    print(i, time.time())
    container = docker(
        'run', '--net=host', '-d', 'busybox:latest', 'sh', '-c', 'sleep 0.55'
    ).strip()
    try:
        docker('exec', container, 'sh', '-c', 'killall sleep || true')
    except CalledProcessError as e:
        pass
    docker('wait', container)
    docker('rm', container)

Describe the results you received: Eventually hangs

Describe the results you expected: Should not hang

Output of docker version:

Client:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 18:29:41 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.2
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   bb80604
 Built:        Tue Oct 11 18:29:41 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 7
 Running: 0
 Paused: 0
 Stopped: 7
Images: 195
Server Version: 1.12.2
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 481
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-34-generic
Operating System: Linux Mint 18
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.679 GiB
Name: kohlenstoff
ID: 2TCK:YUZU:NWIV:QETB:XR42:UC3N:SNR6:MP4E:UAZ3:VT6C:TMKA:UWIS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.):

Running on my laptop!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (21 by maintainers)

Most upvoted comments

I’ll give it a go with --debug tomorrow!