Skip to content

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

Merged
silvin-lubecki merged 2 commits into
docker:masterfrom
thaJeztah:fix_sig_proxy
Jun 25, 2019
Merged

Do not disable sig-proxy when using a TTY#1841
silvin-lubecki merged 2 commits into
docker:masterfrom
thaJeztah:fix_sig_proxy

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

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

fixesmoby/moby#28872 (docker client doesn't pass signals when a terminal is attached)
fixesmoby/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

thaJeztah commented Apr 19, 2019

Copy link
Copy Markdown
MemberAuthor

@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

codecov-io commented Apr 19, 2019

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

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

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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

@thaJeztah
thaJeztahforce-pushed the fix_sig_proxy branch 3 times, most recently from c07700f to c8d8f55CompareApril 19, 2019 11:58
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

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
thaJeztahforce-pushed the fix_sig_proxy branch 3 times, most recently from e9044ef to 0c2295bCompareApril 19, 2019 12:51
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

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 <github@gone.nl>
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 <github@gone.nl>
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

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

let me remove the testing commits from here

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

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

ping @vdemeester@tianon@silvin-lubecki PTAL

@silvin-lubeckisilvin-lubecki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

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:masterJun 25, 2019
@GordonTheTurtleGordonTheTurtle 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
Copy Markdown
MemberAuthor

Speedy gonzales !

@kolyshkinkolyshkin mentioned this pull request Oct 29, 2019
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Mar 1, 2021
Similar to docker#1841
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Jul 9, 2021
Similar to docker#1841
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for freeto 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

@thaJeztah@codecov-io@vdemeester@silvin-lubecki@GordonTheTurtle