Skip to content

do not stop health check before sending signal#39454

Merged
thaJeztah merged 2 commits intomoby:masterfrom
crosbymichael:test-hc-stop
Jul 14, 2019
Merged

do not stop health check before sending signal#39454
thaJeztah merged 2 commits intomoby:masterfrom
crosbymichael:test-hc-stop

Conversation

@crosbymichael
Copy link
Contributor

Docker daemon always stops healthcheck before sending signal to a
container now. However, when we use "docker kill" to send signals
other than SIGTERM or SIGKILL to a container, such as SIGINT,
daemon still stops container health check though container process
handles the signal normally and continues to work.

carry and closes #37263

Signed-off-by: Ruilin Li liruilin4@huawei.com

Copy link
Member

@thaJeztah thaJeztah 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
Member

@yongtang yongtang left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member

🤦‍♂ sorry overlooked this; looks like you added a test to the old integration-cli suite, but it should be in the integration/ tests;

08:50:42 The following new tests were added to integration-cli:
08:50:42 
08:50:42 +func (s *DockerSuite) TestHealthKillContainer(c *check.C) {

@crosbymichael
Copy link
Contributor Author

Then why does the old one even exist seb?

@thaJeztah
Copy link
Member

see #32866 and #34623

@crosbymichael
Copy link
Contributor Author

I don't think i'll move it, its just another half baked move to create more work.

@cpuguy83
Copy link
Member

cpuguy83 commented Jul 8, 2019

It's "half baked" b/c it is indeed a large body of work with potential of causing regressions during move.
We really do not want new tests in integration-cli.
Let me know if you'd like help moving this over.

@dmcgowan
Copy link
Member

I don't think I understand the logic here. You can't add a new health check fix unless you add a health check test, but you can't add a health check test unless you also take the responsibility of porting ALL the health check tests to a new test framework?

@cpuguy83
Copy link
Member

No, we just don't want to add a new test to integration-cli.
There is no need to port existing tests.

@dmcgowan
Copy link
Member

My recommendation, merge this and migrate all the health checks as a whole in a separate change. The functions used to implement this test are just like the other health check tests and defined in that package, moving the test would be equivalent to migrating.

@cpuguy83
Copy link
Member

We have not accepted new tests in integration-cli for quite some time, why would we add a new test now?
Don't worry about it, I'll move the test over.

@cpuguy83
Copy link
Member

Updated to move the test.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@thaJeztah
Copy link
Member

Hmmm... something became more noisy in the tests;

Details
20:52:23 --- PASS: TestInfoAPIWarnings (0.38s)
20:52:23     info_test.go:49: Creating a new daemon
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:350: [d66cd94c869e8] error pinging daemon on start: Get http://%2Ftmp%2Fdocker-integration%2Fd66cd94c869e8.sock/_ping: dial unix /tmp/docker-integration/d66cd94c869e8.sock: connect: no such file or directory
20:52:23     daemon.go:336: [d66cd94c869e8] waiting for daemon to start
20:52:23     daemon.go:364: [d66cd94c869e8] daemon started
20:52:23     daemon.go:472: [d66cd94c869e8] Stopping daemon
20:52:23     daemon.go:307: [d66cd94c869e8] exiting daemon
20:52:23     daemon.go:459: [d66cd94c869e8] Daemon stopped

@cpuguy83
Copy link
Member

Yes, I see that in other PR, same exact test case.

@thaJeztah
Copy link
Member

I see something interesting there; looks like the daemon arguments do not override, but append to the defaults, so adding -H=d.Sock() looks to result in the daemon serving on the same socket twice?

time="2019-07-12T17:02:33.618475887Z" level=info msg="API listen on /tmp/docker-integration/d9f6af1ad301d.sock"
time="2019-07-12T17:02:33.618511806Z" level=info msg="API listen on /tmp/docker-integration/d9f6af1ad301d.sock"
time="2019-07-12T17:02:33.618544416Z" level=info msg="API listen on [::]:23756"

Guess we should filter duplicates when starting the API. I'll open a PR

Ruilin Li and others added 2 commits July 14, 2019 11:53
Docker daemon always stops healthcheck before sending signal to a
container now. However, when we use "docker kill" to send signals
other than SIGTERM or SIGKILL to a container, such as SIGINT,
daemon still stops container health check though container process
handles the signal normally and continues to work.

Signed-off-by: Ruilin Li <liruilin4@huawei.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@thaJeztah
Copy link
Member

rebased to get the testing fixes in from master

@thaJeztah thaJeztah merged commit f1b5612 into moby:master Jul 14, 2019
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Jul 19, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby#39454, but
rewritten in a commit in the same PR:
moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@ddebroy
Copy link
Contributor

ddebroy commented Jul 19, 2019

One q: Should we assert on something else after

ctxPoll, cancel = context.WithTimeout(ctx, 30*time.Second)
defer cancel()
poll.WaitOn(t, pollForHealthStatus(ctxPoll, client, id, "healthy"), poll.WithDelay(100*time.Millisecond))
It appears the test continues ends without any assertions - is that intended?

@cpuguy83
Copy link
Member

The test should fail if the status is not healthy within the allotted 30s.

docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Jul 19, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby/moby#39454, but
rewritten in a commit in the same PR:
moby/moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: eeaa0b30d47e6b9dac8d8ea2ced6d5ce44c24463
Component: engine
@crosbymichael crosbymichael deleted the test-hc-stop branch August 12, 2019 19:19
dani-docker pushed a commit to dani-docker/moby that referenced this pull request Aug 14, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby#39454, but
rewritten in a commit in the same PR:
moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eeaa0b3)
Signed-off-by: Dani Louca <dani.louca@docker.com>
dani-docker pushed a commit to dani-docker/moby that referenced this pull request Aug 14, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby#39454, but
rewritten in a commit in the same PR:
moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eeaa0b3)
Signed-off-by: Dani Louca <dani.louca@docker.com>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Aug 15, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby/moby#39454, but
rewritten in a commit in the same PR:
moby/moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eeaa0b30d47e6b9dac8d8ea2ced6d5ce44c24463)
Signed-off-by: Dani Louca <dani.louca@docker.com>
Upstream-commit: f481d4c02366093b337e9aebfbbf23b1ff3968fe
Component: engine
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Aug 15, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby/moby#39454, but
rewritten in a commit in the same PR:
moby/moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eeaa0b30d47e6b9dac8d8ea2ced6d5ce44c24463)
Signed-off-by: Dani Louca <dani.louca@docker.com>
Upstream-commit: ef5dd6e46de6930b7adb2715ebc0473f25ba7995
Component: engine
burnMyDread pushed a commit to burnMyDread/moby that referenced this pull request Oct 21, 2019
This test is failing on Windows currently:

```
11:59:47 --- FAIL: TestHealthKillContainer (8.12s)
11:59:47     health_test.go:57: assertion failed: error is not nil: Error response from daemon: Invalid signal: SIGUSR1
``

That test was added recently in moby#39454, but
rewritten in a commit in the same PR:
moby@f8aef6a

In that rewrite, there were some changes:

- originally it was skipped on Windows, but the rewritten test doesn't have that skip:

    ```go
    testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
    ```

- the original test used `SIGINT`, but the new one uses `SIGUSR1`

Analysis:

- The Error bubbles up from: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal.go#L29-L44
- Interestingly; `ContainerKill` should validate if a signal is valid for the given platform, but somehow we don't hit that part; https://github.com/moby/moby/blob/f1b5612f2008827fdcf838abb4539064c682181e/daemon/kill.go#L40-L48
- Windows only looks to support 2 signals currently https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/pkg/signal/signal_windows.go#L17-L26
- Upstream Golang looks to define `SIGINT` as well; https://github.com/golang/go/blob/77f9b2728eb08456899e6500328e00ec4829dddf/src/runtime/defs_windows.go#L44
- This looks like the current list of Signals upstream in Go; https://github.com/golang/sys/blob/3b58ed4ad3395d483fc92d5d14123ce2c3581fec/windows/types_windows.go#L52-L67

```go
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: zach <Zachary.Joyner@linux.com>
@suconghou
Copy link

@crosbymichael
@thaJeztah
do not stop health check before sending signal caused an issue for me , can you help me how can I fix it

my healthcheck has a notification when check failed.

when docker stop , it does not stop the health check progress , but stop the container first , this caused healthcheck check failed and send a notification, but it should not because it's a stop progress.

It would be fine , if the health check progress stop first and then stop the conatiner .

server.py

import http.server
import socketserver
import signal
import time
import sys


def handler(*args):
    print('the http server stoped and need a little time to detail with others',
          time.strftime("%Y-%m-%d %H:%M:%S"))
    time.sleep(15)
    print('exiting...', time.strftime("%Y-%m-%d %H:%M:%S"))
    sys.exit(0)


signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler)

PORT = 8000

Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
    print("serving at port", PORT)
    httpd.serve_forever()


Dockerfile

FROM python:alpine

HEALTHCHECK --interval=3s --timeout=3s --retries=3 CMD [ "date", "+%Y-%m-%d %H:%M:%S"]

COPY ./server.py /root/main.py

CMD ["python3", "-u", "/root/main.py"]

docker run --rm --name health_issue test

serving at port 8000
the http server stoped and need a little time to detail with others 2020-03-22 02:05:07

docker inspect --format "{{json .State }}" health_issue

{
    "Log": [
        {
            "Start": "2020-03-22T02:04:59.423939563Z",
            "End": "2020-03-22T02:04:59.583966614Z",
            "ExitCode": 0,
            "Output": "2020-03-22 02:04:59\n"
        },
        {
            "Start": "2020-03-22T02:05:02.572386829Z",
            "End": "2020-03-22T02:05:02.750181415Z",
            "ExitCode": 0,
            "Output": "2020-03-22 02:05:02\n"
        },
        {
            "Start": "2020-03-22T02:05:05.759605263Z",
            "End": "2020-03-22T02:05:05.935407224Z",
            "ExitCode": 0,
            "Output": "2020-03-22 02:05:05\n"
        },
        {
            "Start": "2020-03-22T02:05:08.943380082Z",
            "End": "2020-03-22T02:05:09.109120639Z",
            "ExitCode": 0,
            "Output": "2020-03-22 02:05:09\n"
        },
        {
            "Start": "2020-03-22T02:05:12.116895218Z",
            "End": "2020-03-22T02:05:12.279000161Z",
            "ExitCode": 0,
            "Output": "2020-03-22 02:05:12\n"
        }
    ]
}

example code from #36233

container stop start at 2020-03-22 02:05:07 and health check progress continue to work ,
the last check progress (2020-03-22 02:05:09,2020-03-22 02:05:12) should failed in a real world and send a notification

It would be better we stop health check progress first and destory the container

How can I fix this for now .

by the way , I am using docker swarm .

@malarinv
Copy link

I'm facing the same issue as @suconghou , will it be fixed on v20.03.0?

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.

9 participants