Fixes for KeyboardInterrupt during parsing and building
cover Fixes for KeyboardInterrupt during parsing and building
The following changes since commit 88c6be81a5fbed098999fbef5576c5e0bb90cc21:
opensbi: handle deploy task under sstate (2019-08-06 11:24:27 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib rbt/key
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/key
Robert Yang (2):
cooker: Cleanup the queue before call process.join()
knotty: Fix for the Second Keyboard Interrupt
bitbake/lib/bb/cooker.py | 8 ++++++++ bitbake/lib/bb/ui/knotty.py | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/2 cooker: Cleanup the queue before call process.join()
Fixed:
$ rm -fr tmp-glibc/cache/default-glibc/qemux86/x86_64/bb_cache.dat* ; bitbake -p Press *one* Ctrl-C when the parsing process is at about 50%, then the processes are not exited:
Keyboard Interrupt, closing down...
Timeout while waiting for a reply from the bitbake server
It hangs at process.join(), according to:
https://docs.python.org/3.7/library/multiprocessing.html
Cleanup the queue before call process.join() can fix the problem.
--- bitbake/lib/bb/cooker.py | 8 ++++++++ 1 file changed, 8 insertions(+)
bitbake/lib/bb/cooker.py +8 -0
@@ -2077,6 +2077,14 @@ class CookerParser(object): for process in self.processes: self.parser_quit.put(None) + # Cleanup the queue before call process.join(), otherwise there might be + # deadlocks. + while True: + try: + self.result_queue.get(timeout=0.25) + except queue.Empty: + break + for process in self.processes: if force: process.join(.1)
Signature · 1 line
2.7.4
PATCH 2/2 knotty: Fix for the Second Keyboard Interrupt
In reply to Robert YangFixed:
$ rm -fr tmp-glibc/cache/default-glibc/qemux86/x86_64/bb_cache.dat* ; bitbake -p Press the first Ctrl-C when the parsing process is at about 50%:
Keyboard Interrupt, closing down...
Then presss the second Ctrl-C:
File "/path/to/bitbake/bitbake/lib/bb/ui/knotty.py", line 619, in main
event = eventHandler.waitEvent(0.25)
File "/path/to/bitbake/lib/bb/server/process.py", line 591, in waitEvent
self.eventQueueNotify.wait(delay)
File "/usr/lib/python3.5/threading.py", line 549, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.5/threading.py", line 297, in wait
gotit = waiter.acquire(True, timeout)
KeyboardInterrupt
Capture the second KeyboardInterrupt during stateShutdown is running can fix the problem. There may be still tracebacks for the third KeyboardInterrupt, but I'm leaning to not fix it since we aimed for supporting 2 KeyboardInterrupts only.
--- bitbake/lib/bb/ui/knotty.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/knotty.py +14 -4
@@ -689,17 +689,27 @@ def main(server, eventHandler, params, tf = TerminalFilter): if params.observe_only: print("\nKeyboard Interrupt, exiting observer...") main.shutdown = 2 - if not params.observe_only and main.shutdown == 1: + + def state_force_shutdown(): print("\nSecond Keyboard Interrupt, stopping...\n") _, error = server.runCommand(["stateForceShutdown"]) if error: logger.error("Unable to cleanly stop: %s" % error) + + if not params.observe_only and main.shutdown == 1: + state_force_shutdown() + if not params.observe_only and main.shutdown == 0: print("\nKeyboard Interrupt, closing down...\n") interrupted = True - _, error = server.runCommand(["stateShutdown"]) - if error: - logger.error("Unable to cleanly shutdown: %s" % error) + # Capture the second KeyboardInterrupt during stateShutdown is running + try: + _, error = server.runCommand(["stateShutdown"]) + if error: + logger.error("Unable to cleanly shutdown: %s" % error) + except KeyboardInterrupt: + state_force_shutdown() + main.shutdown = main.shutdown + 1 pass except Exception as e:
Signature · 1 line
2.7.4