From: Christopher Johannimloh <[email protected]>

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/364977b94a776230037aa159be55bb95f2a33399/src/rpc/virnetdaemon.c#L118

Fixes: e89d39f5b8f30f0b3284ed2bd71cee1a8a3d707d

Signed-off-by: Christopher Johannimloh <[email protected]>
---
 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_device_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;
 
-    VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-        if (priv->udevThread)
-            virThreadJoin(priv->udevThread);
-    }
+    if (priv->udevThread)
+        virThreadJoin(priv->udevThread);
 
     if (priv->workerPool)
         virThreadPoolDrain(priv->workerPool);
-- 
2.47.3




This email contains confidential information. If you have received it in error, 
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 reply 
e-mail and then delete this e-mail from your system. Thank you

Diese E-Mail enthält vertrauliche Informationen. Sollten Sie sie irrtümlich 
erhalten haben, dürfen Sie diese E-Mail oder ihre Anhänge nicht lesen, 
verwenden, kopieren oder weitergeben.
Sollten Sie die Mail versehentlich erhalten haben, teilen Sie mir dies bitte 
umgehend per Antwort-E-Mail mit und löschen Sie diese E-Mail dann aus Ihrem 
System. Vielen Dank

Beckhoff Automation GmbH & Co. KG 
Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany 
Register court: Guetersloh HRA 7075

DisclaimerID:x9d5u140

Reply via email to