summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server
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:53:15 +0100
commitce592bc9ac9c503176699b96ae4340f1b9b9bedc (patch)
tree51fde0f1fd46421e5b777485cfa8f8c58213aede /bitbake/lib/bb/server
parent5940020cfb721d79111072b3cd5d581fff59561b (diff)
downloadpoky-ce592bc9ac9c503176699b96ae4340f1b9b9bedc.tar.gz
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>
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r--bitbake/lib/bb/server/process.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 74b74dc39b..02bef3506f 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -437,6 +437,7 @@ class BitBakeProcessServerConnection(object):
437 self.socket_connection = sock 437 self.socket_connection = sock
438 438
439 def terminate(self): 439 def terminate(self):
440 self.events.close()
440 self.socket_connection.close() 441 self.socket_connection.close()
441 self.connection.connection.close() 442 self.connection.connection.close()
442 self.connection.recv.close() 443 self.connection.recv.close()
@@ -662,7 +663,6 @@ class BBUIEventQueue:
662 self.reader = ConnectionReader(readfd) 663 self.reader = ConnectionReader(readfd)
663 664
664 self.t = threading.Thread() 665 self.t = threading.Thread()
665 self.t.daemon = True
666 self.t.run = self.startCallbackHandler 666 self.t.run = self.startCallbackHandler
667 self.t.start() 667 self.t.start()
668 668
@@ -693,13 +693,17 @@ class BBUIEventQueue:
693 bb.utils.set_process_name("UIEventQueue") 693 bb.utils.set_process_name("UIEventQueue")
694 while True: 694 while True:
695 try: 695 try:
696 self.reader.wait() 696 ready = self.reader.wait(0.25)
697 event = self.reader.get() 697 if ready:
698 self.queue_event(event) 698 event = self.reader.get()
699 except EOFError: 699 self.queue_event(event)
700 except (EOFError, OSError):
700 # Easiest way to exit is to close the file descriptor to cause an exit 701 # Easiest way to exit is to close the file descriptor to cause an exit
701 break 702 break
703
704 def close(self):
702 self.reader.close() 705 self.reader.close()
706 self.t.join()
703 707
704class ConnectionReader(object): 708class ConnectionReader(object):
705 709