@@ -437,6 +437,7 @@ class BitBakeProcessServerConnection(object):
self.socket_connection = sock
def terminate(self):
+ self.events.close()
self.socket_connection.close()
self.connection.connection.close()
self.connection.recv.close()
@@ -662,7 +663,6 @@ class BBUIEventQueue:
self.reader = ConnectionReader(readfd)
self.t = threading.Thread()
- self.t.daemon = True
self.t.run = self.startCallbackHandler
self.t.start()
@@ -693,13 +693,16 @@ class BBUIEventQueue:
bb.utils.set_process_name("UIEventQueue")
while True:
try:
- self.reader.wait()
+ self.reader.wait(0.25)
event = self.reader.get()
self.queue_event(event)
- except EOFError:
+ except (EOFError, OSError):
# Easiest way to exit is to close the file descriptor to cause an exit
break
+
+ def close(self):
self.reader.close()
+ self.t.join()
class ConnectionReader(object):
We're seeing UI deadlocks occasionally and this is possibly due to the use of a daemonic thread in the UI event queue processing. This thread could terminate holding a threading Lock() which would cause issues for the process when exitting. Change the shutdown process to handle this more cleanly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/server/process.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)