rebaseline from garden-o-matic leaves N processes each time it is run
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jun 2012 17:39:41 +0000 (17:39 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jun 2012 17:39:41 +0000 (17:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88586

Reviewed by Dirk Pranke.

This appears to only be a problem on python 2.7. Maybe a bug causing
pools to not be garbage collected?

* Scripts/webkitpy/common/system/executive.py:
(Executive.run_in_parallel): close() and join() the process pool.
* Scripts/webkitpy/common/system/executive_unittest.py:
(ExecutiveTest.test_run_in_parallel):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119986 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/common/system/executive.py
Tools/Scripts/webkitpy/common/system/executive_unittest.py

index e605f8b..7897a6c 100644 (file)
@@ -1,3 +1,18 @@
+2012-06-11  Tony Chang  <tony@chromium.org>
+
+        rebaseline from garden-o-matic leaves N processes each time it is run
+        https://bugs.webkit.org/show_bug.cgi?id=88586
+
+        Reviewed by Dirk Pranke.
+
+        This appears to only be a problem on python 2.7. Maybe a bug causing
+        pools to not be garbage collected?
+
+        * Scripts/webkitpy/common/system/executive.py:
+        (Executive.run_in_parallel): close() and join() the process pool.
+        * Scripts/webkitpy/common/system/executive_unittest.py:
+        (ExecutiveTest.test_run_in_parallel):
+
 2012-06-11  Zoltan Horvath  <zoltan@webkit.org>
 
         [Qt] Add config tests for WEBP imagedecoder library, modify HAVE(decoderlibrary) to USE(...)
index 90c8620..cb36b5d 100644 (file)
@@ -456,7 +456,11 @@ class Executive(object):
         """Runs a list of (cmd_line list, cwd string) tuples in parallel and returns a list of (retcode, stdout, stderr) tuples."""
         if sys.platform in ('cygwin', 'win32'):
             return map(_run_command_thunk, command_lines_and_cwds)
-        return multiprocessing.Pool(processes=processes).map(_run_command_thunk, command_lines_and_cwds)
+        pool = multiprocessing.Pool(processes=processes)
+        results = pool.map(_run_command_thunk, command_lines_and_cwds)
+        pool.close()
+        pool.join()
+        return results
 
 
 def _run_command_thunk(cmd_line_and_cwd):
index 7ba8428..212896a 100644 (file)
@@ -220,6 +220,7 @@ class ExecutiveTest(unittest.TestCase):
     def test_run_in_parallel(self):
         if sys.platform in ("win32", "cygwin"):
             return  # This function isn't implemented properly on windows yet.
+        import multiprocessing
 
         NUM_PROCESSES = 4
         DELAY_SECS = 0.25
@@ -231,6 +232,7 @@ class ExecutiveTest(unittest.TestCase):
         done = time.time()
         self.assertTrue(done - start < NUM_PROCESSES * DELAY_SECS)
         self.assertEquals([output[1] for output in command_outputs], ["hello\n"] * NUM_PROCESSES)
+        self.assertEquals([],  multiprocessing.active_children())
 
 
 def main(platform, stdin, stdout, cmd, args):