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

Do not disable sig-proxy when using a TTY #1841

Merged
merged 2 commits into from
Jun 25, 2019

Conversation

thaJeztah
Copy link
Member

This partially reverts moby/moby@e0b59ab (moby/moby#2426), and does not automatically disable proxying signals in TTY-mode

fixes moby/moby#28872 (docker client doesn't pass signals when a terminal is attached)
fixes moby/moby#3793 docker client not passing signals to dockerd

relates to:

Before this change:

Start a container with a TTY in one shell:

docker run -it --init --name repro-28872 busybox sleep 30

then, in another shell, kill the docker cli:

kill `pgrep -f repro-28872`

Notice that the CLI was killed, but the signal not forwarded to the container;
the container continues running

docker container inspect --format '{{ .State.Status }}' repro-28872
running

docker container rm -f repro-28872

After this change:

Start a container with a TTY in one shell:

docker run -it --init --name repro-28872 busybox sleep 30

then, in another shell, kill the docker cli:

kill `pgrep -f repro-28872`

Verify that the signal was forwarded to the container, and the container exited

docker container inspect --format '{{ .State.Status }}' repro-28872
exited

docker container rm -f repro-28872

- Description for the changelog

- Fix docker client doesn't pass signals when a terminal is attached

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
Copy link
Member Author

thaJeztah commented Apr 19, 2019

@vdemeester I tried coming up with an e2e test for this, but I couldn't get it to work (creating a container with a TTY attached, then signal that docker cli); perhaps you have ideas?)

@codecov-io
Copy link

codecov-io commented Apr 19, 2019

Codecov Report

Merging #1841 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1841      +/-   ##
==========================================
+ Coverage   56.73%   56.74%   +<.01%     
==========================================
  Files         310      310              
  Lines       21803    21801       -2     
==========================================
  Hits        12370    12370              
+ Misses       8518     8517       -1     
+ Partials      915      914       -1

@thaJeztah
Copy link
Member Author

oooh, actually, I think I might've found it 🤗 - cleaning up a bit, and will add a test

@thaJeztah
Copy link
Member Author

Dang; why doesn't it work here 😞

11:10:01 === FAIL: e2e/container TestSigProxyWithTTY (6.16s)
11:10:01     proxy_signal_test.go:38: terminating PID 3793
11:10:01     proxy_signal_test.go:42: timeout hit after 5s: expected status exited != running

@thaJeztah
Copy link
Member Author

Hm... it works when running dind (using /var/run/docker.sock), but fails when using tcp:// 🤔

@thaJeztah thaJeztah force-pushed the fix_sig_proxy branch 3 times, most recently from c07700f to c8d8f55 Compare April 19, 2019 11:58
@thaJeztah
Copy link
Member Author

Ok, so my test passes with /var/run/docker.sock, but many other tests fail; need to look into why that's happening 🤔

    revoke_test.go:59: assertion failed: 
        Command:  docker pull registry:5000/alpine:3.6
        ExitCode: 1
        Error:    exit status 1
        Stdout:   
        Stderr:   Error response from daemon: Get https://registry:5000/v2/: Service Unavailable

@thaJeztah thaJeztah force-pushed the fix_sig_proxy branch 3 times, most recently from e9044ef to 0c2295b Compare April 19, 2019 12:51
@thaJeztah
Copy link
Member Author

If someone has any ideas on the test, help is appreciated 🤗

This partially reverts moby/moby@e0b59ab,
and does not automatically disable proxying signals in TTY-mode

Before this change:
------------------------------------

Start a container with a TTY in one shell:

```
docker run -it --init --name repro-28872 busybox sleep 30
```

then, in another shell, kill the docker cli:

```
kill `pgrep -f repro-28872`
```

Notice that the CLI was killed, but the signal not forwarded to the container;
the container continues running

```
docker container inspect --format '{{ .State.Status }}' repro-28872
running

docker container rm -f repro-28872
```

After this change:
------------------------------------

Start a container with a TTY in one shell:

```
docker run -it --init --name repro-28872 busybox sleep 30
```

then, in another shell, kill the docker cli:

```
kill `pgrep -f repro-28872`
```

Verify that the signal was forwarded to the container, and the container exited

```
docker container inspect --format '{{ .State.Status }}' repro-28872
exited

docker container rm -f repro-28872
```

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Add a test to verify that killing the docker CLI forwards
the signal to the container. Test-case for moby/moby 28872

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

I'll be damned.. LOL, tests are green now 🤷‍♂

let me remove the testing commits from here

@thaJeztah
Copy link
Member Author

Well.. there you go; all green and shiny 🎉

ping @vdemeester @tianon @silvin-lubecki PTAL

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

@silvin-lubecki silvin-lubecki merged commit bd4206f into docker:master Jun 25, 2019
@GordonTheTurtle GordonTheTurtle added this to the 19.09.0 milestone Jun 25, 2019
@thaJeztah thaJeztah deleted the fix_sig_proxy branch June 25, 2019 15:03
@thaJeztah
Copy link
Member Author

Speedy gonzales !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker client doesn't pass signals when a terminal is attached docker client not passing signals to dockerd
5 participants