[NEW PATCH] BZ#732652 Avoid logging in the processPool Helper (via gerrit-bot)

Federico Simoncelli fsimonce at redhat.com
Wed Sep 7 09:12:35 UTC 2011


New patch submitted by Federico Simoncelli (fsimonce at redhat.com)

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

commit 3c8ecc949950abce2594ea137f28d29220b195b2
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Thu Sep 1 09:39:04 2011 +0000

    BZ#732652 Avoid logging in the processPool Helper
    
    Logging can cause a deadlock in a multi-threaded multi-process
    environment therefore closing the logging file descriptors is
    not enough we should also remove all the handlers.
    Reference: http://bugs.python.org/issue6721
    
    Change-Id: Ic70c2b390db23b48f96ba677054039d2773960ae

diff --git a/vdsm/storage/processPool.py b/vdsm/storage/processPool.py
index 74cede5..2a2d364 100644
--- a/vdsm/storage/processPool.py
+++ b/vdsm/storage/processPool.py
@@ -156,6 +156,13 @@ class Helper(object):
 def _helperMainLoop(pipe, lifeLine, parentLifelineFD):
     os.close(parentLifelineFD)
 
+    # Removing all the handlers from the loggers. This avoid a deadlock on
+    # the logging locks. Multi-process and multi-threading don't mix well.
+    #   - BZ#732652: https://bugzilla.redhat.com/show_bug.cgi?id=732652
+    #   - I6721: http://bugs.python.org/issue6721
+    for log in logging.Logger.manager.loggerDict.values():
+        if hasattr(log, 'handlers'): del log.handlers[:]
+
     # Close all file-descriptors we don't need
     # Logging won't work past this point
     for fd in misc.getfds():




More information about the vdsm-patches mailing list