In python's thread package implementation thread.allocate_lock is being used
in each creation of new thread (python.__bootstrap_inner).
Vdsm faced few scenarios where the thread run was stuck in this function.
We assume that this lock implementation contains a deadlock bug. Therefore
this patch replaces thread.allocate_lock with python-pthreading Lock object
(which uses pthread mutex).

Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
---
 pthreading.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pthreading.py b/pthreading.py
index 916ca7f..2e9e2d6 100644
--- a/pthreading.py
+++ b/pthreading.py
@@ -127,13 +127,15 @@ class Condition(object):
 
 def monkey_patch():
     """
-    Hack threading module to use our classes
+    Hack threading and thread modules to use our classes
 
     Thus, Queue and SocketServer can easily enjoy them.
     """
 
-    import threading
+    import thread
+    thread.allocate_lock = Lock
 
+    import threading
     threading.Condition = Condition
     threading.Lock = Lock
     threading.RLock = RLock
-- 
1.8.5.3

_______________________________________________
vdsm-devel mailing list
vdsm-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-devel

Reply via email to