From nobody Tue Jul 14 21:25:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=beckhoff.com ARC-Seal: i=1; a=rsa-sha256; t=1783589234; cv=none; d=zohomail.com; s=zohoarc; b=YLfmFyqu1A2oRcgHdiauxb7FK3DkAxIS6AbssaYxAFX1oBUxTlkJa6nKvJD5m7D4OdbYg1Xp3fLiAjVb5PK5B/l6CsnAPyaxdDCc24sxelXB5MA4ypvI960LpcwwO9Cjuf+dLJhiqArVbLMCBo+wWf6qx5e3bkqG912iig4rMB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783589234; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=bS3wZIkcWKXyAJVbI0CjQejEqQH+VMTKUpX7FdgzLIo=; b=i6N/msrkwba+Aq8OmhJy0icx8pGggYuQeMzt2Ys+i5emFUm23Upthk4MmUfonTWmNLIv6WbvX2sry7A2jWUwDozoF6F85rShuq2spsWVb0BABPIX0JKpHpEaP0p86/520v8GgzBnlUR29wpE3kjPjZxkgGT1e55IB2LaYOlkYkE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1783589233985726.0378023536848; Thu, 9 Jul 2026 02:27:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id BEA5E41A85; Thu, 9 Jul 2026 05:27:12 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 3877041E4F; Thu, 9 Jul 2026 05:21:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B0EB741C35; Tue, 7 Jul 2026 06:14:15 -0400 (EDT) Received: from mx07-0090a401.pphosted.com (mx07-0090a401.pphosted.com [66.159.244.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D208E41C34 for ; Tue, 7 Jul 2026 06:14:12 -0400 (EDT) Received: from pps.filterd (m0463074.ppops.net [127.0.0.1]) by mx07-0090a401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6675Jk7w230063 for ; Tue, 7 Jul 2026 10:06:41 GMT Received: from ex10.beckhoff.com ([62.159.14.12]) by mx07-0090a401.pphosted.com (PPS) with ESMTPS id 4f7fkt4mvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 Jul 2026 10:06:40 +0000 (GMT) Received: from ChristopherJNB03WSL.hs.beckhoff.dev (172.17.128.130) by ex10.beckhoff.com (172.17.2.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Tue, 7 Jul 2026 12:06:38 +0200 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 X-Greylist: delayed 449 seconds by postgrey-1.37 at lists.libvirt.org; Tue, 07 Jul 2026 06:14:12 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beckhoff.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=mail2022r; bh=bS3wZIkcWKXyAJVbI0CjQe jEqQH+VMTKUpX7FdgzLIo=; b=gB1TIeqi0yzF/JeBUbRB08zR1S4Dd8UGgMHBiv mLBJcuGEMld1RdkRxJrq1tqQ2LTk5Y/EG9vmViB0DRi4WzMbt75giHIgqP5aJLUU dD6CiyaDlsv19eUpvUDi7gjvwOgF4u5vMS4wEo53L5nLTtQfBAkTflpnOAU36Rnv H/Gy/dtqFl2S/GKbfm2CRedd2DUGSXPhtdFecGuWvLL6lTX07kAtBiJNxdEuSUVS PJjzyGLPiRtZ2tC45hy2YpYx9OnheYUbKho3O6ABt3eTvvVo8yaWr9Q5P68jbRq5 5sqTWzGz5WQNQKhnIefBZsrrtOLtnfs9sod2cg8ANh+8bxEg== From: Christopher Johannimloh To: Subject: [PATCH] node_device_udev: fix deadlock joining udev thread under lock Date: Tue, 7 Jul 2026 12:06:17 +0200 Message-ID: <20260707100627.159706-1-C.Johannimloh@beckhoff.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.128.130] X-ClientProxiedBy: ex13.beckhoff.com (172.17.6.19) To ex10.beckhoff.com (172.17.2.111) X-Authority-Analysis: v=2.4 cv=Vo4Txe2n c=1 sm=1 tr=0 ts=6a4ccfb0 cx=c_pps a=ZkhbYXbYXnnsONUOWLo3Bg==:117 a=ZkhbYXbYXnnsONUOWLo3Bg==:17 a=RKH2cFNGWWsA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=a9bgyBvlNMQzFU9Z5g25:22 a=PpDwSNkculO1Pa3iPHCZ:22 a=p0WdMEafAAAA:8 a=Cmw_MBCVAAAA:8 a=M-8mraxFhs9p085D8U8A:9 a=ZJSrCmYe3mwGoKZA4Vko:22 X-Proofpoint-ORIG-GUID: pgBeC2Wg7um-o4n5v1sn-XFRf3WpCwG8 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA3MDA5NyBTYWx0ZWRfX5N6GW+YlMDze nowpnVwuPoI+Sx9z0fF+tXkPY9CsWi4OSQyozXLd6Mb7DBnfCowlw9q9AppkQnynCO/fXUlKdOu 5l6nEyHdgUwZhEymgipr5bMe8ya6dsY= X-Proofpoint-GUID: pgBeC2Wg7um-o4n5v1sn-XFRf3WpCwG8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA3MDA5NyBTYWx0ZWRfX5HnJeKcasM45 UMqjYzRIa7INdx3kDH3eagY4YKCUE9MagA44RB+CuQLTV25Re4c8/Ze3bY+L7ftQzjChoU6Jxvc /SR1hFmoN1gV0pHC4sXVkMn1vs/AFeQjCNpoUstyhb+C6mDmX3SOYb+YJyVbH+JxeCORCQ/202y otLfmTRUAQJCRMVxup0tmzYq/ly2oqnFN3QdIyd5O7woIoakfW2YiG6OlfRE7pRCnMCMdPqBWj2 /qiW083cxIsTlfzyS6YA+Kbv6YJklpM2Qa26/BAUw1XMn2Mqigk1dK1pJTtEvvwtMDsGTZeZb0o 0VBQ8pqKKF3YO/mdnrjBHFEIHeaT97x+Cq2NykgHfcL/ijjq3TpvTHwnOtuSG9h5ov9+T3ekLoe jhF5SXeRnPjsz1zJLNx1myDNt3qlxZKo9S6XCJ0oQudxZE0+93EoCOevnmusLjWb7oMdfUYZtND YCg2X+itpjnokaD/0Tg== Content-Type: text/plain; charset="utf-8" X-MailFrom: C.Johannimloh@beckhoff.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation Message-ID-Hash: XGQEIVTBV4UE6W7KQLK5YR5WZG67XBWW X-Message-ID-Hash: XGQEIVTBV4UE6W7KQLK5YR5WZG67XBWW X-Mailman-Approved-At: Thu, 09 Jul 2026 09:20:40 +0000 CC: Christopher Johannimloh X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @beckhoff.com) X-ZM-MESSAGEID: 1783589235733158500 From: Christopher Johannimloh In our CI environment we install and purge all packages we use during a single test. During testing of libvirtd we observed intermittent hangs during apt purge of the libvirt packages. After investigation I found out that the hang is caused by a deadlock in nodeStateShutdownWait() which joins the udev thread while holding the lock of the udevEventData object. The udev thread needs the same lock to make progress and exit, so if the shutdown thread wins the race for the lock the join can never complete and the shutdown thread will later be killed by the 30s timeout [1]. [1] https://gitlab.com/libvirt/libvirt/-/blob/364977b94a776230037aa159be55b= b95f2a33399/src/rpc/virnetdaemon.c#L118 Fixes: e89d39f5b8f30f0b3284ed2bd71cee1a8a3d707d Signed-off-by: Christopher Johannimloh --- src/node_device/node_device_udev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 104433fb88..28c8f00361 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -2482,10 +2482,8 @@ nodeStateShutdownWait(void) if (!priv) return 0; =20 - VIR_WITH_OBJECT_LOCK_GUARD(priv) { - if (priv->udevThread) - virThreadJoin(priv->udevThread); - } + if (priv->udevThread) + virThreadJoin(priv->udevThread); =20 if (priv->workerPool) virThreadPoolDrain(priv->workerPool); --=20 2.47.3 This email contains confidential information. If you have received it in er= ror, you must not read, use, copy or pass on this e-mail or its attachments. If you have received the e-mail in error, please inform me immediately by r= eply e-mail and then delete this e-mail from your system. Thank you Diese E-Mail enth=C3=A4lt vertrauliche Informationen. Sollten Sie sie irrt= =C3=BCmlich erhalten haben, d=C3=BCrfen Sie diese E-Mail oder ihre Anh=C3= =A4nge nicht lesen, verwenden, kopieren oder weitergeben. Sollten Sie die Mail versehentlich erhalten haben, teilen Sie mir dies bitt= e umgehend per Antwort-E-Mail mit und l=C3=B6schen Sie diese E-Mail dann au= s Ihrem System. Vielen Dank Beckhoff Automation GmbH & Co. KG=20 Managing Director: Dipl. Phys. Hans Beckhoff Registered office: Verl, Germany=20 Register court: Guetersloh HRA 7075 DisclaimerID:x9d5u140