summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-10-04 18:22:13 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-10-04 18:22:13 +0000
commitf886d33abb03649b08824d9ab7b4057ddabbaa8c (patch)
tree147e3118332e3875a1cbbd3feb21e598b7eb7a65
parent2516668ba2ad23b7149c73f2aac485603cb71536 (diff)
parent5615bb4d577f5f0f3055c4ad2f636d5c46435660 (diff)
downloadbuildstream-f886d33abb03649b08824d9ab7b4057ddabbaa8c.tar.gz
Merge branch 'bschubert/casd-sigint' into 'master'
Better SIGINT handling for CASD Closes #1120 See merge request BuildStream/buildstream!1625
-rw-r--r--src/buildstream/_cas/cascache.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 43375c635..a62bc3d44 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -37,7 +37,7 @@ from .._protos.google.rpc import code_pb2
from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
from .._protos.build.buildgrid import local_cas_pb2, local_cas_pb2_grpc
-from .. import utils
+from .. import _signals, utils
from .._exceptions import CASCacheError
from .._message import Message, MessageType
@@ -91,8 +91,11 @@ class CASCache():
self.casd_logfile = self._rotate_and_get_next_logfile()
with open(self.casd_logfile, "w") as logfile_fp:
- self._casd_process = subprocess.Popen(
- casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT)
+ # Block SIGINT on buildbox-casd, we don't need to stop it
+ # The frontend will take care of it if needed
+ with _signals.blocked([signal.SIGINT], ignore=False):
+ self._casd_process = subprocess.Popen(
+ casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT)
else:
self._casd_process = None
@@ -1085,8 +1088,11 @@ class _CASCacheUsageMonitor:
# This can't be allowed with background threads or open gRPC channels.
assert utils._is_single_threaded() and not cas.has_open_grpc_channels()
- self._subprocess = multiprocessing.Process(target=self._subprocess_run)
- self._subprocess.start()
+ # Block SIGINT, we don't want to kill the process when we interrupt the frontend
+ # and this process if very lightweight.
+ with _signals.blocked([signal.SIGINT], ignore=False):
+ self._subprocess = multiprocessing.Process(target=self._subprocess_run)
+ self._subprocess.start()
def get_cache_usage(self):
disk_usage = self._disk_usage.value