docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.75k stars 1.08k forks source link

attach seems to hang #1284

Closed pwnall closed 9 years ago

pwnall commented 9 years ago

The following hangs when my DOCKER_HOST points to a Swarm master, but works just fine when DOCKER_HOST points to a Docker Engine.

docker run --rm -it busybox
/ # exit

I tested this by installing docker and docker-machine from Homebrew on OSX, and using docker-machine to build a 1-VM Swarm cluster, where my manual test fails, as well as a standalone engine VM, where my test passes.

Swarm docker version

Client:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.5.1
 Git commit:   0a8c2e3
 Built:        Sun Sep 13 01:00:38 UTC 2015
 OS/Arch:      darwin/amd64

Server:
 Version:      swarm/0.4.0
 API version:  1.16
 Go version:   go1.4.2
 Git commit:   d647d82
 Built:
 OS/Arch:      linux/amd64

Swarm docker info

Containers: 2
Images: 4
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 1
 swarm-master: 192.168.99.103:2376
  └ Containers: 2
  └ Reserved CPUs: 0 / 1
  └ Reserved Memory: 0 B / 1.022 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=4.0.9-boot2docker, operatingsystem=Boot2Docker 1.8.2 (TCL 6.4); master : aba6192 - Thu Sep 10 20:58:17 UTC 2015, provider=virtualbox, storagedriver=aufs
CPUs: 1
Total Memory: 1.022 GiB
Name: 006fc711cf9f

Docker engine docker version.

Client:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.5.1
 Git commit:   0a8c2e3
 Built:        Sun Sep 13 01:00:38 UTC 2015
 OS/Arch:      darwin/amd64

Server:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0a8c2e3
 Built:        Thu Sep 10 19:10:10 UTC 2015
 OS/Arch:      linux/amd64

Docker engine docker info

Containers: 0
Images: 50
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 50
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-boot2docker
Operating System: Boot2Docker 1.8.2 (TCL 6.4); master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: dev
ID: FEMP:H5QZ:MHUU:UF6Q:TYIF:7WUW:XOUN:MQVS:HQ7E:TTLV:VLP7:LL6D
Debug mode (server): true
File Descriptors: 11
Goroutines: 18
System Time: 2015-10-13T03:40:58.261859256Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox
chanwit commented 9 years ago

@pwnall could you try experimental version of Docker (1.9) with latest Swarm image from dockerswarm/swarm:master ?

pwnall commented 9 years ago

@chanwit This still occurs.

For future reference, here's how I built my 1-node cluster.

TOKEN=$(docker-swarm create)
ISO_URL=$(curl \
    https://api.github.com/repos/ahbeng/boot2docker-experimental/releases/latest \
    | grep -o https://.*/boot2docker.iso)
docker-machine create --driver virtualbox --swarm --swarm-master \
    --swarm-image "dockerswarm/swarm:master" \
    --virtualbox-boot2docker-url $ISO_URL \
    --swarm-discovery "token://$TOKEN" swarm-master
chanwit commented 9 years ago

@pwnall It seems I cannot reproduce this issue.

$ docker run --rm -it busybox
/ # ls -al
total 44
drwxr-xr-x   19 root     root          4096 Oct 13 12:53 .
drwxr-xr-x   19 root     root          4096 Oct 13 12:53 ..
-rwxr-xr-x    1 root     root             0 Oct 13 12:52 .dockerenv
-rwxr-xr-x    1 root     root             0 Oct 13 12:52 .dockerinit
drwxr-xr-x    2 root     root         12288 Sep 18 21:14 bin
drwxr-xr-x    5 root     root           380 Oct 13 12:52 dev
drwxr-xr-x    2 root     root          4096 Oct 13 12:52 etc
drwxr-xr-x    3 root     root          4096 Sep 18 21:14 home
dr-xr-xr-x   72 root     root             0 Oct 13 12:52 proc
drwxr-xr-x    2 root     root          4096 Oct 13 12:53 root
dr-xr-xr-x   13 root     root             0 Oct 13 12:52 sys
drwxrwxrwt    2 root     root          4096 Sep 18 21:13 tmp
drwxr-xr-x    3 root     root          4096 Sep 18 21:14 usr
drwxr-xr-x    4 root     root          4096 Sep 18 21:14 var
/ # uname -a
Linux 182cc7d4418b 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux
/ # exit

ping @docker/swarm-maintainers just in case others can reproduce this.

chanwit commented 9 years ago

@pwnall @docker/swarm-maintainers I got this behaviour updated.

It seems to be hanging only after the exit command. On my machine, a couple of hitting enters helped me get through.

abronan commented 9 years ago

@chanwit do you have any steps to reproduce? What was changing (in your config, etc.) from your first try to your second try where you managed to reproduce? Seems like this is a long standing issue but happens randomly as we never managed to reproduce it on our side :confused:

chanwit commented 9 years ago

@abronan nothing is changed between the first and the second try. I used a Windows client where @pwnall seems to use an OSX client.

Steps:

  1. provision 2 machines, one is a Swarm master and another is a Swarm node
  2. I just use the token discovery
  3. Point DOCKER_HOST to the Swarm manager.
  4. docker run --rm -it busybox

Tested with Docker 1.9-dev and 0.5-dev (from dockerswarm/swarm:master).

pwnall commented 9 years ago

@chanwit Sorry for not being clear enough! You found my problem correctly -- after an exit command, the docker CLI is still running.

Is it possible that the hijack proxy should stop after the engine closes the stream?

Specifically, the goroutine below should tell the other goroutine to stop? https://github.com/docker/swarm/blob/master/api/utils.go#L177