daemon: Fix panic in shutdown after daemon init fails#51943
Merged
thaJeztah merged 1 commit intomoby:masterfrom Jan 27, 2026
Merged
daemon: Fix panic in shutdown after daemon init fails#51943thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah merged 1 commit intomoby:masterfrom
Conversation
When error during daemon initialization fails before the events manager
is created the daemon will panic instead of erroring out cleanly with
an actual error message.
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x194fcec]
goroutine 1 [running, locked to thread]:
github.com/moby/moby/v2/daemon/events.(*Events).Close(...)
/go/src/github.com/docker/docker/daemon/events/events.go:157
github.com/moby/moby/v2/daemon.(*Daemon).Shutdown(0x40001bf908, {0x2d664f0, 0x44c87e0})
/go/src/github.com/docker/docker/daemon/daemon.go:1505 +0x3bc
github.com/moby/moby/v2/daemon.NewDaemon.func1()
/go/src/github.com/docker/docker/daemon/daemon.go:907 +0x44
github.com/moby/moby/v2/daemon.NewDaemon({0x2d66560, 0x4000051c20}, 0x40004a6108, 0x40006fe810, 0x4000318700)
/go/src/github.com/docker/docker/daemon/daemon.go:1371 +0x2130
github.com/moby/moby/v2/daemon/command.(*daemonCLI).start(0x4000051bd0, {0x2d664f0, 0x44c87e0})
/go/src/github.com/docker/docker/daemon/command/daemon.go:264 +0xb90
github.com/moby/moby/v2/daemon/command.runDaemon(...)
/go/src/github.com/docker/docker/daemon/command/docker_unix.go:13
github.com/moby/moby/v2/daemon/command.newDaemonCommand.func1(0x4000381808, {0x40006ac780?, 0x7?, 0x287f0b1?})
/go/src/github.com/docker/docker/daemon/command/docker.go:48 +0xb0
github.com/spf13/cobra.(*Command).execute(0x4000381808, {0x4000050060, 0x4, 0x4})
/go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1015 +0x7d4
github.com/spf13/cobra.(*Command).ExecuteC(0x4000381808)
/go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).Execute(...)
/go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(...)
/go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:1064
github.com/moby/moby/v2/daemon/command.daemonRunner.Run({0x2d35440?}, {0x2d664f0, 0x44c87e0})
/go/src/github.com/docker/docker/daemon/command/docker.go:97 +0x6c
main.main()
/go/src/github.com/docker/docker/cmd/dockerd/main.go:35 +0x108
```
Signed-off-by: Paweł Gronowski <[email protected]>
thaJeztah
approved these changes
Jan 27, 2026
Member
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
was this a regression?
Contributor
Author
|
I don't think it was a 29.2 regression. |
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When error during daemon initialization fails before the events manager is created the daemon will panic instead of erroring out cleanly with an actual error message.
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)