<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">Looks like you’re partially duplicating what the ‘force’ logic does already, but for the non-force case as well, yes? process.terminate() sounds a lot like sending a SIGTERM, though admittedly I haven’t read the code to Process recently. Perhaps if this is truly necessary, the logic can be simplified.</div>
</div>
<div name="messageReplySection">On Aug 22, 2019, 12:10 AM -0700, Robert Yang <liezhi.yang@windriver.com>, wrote:<br />
<blockquote type="cite" class="spark_quote" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">Fixed:<br />
$ echo helloworld >> meta/recipes-extended/bash/bash_4.4.18.bb<br />
$ while true; do kill-bb; rm -fr bitbake-cookerdaemon.log tmp/cache/default-glibc/qemux86-64/x86_64/bb_cache.dat* ; bitbake -p; done<br />
<br />
It may hang in 10 mins, there are two problems:<br />
* There might be deadlocks when call process.join() if the queue is not NULL,<br />
so we need cleanup the queue before join() it, but:<br />
* The self.result_queue.get(timeout=0.25) may hang if the queue._wlock is hold<br />
by SomeOtherProcess, the queue has the following info when it hangs:<br />
'_wlock': <Lock(owner=SomeOtherProcess)>, so that we may can't clean up the<br />
queue.<br />
<br />
We can kill alvie process before join it to fix the problems.<br />
<br />
Signed-off-by: Robert Yang <liezhi.yang@windriver.com><br />
---<br />
bitbake/lib/bb/cooker.py | 12 ++++--------<br />
1 file changed, 4 insertions(+), 8 deletions(-)<br />
<br />
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py<br />
index 0607fcc..e42bcba 100644<br />
--- a/bitbake/lib/bb/cooker.py<br />
+++ b/bitbake/lib/bb/cooker.py<br />
@@ -2082,19 +2082,15 @@ class CookerParser(object):<br />
for process in self.processes:<br />
self.parser_quit.put(None)<br />
<br />
- # Cleanup the queue before call process.join(), otherwise there might be<br />
- # deadlocks.<br />
- while True:<br />
- try:<br />
- self.result_queue.get(timeout=0.25)<br />
- except queue.Empty:<br />
- break<br />
-<br />
for process in self.processes:<br />
if force:<br />
process.join(.1)<br />
process.terminate()<br />
else:<br />
+ # Kill the alive process firstly before join() it to avoid<br />
+ # deadlocks<br />
+ if process.is_alive():<br />
+ os.kill(process.pid, 9)<br />
process.join()<br />
<br />
sync = threading.Thread(target=self.bb_cache.sync)<br />
--<br />
2.7.4<br />
<br />
--<br />
_______________________________________________<br />
bitbake-devel mailing list<br />
bitbake-devel@lists.openembedded.org<br />
http://lists.openembedded.org/mailman/listinfo/bitbake-devel<br /></blockquote>
</div>
</body>
</html>