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-10 11:10:00 -0700 |
commit | 0b4ae1c7742cec14395a0d845e1ed42b88b0e215 (patch) | |
tree | 3f48fdc3b9832adf418eca3d1e82802feee8bd76 | |
parent | 6f3a537dda7ea84379fc11c1ec42cfdfeaf68bd4 (diff) | |
download | poky-0b4ae1c7742cec14395a0d845e1ed42b88b0e215.tar.gz |
bitbake: 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.
(Bitbake rev: 00c22434123739b0819b31d7b1d353901a3e12da)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 8d63195189..9cb74d1818 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -37,6 +37,7 @@ from collections import defaultdict | |||
37 | import bb, bb.exceptions, bb.command | 37 | import bb, bb.exceptions, bb.command |
38 | from bb import utils, data, parse, event, cache, providers, taskdata, runqueue | 38 | from bb import utils, data, parse, event, cache, providers, taskdata, runqueue |
39 | import Queue | 39 | import Queue |
40 | import signal | ||
40 | import prserv.serv | 41 | import prserv.serv |
41 | 42 | ||
42 | logger = logging.getLogger("BitBake") | 43 | logger = logging.getLogger("BitBake") |
@@ -149,6 +150,12 @@ class BBCooker: | |||
149 | 150 | ||
150 | self.parser = None | 151 | self.parser = None |
151 | 152 | ||
153 | signal.signal(signal.SIGTERM, self.sigterm_exception) | ||
154 | |||
155 | def sigterm_exception(self, signum, stackframe): | ||
156 | bb.warn("Cooker recieved SIGTERM, shutting down...") | ||
157 | self.state = state.forceshutdown | ||
158 | |||
152 | def setFeatures(self, features): | 159 | def setFeatures(self, features): |
153 | original_featureset = list(self.featureset) | 160 | original_featureset = list(self.featureset) |
154 | for feature in features: | 161 | for feature in features: |