diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-09 10:05:54 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-09 18:58:49 -0700 |
commit | 00c22434123739b0819b31d7b1d353901a3e12da (patch) | |
tree | 95cbdebb250acad192fff112595efd6cebfb68b5 /lib/bb/cooker.py | |
parent | 0d12041eceeae6bba2034b04913bb13abd67bd15 (diff) | |
download | openembedded-core-contrib-00c22434123739b0819b31d7b1d353901a3e12da.tar.gz |
cooker: Handle SIGTERM more gracefully
If the cooker receives a SIGTERM it currently hangs using 100% CPU,
This patch adds in an intercept for the event and puts the cooker into
shutdown mode allowing it to exit cleanly/safely and avoiding the hang.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/cooker.py')
-rw-r--r-- | lib/bb/cooker.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 8d63195189..9cb74d1818 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -37,6 +37,7 @@ from collections import defaultdict import bb, bb.exceptions, bb.command from bb import utils, data, parse, event, cache, providers, taskdata, runqueue import Queue +import signal import prserv.serv logger = logging.getLogger("BitBake") @@ -149,6 +150,12 @@ class BBCooker: self.parser = None + signal.signal(signal.SIGTERM, self.sigterm_exception) + + def sigterm_exception(self, signum, stackframe): + bb.warn("Cooker recieved SIGTERM, shutting down...") + self.state = state.forceshutdown + def setFeatures(self, features): original_featureset = list(self.featureset) for feature in features: |