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:14 +0000 |
commit | 32da768ae67cfe0b2d154ce4667a7cfdfa5bf4b0 (patch) | |
tree | a20a65a4bb1d549b4b9edd4bb08c1e3dceedc7e7 | |
parent | b5215887d2f8ea3f28f1ebda721bd5b8f93ec7f3 (diff) | |
download | bitbake-32da768ae67cfe0b2d154ce4667a7cfdfa5bf4b0.tar.gz |
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/tinfoil.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py index 8978bb526..91fbf1b13 100644 --- a/lib/bb/tinfoil.py +++ b/lib/bb/tinfoil.py @@ -10,6 +10,7 @@ import logging import os import sys +import time import atexit import re from collections import OrderedDict, defaultdict @@ -729,6 +730,7 @@ class Tinfoil: ret = self.run_command('buildTargets', targets, task) if handle_events: + lastevent = time.time() result = False # Borrowed from knotty, instead somewhat hackily we use the helper # as the object to store "shutdown" on @@ -741,6 +743,7 @@ class Tinfoil: try: event = self.wait_event(0.25) if event: + lastevent = time.time() if event_callback and event_callback(event): continue if helper.eventHandler(event): @@ -785,10 +788,13 @@ class Tinfoil: self.logger.error(str(event)) result = False break - elif helper.shutdown > 1: break termfilter.updateFooter() + if time.time() > (lastevent + (3*60)): + if not self.run_command('ping', handle_events=False): + print("\nUnable to ping server and no events, closing down...\n") + return False except KeyboardInterrupt: termfilter.clearFooter() if helper.shutdown == 1: |