Skip to content
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

Daemon: Allow shutdown during startup #15025

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MggMuggins
Copy link
Contributor

Fixes #14628

Launch d.Init() in a goroutine so that a shutdown signal will immediately cancel the shutdownCtx and trigger d.Stop(). This allows shutting down LXD while it is still starting; it's likely that this introduces some nasty races (including nil pointer derefs 😢 ) if Stop() is called on a partially initialized daemon.

However, responding to shutdown signals right away lets the admin bail on Dqlite startup if a clustered LXD server isn't able to achieve quorum. Without this patch, a user who needs to run lxd recover will sit and wait forever for LXD to shut down gracefully.

I'm opening this PR mostly to run the test suite against it; still thinking about an appropriate approach for stopping a partially initialized daemon.

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.

Check shutdown context during global database startup
1 participant