[NEW PATCH] BZ#723579 - Disown child procs so they wouldn't hold VDSM shutdown (via gerrit-bot)

Saggi Mizrahi smizrahi at redhat.com
Mon Aug 29 13:20:22 UTC 2011


New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/863

commit b705b2249e4635a1e3f3c4feeede53081c8a6a52
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date:   Mon Aug 29 16:13:24 2011 +0300

    BZ#723579 - Disown child procs so they wouldn't hold VDSM shutdown
    
    This patch touches a protected variable in the python multiprocessing
    framework. This is not ideal but necessary to keep VDSM from getting
    stuck waiting for a child.
    
    Change-Id: I7b96b6ac5b35e28cb2f8232f580651a3a36db295

diff --git a/vdsm/storage/processPool.py b/vdsm/storage/processPool.py
index fc843c4..6c6632d 100644
--- a/vdsm/storage/processPool.py
+++ b/vdsm/storage/processPool.py
@@ -18,7 +18,7 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-from multiprocessing import Pipe, Process
+from multiprocessing import Pipe, Process, current_process
 from threading import Lock
 import os
 import signal
@@ -111,6 +111,11 @@ class ProcessPool(object):
         # The locks remain locked of purpose so no one will
         # be able to run further commands
 
+def disown(proc):
+    # I know touching _children is wrong but there is no public API for
+    # disowning a child
+    current_process()._children.discard(proc)
+
 class Helper(object):
     def __init__(self):
         self.lifeline, childsLifeline = os.pipe()
@@ -118,6 +123,8 @@ class Helper(object):
         self.proc = Process(target=_helperMainLoop, args=(hisPipe, childsLifeline, self.lifeline))
         self.proc.daemon = True
         self.proc.start()
+        disown(self.proc)
+
         os.close(childsLifeline)
 
     def kill(self):




More information about the vdsm-patches mailing list