On a Friday in 2020, Michal Privoznik wrote:
When the host is shutting down then we get PrepareForShutdown signal on DBus to which we react by creating a thread which runs virStateStop() and thus qemuStateStop(). But if scheduling the thread is delayed just a but it may happen that we receive SIGTERM (sent by systemd) to which we respond by quitting our event loop and cleaning up everything (including drivers). And only after that the thread gets to run only to find qemu_driver being NULL. What we can do is to delay exiting event loop and join the thread that's executing virStateStop(). If the join doesn't happen in given timeout (currently 30 seconds) then libvirtd shuts down forcefully anyways (see virNetDaemonRun()). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1895359
Also, https://bugzilla.redhat.com/show_bug.cgi?id=1739564
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/libvirt_remote.syms | 1 + src/remote/remote_daemon.c | 15 ++++++++++++--- src/rpc/virnetdaemon.c | 17 +++++++++++++++++ src/rpc/virnetdaemon.h | 3 +++ 4 files changed, 33 insertions(+), 3 deletions(-)
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Thanks for fixing this. Jano
Attachment:
signature.asc
Description: PGP signature