summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-09 10:05:54 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-10 11:10:00 -0700
commit0b4ae1c7742cec14395a0d845e1ed42b88b0e215 (patch)
tree3f48fdc3b9832adf418eca3d1e82802feee8bd76 /bitbake
parent6f3a537dda7ea84379fc11c1ec42cfdfeaf68bd4 (diff)
downloadpoky-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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py7
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
37import bb, bb.exceptions, bb.command 37import bb, bb.exceptions, bb.command
38from bb import utils, data, parse, event, cache, providers, taskdata, runqueue 38from bb import utils, data, parse, event, cache, providers, taskdata, runqueue
39import Queue 39import Queue
40import signal
40import prserv.serv 41import prserv.serv
41 42
42logger = logging.getLogger("BitBake") 43logger = 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: