summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2019-01-07 18:00:37 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2019-01-07 18:00:37 +0000
commit5de42d43061160ddcd62e8bb6ea3dc3ea151ab07 (patch)
treec2fdabb646d5f82c67aa1729b5cc45d5869d9310
parent7dfb85b35a71c239f592e3aed50eddeddcd10406 (diff)
parent891fcb0e3a68bc4df07b9bb2b8b664d65432bc37 (diff)
downloadbuildstream-5de42d43061160ddcd62e8bb6ea3dc3ea151ab07.tar.gz
Merge branch 'tristan/keyboard-interrupt-stack-trace' into 'master'
Fix stack traces discovered with ^C forceful termination. See merge request BuildStream/buildstream!1043
-rw-r--r--buildstream/_scheduler/jobs/job.py11
-rw-r--r--buildstream/utils.py5
2 files changed, 6 insertions, 10 deletions
diff --git a/buildstream/_scheduler/jobs/job.py b/buildstream/_scheduler/jobs/job.py
index 60ae0d001..a36483b0c 100644
--- a/buildstream/_scheduler/jobs/job.py
+++ b/buildstream/_scheduler/jobs/job.py
@@ -28,8 +28,6 @@ import traceback
import asyncio
import multiprocessing
-import psutil
-
# BuildStream toplevel imports
from ..._exceptions import ImplError, BstError, set_last_task_error, SkipJob
from ..._message import Message, MessageType, unconditional_messages
@@ -215,17 +213,10 @@ class Job():
# Forcefully kill the process, and any children it might have.
#
def kill(self):
-
# Force kill
self.message(MessageType.WARN,
"{} did not terminate gracefully, killing".format(self.action_name))
-
- try:
- utils._kill_process_tree(self._process.pid)
- # This can happen if the process died of its own accord before
- # we try to kill it
- except psutil.NoSuchProcess:
- return
+ utils._kill_process_tree(self._process.pid)
# suspend()
#
diff --git a/buildstream/utils.py b/buildstream/utils.py
index a4600319b..494333680 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -1050,6 +1050,11 @@ def _kill_process_tree(pid):
# Ignore this error, it can happen with
# some setuid bwrap processes.
pass
+ except psutil.NoSuchProcess:
+ # It is certain that this has already been sent
+ # SIGTERM, so there is a window where the process
+ # could have exited already.
+ pass
# Bloody Murder
for child in children: