]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
server/process: Fix missing log messages issue
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 12 May 2016 22:27:25 +0000 (23:27 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 13 May 2016 21:05:10 +0000 (22:05 +0100)
Currently if the server dies, its possible that log messages are never
displayed which is particularly problematic if one of those messages
is the exception and backtrace the server died with.

Rather than having the event queue exit as soon as the server disappears,
we should pop events from the queue until its empty before exiting.

This patch tweaks that code so that even if the server is dead and we're
going to exit, we return any events left in the pipe. This makes
debugging certain failures much easier.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/server/process.py

index a3078a873dcaa7f45c8c14b49fe96f8ef96cae27..cc58c720a2a91fe9c2bb8541b09fde73dc9b7d56 100644 (file)
@@ -222,11 +222,10 @@ class ProcessEventQueue(multiprocessing.queues.Queue):
 
     def waitEvent(self, timeout):
         if self.exit:
-            sys.exit(1)
+            return self.getEvent()
         try:
             if not self.server.is_alive():
-                self.setexit()
-                return None
+                return self.getEvent()
             return self.get(True, timeout)
         except Empty:
             return None
@@ -235,9 +234,10 @@ class ProcessEventQueue(multiprocessing.queues.Queue):
         try:
             if not self.server.is_alive():
                 self.setexit()
-                return None
             return self.get(False)
         except Empty:
+            if self.exit:
+                sys.exit(1)
             return None