Sorry, I unexpectedly deleted text body.
I changed the code like this:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c2a1f9a..8aad0b3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -514,7 +514,10 @@ int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
else
virReportSystemError(errno,
"%s", _("cannot acquire job
mutex"));
+ virDomainObjUnlock(obj);
qemuDriverLock(driver);
+ virDomainObjLock(obj);
+ virDomainObjUnref(obj);
return -1;
}
}
but still have problem. (see log in previous mail.) The reference count
of virDomainObj becomes 0 while there are still threads accessing it.
This causes two results: one is segmentation fault as shown in the log;
the other is the qemu monitor fd is closed two early, and threads are
polling a closed fd.
Steps of my test:
1. change the value of max_clients in /etc/libvirt/libvirtd.conf to
big enough value:
max_clients = 2000000
2. run libvirtd
3. run libvirt-test.sh hut-vm1 (hut-vm1 is my vm name) (warning: this
script forks many processes you have to kill by hand)
(again, the log and script libvirt-test.sh are in my previous mail)