diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-12 16:09:58 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-12 16:09:58 +0900 |
commit | 611c8515b7d8048c4aaaf33983b975b446cffe97 (patch) | |
tree | 5ec87277af1eabf899e3109253d434602b7842db | |
parent | 47e6b24b589ac617934261f811a35c975e61c961 (diff) | |
download | buildstream-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.py | 5 |
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) |