summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2014-11-17 02:27:36 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2015-01-09 08:52:22 -0800
commit7eb33cdb4d4f3daf7de3c018bbad9c39eccaa597 (patch)
treee894b6dd2b3f8da3b3b9c5c809756ef646c030fa /bitbake
parente716dc80b3bfe11b5a4f8f522eb7cb2f3b1eb55c (diff)
downloadtizen-distro-7eb33cdb4d4f3daf7de3c018bbad9c39eccaa597.tar.gz
tizen-distro-7eb33cdb4d4f3daf7de3c018bbad9c39eccaa597.tar.bz2
tizen-distro-7eb33cdb4d4f3daf7de3c018bbad9c39eccaa597.zip
bitbake: bitbake-worker: exit normally when SIGHUP
Fixed: 1) Run "bitbake recipe" in the terminal 2) Close the terminal while building 3) $ ps aux | grep bitbake-worker There will be many processes, and they will keep the resources (e.g., memory), and won't exit unless kill or kill -9. (Bitbake rev: 72536d4e0cc3379001b730950afa012f7a96a79b) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker9
-rw-r--r--bitbake/lib/bb/cooker.py7
2 files changed, 14 insertions, 2 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index dde2c9c8fc..371c99a677 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -147,6 +147,8 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, taskdepdat
pipein.close()
signal.signal(signal.SIGTERM, sigterm_handler)
+ # Let SIGHUP exit as SIGTERM
+ signal.signal(signal.SIGHUP, sigterm_handler)
# Save out the PID so that the event can include it the
# events
@@ -266,9 +268,14 @@ class BitbakeWorker(object):
self.build_pipes = {}
signal.signal(signal.SIGTERM, self.sigterm_exception)
+ # Let SIGHUP exit as SIGTERM
+ signal.signal(signal.SIGHUP, self.sigterm_exception)
def sigterm_exception(self, signum, stackframe):
- bb.warn("Worker recieved SIGTERM, shutting down...")
+ if signum == signal.SIGTERM:
+ bb.warn("Worker recieved SIGTERM, shutting down...")
+ elif signum == signal.SIGHUP:
+ bb.warn("Worker recieved SIGHUP, shutting down...")
self.handle_finishnow(None)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
os.kill(os.getpid(), signal.SIGTERM)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index c6c69c30ea..a900b07a80 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -153,9 +153,14 @@ class BBCooker:
self.parser = None
signal.signal(signal.SIGTERM, self.sigterm_exception)
+ # Let SIGHUP exit as SIGTERM
+ signal.signal(signal.SIGHUP, self.sigterm_exception)
def sigterm_exception(self, signum, stackframe):
- bb.warn("Cooker recieved SIGTERM, shutting down...")
+ if signum == signal.SIGTERM:
+ bb.warn("Cooker recieved SIGTERM, shutting down...")
+ elif signum == signal.SIGHUP:
+ bb.warn("Cooker recieved SIGHUP, shutting down...")
self.state = state.forceshutdown
def setFeatures(self, features):