Skip to content

daemon: Fix not initialized network controller#54

Merged
rumpl merged 1 commit into
rumpl:c8dfrom
vvoland:containerd-no-restore-fix
Aug 10, 2022
Merged

daemon: Fix not initialized network controller#54
rumpl merged 1 commit into
rumpl:c8dfrom
vvoland:containerd-no-restore-fix

Conversation

@vvoland
Copy link
Copy Markdown
Collaborator

@vvoland vvoland commented Aug 10, 2022

After #51 the container creation fails:

Error spoiler
DEBU[2022-08-10T14:13:29.292797554Z] event published                               ns=moby topic=/snapshot/prepare type=containerd.events.SnapshotPrepare
2022/08/10 14:13:29 http: panic serving @: runtime error: invalid memory address or nil pointer dereference
goroutine 105 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1825 +0xb0
panic({0x21cea60, 0x3593260})
        /usr/local/go/src/runtime/panic.go:844 +0x258
github.com/docker/docker/daemon.(*Daemon).updateContainerNetworkSettings(0x4000c1e240, 0x400020d400, 0x4000a83650)
        /go/src/github.com/docker/docker/daemon/container_operations.go:468 +0xb8
github.com/docker/docker/daemon.(*Daemon).create(0x4000c1e240, {0x25334f0, 0x4000a82510}, {{{0x0, 0x0}, 0x4000aba140, 0x4000b04480, 0x4000b8cec8, 0x0, 0x0}, ...})
        /go/src/github.com/docker/docker/daemon/create.go:229 +0x730
github.com/docker/docker/daemon.(*Daemon).containerCreate(0x4000c1e240, {0x25334f0, 0x4000a82510}, {{{0x0, 0x0}, 0x4000aba140, 0x4000b04480, 0x4000b8cec8, 0x0, 0x0}, ...})
        /go/src/github.com/docker/docker/daemon/create.go:107 +0x4cc
github.com/docker/docker/daemon.(*Daemon).ContainerCreate(0x4000d7e007?, {0x25334f0?, 0x4000a82510?}, {{0x0, 0x0}, 0x4000aba140, 0x4000b04480, 0x4000b8cec8, 0x0, 0x0})
        /go/src/github.com/docker/docker/daemon/create.go:53 +0xb4
github.com/docker/docker/api/server/router/container.(*containerRouter).postContainersCreate(0x400097f300, {0x25334f0, 0x4000a82510}, {0x2531f58, 0x40009967e0}, 0x4000580800, 0xffff9bb53501?)
        /go/src/github.com/docker/docker/api/server/router/container/container_routes.go:581 +0x600
github.com/docker/docker/api/server/middleware.ExperimentalMiddleware.WrapHandler.func1({0x25334f0, 0x4000a82510}, {0x2531f58?, 0x40009967e0?}, 0x20ee320?, 0x4000969830?)
        /go/src/github.com/docker/docker/api/server/middleware/experimental.go:26 +0x130
github.com/docker/docker/api/server/middleware.VersionMiddleware.WrapHandler.func1({0x25334f0, 0x4000a82120}, {0x2531f58, 0x40009967e0}, 0x359a400?, 0x4000a9e0b8?)
        /go/src/github.com/docker/docker/api/server/middleware/version.go:62 +0x404
github.com/docker/docker/pkg/authorization.(*Middleware).WrapHandler.func1({0x25334f0, 0x4000a82120}, {0x2531f58?, 0x40009967e0}, 0x4000580800, 0x1?)
        /go/src/github.com/docker/docker/pkg/authorization/middleware.go:59 +0x4a8
github.com/docker/docker/api/server/middleware.DebugRequestMiddleware.func1({0x25334f0, 0x4000a82120}, {0x2531f58, 0x40009967e0}, 0x4000580800, 0x4000968090?)
        /go/src/github.com/docker/docker/api/server/middleware/debug.go:53 +0x4c8
github.com/docker/docker/api/server.(*Server).makeHTTPHandler.func1({0x2531f58, 0x40009967e0}, 0x4000580300)
        /go/src/github.com/docker/docker/api/server/server.go:142 +0x2d4
net/http.HandlerFunc.ServeHTTP(0x4000580100?, {0x2531f58?, 0x40009967e0?}, 0x4000c5a160?)
        /usr/local/go/src/net/http/server.go:2084 +0x3c
github.com/docker/docker/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0x4000cfca80, {0x2531f58, 0x40009967e0}, 0x40008ee700)
        /go/src/github.com/docker/docker/vendor/github.com/gorilla/mux/mux.go:210 +0x1a0
net/http.serverHandler.ServeHTTP({0x2523428?}, {0x2531f58, 0x40009967e0}, 0x40008ee700)
        /usr/local/go/src/net/http/server.go:2916 +0x40c
net/http.(*conn).serve(0x4000a04000, {0x25334f0, 0x40009d6b10})
        /usr/local/go/src/net/http/server.go:1966 +0x56c
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3071 +0x450
^CINFO[2022-08-10T14:14:01.450645097Z] Processing signal 'interrupt'
DEBU[2022-08-10T14:14:01.451228430Z] daemon configured with a 15 seconds minimum shutdown timeout
DEBU[2022-08-10T14:14:01.451269013Z] start clean shutdown of all containers with a 15 seconds timeout...
INFO[2022-08-10T14:14:01.452313847Z] [core] Channel Connectivity change to SHUTDOWN  module=grpc

Turns out the Daemon.restore actually does also initialize the network devices because it also does register links for the restored containers.

I just changed the guard to make the code in this function think there are no containers at all.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland requested review from ndeloof and rumpl August 10, 2022 14:27
@thaJeztah
Copy link
Copy Markdown
Collaborator

This should be squashed with #51 when upstreaming

@thaJeztah
Copy link
Copy Markdown
Collaborator

@vvoland do you know which PR this was upstreamed in? (Or was this one skipped / superseded?)

@vvoland
Copy link
Copy Markdown
Collaborator Author

vvoland commented Mar 8, 2023

This is a fixup for #51 (which won't be upstreamed), so this one is not needed.

@thaJeztah thaJeztah added do-not-upstream Pull requests that are not (no longer) needed in upstream and removed upstreamed labels Mar 8, 2023
@thaJeztah
Copy link
Copy Markdown
Collaborator

Ah, gotcha, thanks!

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

Labels

do-not-upstream Pull requests that are not (no longer) needed in upstream

Projects

Status: Won't Upstream

Development

Successfully merging this pull request may close these issues.

3 participants