[5/6] cooker: Ensure parsing processes have close called

Message ID 20220326203458.1391301-5-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/6] cooker: Fix exception handling in parsers | expand

Commit Message

Richard Purdie March 26, 2022, 8:34 p.m. UTC
With pyhon 3.7 there is a close method which collects the process' return
value and ensures zombines don't hang around. Add that call. Also join terminated
processes before closing since the signal might not be instantaneous.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cooker.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 2264b18c54..4b8b18a68d 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2198,8 +2198,10 @@  class CookerParser(object):
             if force:
                 process.join(.1)
                 process.terminate()
-            else:
-                process.join()
+            process.join()
+            # Added in 3.7, cleans up zombies
+            if hasattr(process, "close"):
+                process.close()
 
         self.parser_quit.close()
         # Allow data left in the cancel queue to be discarded