From nobody Mon Apr 29 16:25:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577095446; cv=none; d=zohomail.com; s=zohoarc; b=WzAPr073PIlkUz73Lq9Ezn61zYgITbdLn9xG44EPQ6uVeOzBG4kVAlm551hdxv3PkF4cmin5Iaj0t4+BURM1N9Em3qkeUXX4aykE+A8LBQc4efH2UvJHB+VNEkRxXTSsX/sj7MTMwTHfc54xTPHCBFtaCWs6kRLY57YPoIIY+wI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577095446; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HnxjlTtIUqttMT/5GUjXVnQ7wUGu/d7cSbBKjevNnDU=; b=F6rM2E2nk0/2hBp+jHz7Vy8+7Ybk+GLn4EjBwoj8cj0GsBTj3e1PqYTn+dnm4WHEk9f4YzLz0EhWR10OgccxiSnfucjjpfNuyrfjwDVmWpH+kvV3yKZepALI6N+Fg0D3oyhUABVxPNyWWB+wri9UEIJ0NkW2Njb3/qXWX6fBvH4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1577095446710795.1076575615024; Mon, 23 Dec 2019 02:04:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-pXGRWrFbPRyLGpIY6Kevng-1; Mon, 23 Dec 2019 05:03:33 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED9B61883521; Mon, 23 Dec 2019 10:03:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4B3B1000322; Mon, 23 Dec 2019 10:03:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7A64A18089CE; Mon, 23 Dec 2019 10:03:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBN7H8Li024012 for ; Mon, 23 Dec 2019 02:17:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDD6A2037E42; Mon, 23 Dec 2019 07:17:07 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E92422026D68 for ; Mon, 23 Dec 2019 07:17:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3D188012D2 for ; Mon, 23 Dec 2019 07:17:05 +0000 (UTC) Received: from mxct.zte.com.cn (mx7.zte.com.cn [202.103.147.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-g_8wA4LOPieWe42NIVJDkA-1; Mon, 23 Dec 2019 02:17:03 -0500 Received: from mse-fl1.zte.com.cn (unknown [10.30.14.238]) by Forcepoint Email with ESMTPS id 982B470B8ABD586414F6 for ; Mon, 23 Dec 2019 15:16:58 +0800 (CST) Received: from notes_smtp.zte.com.cn (notessmtp.zte.com.cn [10.30.1.239]) by mse-fl1.zte.com.cn with ESMTP id xBN7DKf5054823 for ; Mon, 23 Dec 2019 15:13:20 +0800 (GMT-8) (envelope-from wang.yi59@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019122315132466-1474589 ; Mon, 23 Dec 2019 15:13:24 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577095416; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HnxjlTtIUqttMT/5GUjXVnQ7wUGu/d7cSbBKjevNnDU=; b=I4cZYiVUoFZr1agobI7OYilg9Vq5JmZbdvg5yfvjSZ+Esb/5wzLHtbL9xLttp7BIsBbMQ9 Pu4tc7EvOmzDD/fGkxJl+EPy4Q7xKSgz9CP51bG3E5iI+dkKetgkSv3vft6dpUgoLXwiYk ee637nYH5VsR1Mkpl8b9xwznxFJu/Aw= From: Yi Wang To: libvir-list@redhat.com Date: Mon, 23 Dec 2019 15:13:10 +0800 Message-Id: <1577085190-23456-1-git-send-email-wang.yi59@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-12-23 15:13:24, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-12-23 15:13:21, Serialize complete at 2019-12-23 15:13:21 X-MAIL: mse-fl1.zte.com.cn xBN7DKf5054823 X-MC-Unique: g_8wA4LOPieWe42NIVJDkA-1 X-MC-Unique: pXGRWrFbPRyLGpIY6Kevng-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBN7H8Li024012 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 23 Dec 2019 05:03:27 -0500 Cc: wang.yi59@zte.com.cn, Li XueLei , wang.liang82@zte.com.cn, xue.zhihong@zte.com.cn Subject: [libvirt] [PATCH] create a thread to handle MigrationParamReset to avoid deadlock X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Li XueLei Libvirtd no longer receives external requests, after I do the following. Steps to reproduce: 1.Virsh tool initiates a non-p2p migrations. 2.After the phase of qemuDomainMigratePerform3 and before the phase of qemuDomainMigrateConfirm3, kill the virsh client which initiated the migration. What happens: Libvirtd will be blocked in the next call stack because it can't get the condition variables, and it will not be able to receive new requests. Thread 1 (Thread 0x7f36a7b9f8c0 (LWP 27556)): #0 0x00007f36a45799f5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/lib= pthread.so.0 #1 0x00007f36a6e7a97e in virCondWait () from /lib64/libvirt.so.0 #2 0x00007f3679c6a1b3 in qemuMonitorSend () from /usr/lib64/libvirt/connec= tion-driver/libvirt_driver_qemu.so #3 0x00007f3679c837de in qemuMonitorJSONCommandWithFd () from /usr/lib64/l= ibvirt/connection-driver/libvirt_driver_qemu.so #4 0x00007f3679c93c5a in qemuMonitorJSONSetMigrationCapabilities () from /= usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so #5 0x00007f3679c786ed in qemuMonitorSetMigrationCapabilities () from /usr/= lib64/libvirt/connection-driver/libvirt_driver_qemu.so #6 0x00007f3679c67857 in qemuMigrationParamsApply () from /usr/lib64/libvi= rt/connection-driver/libvirt_driver_qemu.so #7 0x00007f3679c67eff in qemuMigrationParamsReset () from /usr/lib64/libvi= rt/connection-driver/libvirt_driver_qemu.so #8 0x00007f3679c5198a in qemuMigrationSrcCleanup () from /usr/lib64/libvir= t/connection-driver/libvirt_driver_qemu.so #9 0x00007f36a6dcd862 in virCloseCallbacksRun () from /lib64/libvirt.so.0 #10 0x00007f3679cc28f6 in qemuConnectClose () from /usr/lib64/libvirt/conne= ction-driver/libvirt_driver_qemu.so #11 0x00007f36a70a0870 in virConnectDispose () from /lib64/libvirt.so.0 #12 0x00007f36a6e3f43b in virObjectUnref () from /lib64/libvirt.so.0 #13 0x00007f36a70a55c4 in virConnectClose () from /lib64/libvirt.so.0 #14 0x000056058a206f92 in remoteClientFree () #15 0x00007f36a6fa49a0 in virNetServerClientDispose () from /lib64/libvirt.= so.0 #16 0x00007f36a6e3f43b in virObjectUnref () from /lib64/libvirt.so.0 #17 0x00007f36a6e3fd21 in virObjectFreeCallback () from /lib64/libvirt.so.0 #18 0x00007f36a6f9942e in virNetSocketEventFree () from /lib64/libvirt.so.0 #19 0x00007f36a6de8439 in virEventPollCleanupHandles () from /lib64/libvirt= .so.0 #20 0x00007f36a6de9ab6 in virEventPollRunOnce () from /lib64/libvirt.so.0 #21 0x00007f36a6de817a in virEventRunDefaultImpl () from /lib64/libvirt.so.0 #22 0x00007f36a6faadb5 in virNetDaemonRun () from /lib64/libvirt.so.0 #23 0x000056058a1c5cc1 in main () Here's a patch to solve this bug, that is to create a thread to do MigrationParamReset. Signed-off-by: Li XueLei Signed-off-by: Yi Wang --- src/remote/remote_daemon_dispatch.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 76c676c..3962ee3 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1741,9 +1741,10 @@ remoteClientFreePrivateCallbacks(struct daemonClient= Private *priv) * We keep the libvirt connection open until any async * jobs have finished, then clean it up elsewhere */ -void remoteClientFree(void *data) + +static void remoteClientFreeFun(void *opaque) { - struct daemonClientPrivate *priv =3D data; + struct daemonClientPrivate *priv =3D opaque; =20 if (priv->conn) virConnectClose(priv->conn); @@ -1760,7 +1761,16 @@ void remoteClientFree(void *data) if (priv->storageConn) virConnectClose(priv->storageConn); =20 - VIR_FREE(priv); + VIR_FREE(priv); +} + +void remoteClientFree(void *data) +{ + virThread thread; + + if (virThreadCreate(&thread, false, remoteClientFreeFun, data) < 0) { + VIR_ERROR("Unable to create remoteClientFreeFun thread"); + } } =20 =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list