On 4/27/20 5:54 PM, Daniel P. Berrangé wrote:
We got a new BZ filed about a libvirtd crash in shutdown
https://bugzilla.redhat.com/show_bug.cgi?id=1828207
And there is another one:
https://bugzilla.redhat.com/show_bug.cgi?id=1895359
The problem is that when host is shutting down we get
PrepareForShutdown() signal on dbus and spawn a thread that will
eventually call qemuStateStop(). But before it gets a chance to run the
main thread quits the event loop and calls qemuStateCleanup() freeing
the qemu driver. After all this the dbus signal handling thread gets to
run only to find qemu_driver=0x0 and thus crash.
From the fact that the event loop quit I deduct that we were sent a
SIGTERM which means there was no guest running otherwise we would
inhibit the shutdown, so qemuStateStop() would be a NOP anyway. So maybe
the fix for this particular case indeed is to check whether qemu_driver
== 0x0.
Anyway, I think your idea is sound.
Michal