diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-11 14:31:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-11 23:14:48 +0000 |
commit | 92c0dba45611e33e6e929c5032e35a202a5c32b6 (patch) | |
tree | 878c8b87542a80ce823dc0d4a0c81d19689420c0 /bitbake/lib/bb | |
parent | 3d67b6c60fa968cd36b51c63e2a7f11bb87dd315 (diff) | |
download | poky-92c0dba45611e33e6e929c5032e35a202a5c32b6.tar.gz |
bitbake: tinfoil: Don't wait for events indefinitely
If for some reason the bitbake server dies, we shouldn't loop indefinitely
waiting for events within tinfoil. Add a ping test and exit if things
have somehow failed.
(Bitbake rev: 32da768ae67cfe0b2d154ce4667a7cfdfa5bf4b0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 8978bb5261..91fbf1b13e 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -10,6 +10,7 @@ | |||
10 | import logging | 10 | import logging |
11 | import os | 11 | import os |
12 | import sys | 12 | import sys |
13 | import time | ||
13 | import atexit | 14 | import atexit |
14 | import re | 15 | import re |
15 | from collections import OrderedDict, defaultdict | 16 | from collections import OrderedDict, defaultdict |
@@ -729,6 +730,7 @@ class Tinfoil: | |||
729 | 730 | ||
730 | ret = self.run_command('buildTargets', targets, task) | 731 | ret = self.run_command('buildTargets', targets, task) |
731 | if handle_events: | 732 | if handle_events: |
733 | lastevent = time.time() | ||
732 | result = False | 734 | result = False |
733 | # Borrowed from knotty, instead somewhat hackily we use the helper | 735 | # Borrowed from knotty, instead somewhat hackily we use the helper |
734 | # as the object to store "shutdown" on | 736 | # as the object to store "shutdown" on |
@@ -741,6 +743,7 @@ class Tinfoil: | |||
741 | try: | 743 | try: |
742 | event = self.wait_event(0.25) | 744 | event = self.wait_event(0.25) |
743 | if event: | 745 | if event: |
746 | lastevent = time.time() | ||
744 | if event_callback and event_callback(event): | 747 | if event_callback and event_callback(event): |
745 | continue | 748 | continue |
746 | if helper.eventHandler(event): | 749 | if helper.eventHandler(event): |
@@ -785,10 +788,13 @@ class Tinfoil: | |||
785 | self.logger.error(str(event)) | 788 | self.logger.error(str(event)) |
786 | result = False | 789 | result = False |
787 | break | 790 | break |
788 | |||
789 | elif helper.shutdown > 1: | 791 | elif helper.shutdown > 1: |
790 | break | 792 | break |
791 | termfilter.updateFooter() | 793 | termfilter.updateFooter() |
794 | if time.time() > (lastevent + (3*60)): | ||
795 | if not self.run_command('ping', handle_events=False): | ||
796 | print("\nUnable to ping server and no events, closing down...\n") | ||
797 | return False | ||
792 | except KeyboardInterrupt: | 798 | except KeyboardInterrupt: |
793 | termfilter.clearFooter() | 799 | termfilter.clearFooter() |
794 | if helper.shutdown == 1: | 800 | if helper.shutdown == 1: |