[libvirt] [RFC PATCH 10/10] libvirtd: fix crash on termination

John Ferlan jferlan at redhat.com
Wed Jan 10 17:23:35 UTC 2018

From: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>

[NB: Taken from earlier patch, although I'm not sure this patch
     would be necessary any more...]

The problem is incorrect order of qemu driver shutdown and shutdown
of netserver threads that serve client requests (thru qemu driver

Net server threads are shutdown upon dispose which is triggered
by last daemon object unref at the end of main function. At the same
time qemu driver is shutdown earlier in virStateCleanup. As a result
netserver threads see invalid driver object in the middle of request

Let's move shutting down netserver threads earlier to virNetDaemonClose.

Note: order of last daemon unref and virStateCleanup
is introduced in 85c3a182 for a valid reason.

Signed-off-by: John Ferlan <jferlan at redhat.com>
 src/rpc/virnetdaemon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
index 8c2141489..33bd8e3b0 100644
--- a/src/rpc/virnetdaemon.c
+++ b/src/rpc/virnetdaemon.c
@@ -881,6 +881,7 @@ virNetDaemonClose(virNetDaemonPtr dmn)
     virHashForEach(dmn->servers, daemonServerClose, NULL);
+    virHashRemoveAll(dmn->servers);

More information about the libvir-list mailing list