summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: