summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-12 16:09:58 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-12 16:09:58 +0900
commit611c8515b7d8048c4aaaf33983b975b446cffe97 (patch)
tree5ec87277af1eabf899e3109253d434602b7842db
parent47e6b24b589ac617934261f811a35c975e61c961 (diff)
downloadbuildstream-611c8515b7d8048c4aaaf33983b975b446cffe97.tar.gz
_scheduler/job.py: Dont call sys._exit() during sys.exit()
If process termination occurs we will call sys._exit(); ensure that this doesnt happen while the process is already busy in sys.exit(). Problem here was that child_shutdown() was being called inside the context manager with termination enabled (via element logging); only try to cleanly shutdown after the context manager is complete.
-rw-r--r--buildstream/_scheduler/job.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/buildstream/_scheduler/job.py b/buildstream/_scheduler/job.py
index 64148c5e2..910140ec4 100644
--- a/buildstream/_scheduler/job.py
+++ b/buildstream/_scheduler/job.py
@@ -280,7 +280,10 @@ class Job():
self.message(element, MessageType.SUCCESS, self.action_name, elapsed=elapsed,
logfile=filename)
- self.child_shutdown(0)
+ # Shutdown needs to stay outside of the above context manager,
+ # make sure we dont try to handle SIGTERM while the process
+ # is already busy in sys.exit()
+ self.child_shutdown(0)
def child_complete(self, pid, returncode, element):
self.complete(self, returncode, element)