[PATCH] Log when we acquire and release the _yum_lock (dlehman, clumens).

Chris Lumens clumens at redhat.com
Wed Mar 6 23:14:28 UTC 2013


We've got a temporary locking issue somewhere that causes the UI to become
unresponsive for a bit (see #886680, perhaps other bugs).  Examining the code
indicates this isn't necessarily due to running things in the main loop
that shouldn't be.  There's something waiting for the _yum_lock.  This patch
adds logging to help debug.
---
 pyanaconda/packaging/yumpayload.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 9549420..fe132f7 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -94,9 +94,25 @@ from pykickstart.constants import KS_MISSING_IGNORE
 
 default_repos = [productName.lower(), "rawhide"]
 
-from threading import RLock
-_yum_lock = RLock()
+import inspect
+import threading
+_private_yum_lock = threading.RLock()
 
+class YumLock(object):
+    def __enter__(self):
+        frame = inspect.stack()[2]
+        threadName = threading.currentThread().name
+
+        log.info("about to acquire _yum_lock for %s at %s:%s (%s)" % (threadName, frame[1], frame[2], frame[3]))
+        _private_yum_lock.acquire()
+        log.info("have _yum_lock for %s" % threadName)
+        return _private_yum_lock
+
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        _private_yum_lock.release()
+        log.info("gave up _yum_lock for %s" % threading.currentThread().name)
+
+_yum_lock = YumLock()
 _yum_cache_dir = "/tmp/yum.cache"
 
 class YumPayload(PackagePayload):
-- 
1.8.1.2



More information about the anaconda-patches mailing list