1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

bitbake: server/process: Remove daemonic thread usage

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.

(Bitbake rev: f5ad8349a5dbff9824a89f5708cfd011d61888c9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-06-07 14:58:22 +01:00
parent 5940020cfb
commit ce592bc9ac
+9 -5
View File
@@ -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,17 @@ class BBUIEventQueue:
bb.utils.set_process_name("UIEventQueue")
while True:
try:
self.reader.wait()
event = self.reader.get()
self.queue_event(event)
except EOFError:
ready = self.reader.wait(0.25)
if ready:
event = self.reader.get()
self.queue_event(event)
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):