-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix daemon not cleaned up w/ live restore enabled #24435
Fix daemon not cleaned up w/ live restore enabled #24435
Conversation
This patch makes sure daemon resources are cleaned up on shutdown if there are no running containers. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
fae7699
to
2d5dc94
Compare
Experimental hitting a flaky test; #24203 |
LGTM |
@@ -652,8 +652,12 @@ func (daemon *Daemon) Shutdown() error { | |||
// Keep mounts and networking running on daemon shutdown if | |||
// we are to keep containers running and restore them. | |||
if daemon.configStore.LiveRestore { | |||
return nil | |||
// check if there are any running containers, if none we should do some cleanup | |||
if ls, err := daemon.Containers(&types.ContainerListOptions{}); len(ls) != 0 || err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't less expensive and probably cleaner to call daemon.containers.List()
(or daemon.List()
) then daemon.Containers(...)
? I can see much stuff going on with daemon.Containers(...)
- like filters even if you're providing an empty list option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daemon.containers.List will have to be manually filtered anyway.
just a question, LGTM otherwise |
If there is a mix of running and stopped containers during daemon shutdown, dont we still want the stopped container mounts to be unmounted and other cleanup performed? |
@anusha-ragunathan The stopped containers will already be unmounted. |
Yes, the graph driver mount is what I'm referring to. daemon.layerStore.Cleanup and daemon.cleanupMounts to be specific. |
@anusha-ragunathan If there are running containers, we can't unmount the root graph mount. |
layerStore.Cleanup calls the graphdriver's Cleanup method, which is:
LGTM. |
LGTM |
This patch makes sure daemon resources are cleaned up on shutdown if
there are no running containers.
Fixes #24350