aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-07 14:58:22 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-08 21:52:45 +0100
commitf5ad8349a5dbff9824a89f5708cfd011d61888c9 (patch)
tree0d7eed2e573407add29429b5c4472c88b5ad600a /lib
parentbd12792f28efd2f03510653ec947ebf961315272 (diff)
downloadbitbake-contrib-f5ad8349a5dbff9824a89f5708cfd011d61888c9.tar.gz
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/server/process.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 74b74dc39..02bef3506 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -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):