aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-21 21:47:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-22 00:06:46 +0100
commita16185e602b39b71475aa7e9ee80ad2b1f28d0f7 (patch)
tree1bed59a17496550a48e6819919ccbf6a813d8f6b
parent25bfa2478f1c3a8eb695e1e5760e06db5be8f2fc (diff)
downloadbitbake-a16185e602b39b71475aa7e9ee80ad2b1f28d0f7.tar.gz
utils: Add workaround for multiprocessing bug
Our usage of multitprocessing is problematic. In particular, there is a bug in python 2.7 multiprocessing where signals are not handled until command completion instead of immediately. This adds a workaround into our wrapper function to deal with the issue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index f62709bed..4c894cbb0 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -884,5 +884,17 @@ def process_profilelog(fn):
# Was present to work around multiprocessing pool bugs in python < 2.7.3
#
def multiprocessingpool(*args, **kwargs):
+
+ import multiprocessing.pool
+ #import multiprocessing.util
+ #multiprocessing.util.log_to_stderr(10)
+ # Deal with a multiprocessing bug where signals to the processes would be delayed until the work
+ # completes. Putting in a timeout means the signals (like SIGINT/SIGTERM) get processed.
+ def wrapper(func):
+ def wrap(self, timeout=None):
+ return func(self, timeout=timeout if timeout is not None else 1e100)
+ return wrap
+ multiprocessing.pool.IMapIterator.next = wrapper(multiprocessing.pool.IMapIterator.next)
+
return multiprocessing.Pool(*args, **kwargs)