[PATCH v2 2/2] virnetdaemon: Wait for "daemon-stop" thread to finish before quitting

Ján Tomko jtomko at redhat.com
Tue Nov 24 14:33:20 UTC 2020


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 at redhat.com>
>---
> 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 at redhat.com>

Thanks for fixing this.

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201124/9fa3182c/attachment-0001.sig>


More information about the libvir-list mailing list