summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/bitbake-worker
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2014-11-17 02:27:36 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-31 10:10:22 +0000
commitbe22ea03145581699ffe7a292d5b94f53e13a9cf (patch)
treee867c1f619179d143a59612d12b38a7e07ff72df /bitbake/bin/bitbake-worker
parent3fc8d299533a8fe04f855cb7530cf3d5207cef75 (diff)
downloadpoky-be22ea03145581699ffe7a292d5b94f53e13a9cf.tar.gz
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>
Diffstat (limited to 'bitbake/bin/bitbake-worker')
-rwxr-xr-xbitbake/bin/bitbake-worker9
1 files changed, 8 insertions, 1 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
147 pipein.close() 147 pipein.close()
148 148
149 signal.signal(signal.SIGTERM, sigterm_handler) 149 signal.signal(signal.SIGTERM, sigterm_handler)
150 # Let SIGHUP exit as SIGTERM
151 signal.signal(signal.SIGHUP, sigterm_handler)
150 152
151 # Save out the PID so that the event can include it the 153 # Save out the PID so that the event can include it the
152 # events 154 # events
@@ -266,9 +268,14 @@ class BitbakeWorker(object):
266 self.build_pipes = {} 268 self.build_pipes = {}
267 269
268 signal.signal(signal.SIGTERM, self.sigterm_exception) 270 signal.signal(signal.SIGTERM, self.sigterm_exception)
271 # Let SIGHUP exit as SIGTERM
272 signal.signal(signal.SIGHUP, self.sigterm_exception)
269 273
270 def sigterm_exception(self, signum, stackframe): 274 def sigterm_exception(self, signum, stackframe):
271 bb.warn("Worker recieved SIGTERM, shutting down...") 275 if signum == signal.SIGTERM:
276 bb.warn("Worker recieved SIGTERM, shutting down...")
277 elif signum == signal.SIGHUP:
278 bb.warn("Worker recieved SIGHUP, shutting down...")
272 self.handle_finishnow(None) 279 self.handle_finishnow(None)
273 signal.signal(signal.SIGTERM, signal.SIG_DFL) 280 signal.signal(signal.SIGTERM, signal.SIG_DFL)
274 os.kill(os.getpid(), signal.SIGTERM) 281 os.kill(os.getpid(), signal.SIGTERM)