diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-16 14:01:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-17 10:19:59 +0000 |
commit | f3e56f1b57584a136e14386fec2de95e73960eb4 (patch) | |
tree | d230ee269b9628b9fc976437f609b91996413d00 | |
parent | 050aab7f45ed13e01da5ff760e8292c091b27ee6 (diff) | |
download | poky-f3e56f1b57584a136e14386fec2de95e73960eb4.tar.gz |
lib/oe/utils: Fix hang in multiprocess_launch()
If large results values are returned by the subprocesses, we can hit a deadlock
where the subprocess is trying to write data back to the parent, the pipe is full
and the parent is waiting for the child to exit.
Avoid this by calling the update() method which would trigger reading a result
from the child, avoiding the deadlock. The issue is described in
https://bugs.python.org/issue8426
(From OE-Core rev: 0035e8066ecbbff94d6a1994a9f72b1368d660d2)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 0c1d48a209..3a496090f3 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -307,6 +307,10 @@ def multiprocess_launch(target, items, d, extraargs=None): | |||
307 | p.start() | 307 | p.start() |
308 | launched.append(p) | 308 | launched.append(p) |
309 | for q in launched: | 309 | for q in launched: |
310 | # Have to manually call update() to avoid deadlocks. The pipe can be full and | ||
311 | # transfer stalled until we try and read the results object but the subprocess won't exit | ||
312 | # as it still has data to write (https://bugs.python.org/issue8426) | ||
313 | q.update() | ||
310 | # The finished processes are joined when calling is_alive() | 314 | # The finished processes are joined when calling is_alive() |
311 | if not q.is_alive(): | 315 | if not q.is_alive(): |
312 | if q.exception: | 316 | if q.exception: |