[libvirt] [PATCH 6/6] qemuProcessReconnectHelper: Don't create joinable thread

Michal Privoznik mprivozn at redhat.com
Thu Nov 14 09:51:16 UTC 2013


In the qemuProcessReconnectHelper() a new thread that do all the
interesting work is spawned. The rationale is to not block the daemon
startup process in case of unresponsive qemu. However, the thread
handler is a local variable which gets lost once the control goes out of
scope. Hence, the thread gets leaked. We can avoid this if the thread
isn't make joinable.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e34f542..f698d47 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3281,7 +3281,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj,
      */
     virConnectRef(data->conn);
 
-    if (virThreadCreate(&thread, true, qemuProcessReconnect, data) < 0) {
+    if (virThreadCreate(&thread, false, qemuProcessReconnect, data) < 0) {
 
         virConnectClose(data->conn);
 
-- 
1.8.3.2




More information about the libvir-list mailing list