Skip to content

restart: skip Sleep() for the first iteration of the reconcilation#5069

Merged
dmcgowan merged 1 commit intocontainerd:masterfrom
AkihiroSuda:restart-fast
Feb 26, 2021
Merged

restart: skip Sleep() for the first iteration of the reconcilation#5069
dmcgowan merged 1 commit intocontainerd:masterfrom
AkihiroSuda:restart-fast

Conversation

@AkihiroSuda
Copy link
Copy Markdown
Member

Previously, containers were not started until the daemon completes the first sleep.

Test result with nerdctl v0.6.1

Before:

$ go test -v -exec sudo -test.kill-daemon -run TestRunRestart
test target: "nerdctl"
=== RUN   TestRunRestart
    run_restart_test.go:44: NOTE: this test may take a while
    run_restart_test.go:71: killing "containerd.service"
    run_restart_test.go:72: checking activity of "containerd.service"
    run_restart_test.go:72: (retry=0) activating
    run_restart_test.go:72: (retry=1) activating
    run_restart_test.go:72: (retry=2) active
    run_restart_test.go:72: daemon "containerd.service" is now running
    run_restart_test.go:79: (retry 0) ps -a: "CONTAINER ID    IMAGE                                      COMMAND                   CREATED          STATUS     PORTS                     NAMES\n46ba66a9a3a5    mirror.gcr.io/library/nginx:1.19-alpine    \"/docker-entrypoint.…\"    6 seconds ago    Created    127.0.0.1:8080->80/tcp    nerdctl-test-restart-nginx\n"
    run_restart_test.go:79: (retry 1) ps -a: "CONTAINER ID    IMAGE                                      COMMAND                   CREATED          STATUS     PORTS                     NAMES\n46ba66a9a3a5    mirror.gcr.io/library/nginx:1.19-alpine    \"/docker-entrypoint.…\"    9 seconds ago    Created    127.0.0.1:8080->80/tcp    nerdctl-test-restart-nginx\n"
    run_restart_test.go:79: (retry 2) ps -a: "CONTAINER ID    IMAGE                                      COMMAND                   CREATED           STATUS     PORTS                     NAMES\n46ba66a9a3a5    mirror.gcr.io/library/nginx:1.19-alpine    \"/docker-entrypoint.…\"    12 seconds ago    Created    127.0.0.1:8080->80/tcp    nerdctl-test-restart-nginx\n"
    run_restart_test.go:79: (retry 3) ps -a: "CONTAINER ID    IMAGE                                      COMMAND                   CREATED           STATUS     PORTS                     NAMES\n46ba66a9a3a5    mirror.gcr.io/library/nginx:1.19-alpine    \"/docker-entrypoint.…\"    15 seconds ago    Created    127.0.0.1:8080->80/tcp    nerdctl-test-restart-nginx\n"
    run_restart_test.go:79: (retry 4) ps -a: "CONTAINER ID    IMAGE                                      COMMAND                   CREATED           STATUS     PORTS                     NAMES\n46ba66a9a3a5    mirror.gcr.io/library/nginx:1.19-alpine    \"/docker-entrypoint.…\"    18 seconds ago    Running    127.0.0.1:8080->80/tcp    nerdctl-test-restart-nginx\n"
    run_restart_test.go:82: test is passing, after 4 retries
--- PASS: TestRunRestart (19.17s)
PASS
ok      github.com/AkihiroSuda/nerdctl  19.189s

After:

$ go test -v -exec sudo -test.kill-daemon -run TestRunRestart
test target: "nerdctl"
=== RUN   TestRunRestart
    run_restart_test.go:44: NOTE: this test may take a while
    run_restart_test.go:71: killing "containerd.service"
    run_restart_test.go:72: checking activity of "containerd.service"
    run_restart_test.go:72: (retry=0) activating
    run_restart_test.go:72: (retry=1) activating
    run_restart_test.go:72: (retry=2) active
    run_restart_test.go:72: daemon "containerd.service" is now running
    run_restart_test.go:79: (retry 0) ps -a: "CONTAINER ID    IMAGE                                      COMMAND                   CREATED          STATUS     PORTS                     NAMES\n51486603cd31    mirror.gcr.io/library/nginx:1.19-alpine    \"/docker-entrypoint.…\"    6 seconds ago    Running    127.0.0.1:8080->80/tcp    nerdctl-test-restart-nginx\n"
    run_restart_test.go:82: test is passing, after 0 retries
--- PASS: TestRunRestart (6.71s)
PASS
ok      github.com/AkihiroSuda/nerdctl  6.731s

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Feb 24, 2021

Build succeeded.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Feb 25, 2021

Build succeeded.

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 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
Copy Markdown
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan dmcgowan merged commit 9884730 into containerd:master Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants