You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2022/01/24 10:02:58 UTC
[buildstream] branch master updated: Create process group for buildbox-casd to suppress SIGINT
This is an automated email from the ASF dual-hosted git repository.
juergbi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/buildstream.git
The following commit(s) were added to refs/heads/master by this push:
new 0a66564 Create process group for buildbox-casd to suppress SIGINT
new 95b0012 Merge pull request #1574 from nanonyme/nanonyme/sigint-buildbox-casd
0a66564 is described below
commit 0a66564e9ae3fc884f542c3bdfd8b4e77ac8a4e5
Author: Seppo Yli-Olli <se...@gmail.com>
AuthorDate: Thu Jan 20 21:41:31 2022 +0200
Create process group for buildbox-casd to suppress SIGINT
---
src/buildstream/_cas/casdprocessmanager.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/buildstream/_cas/casdprocessmanager.py b/src/buildstream/_cas/casdprocessmanager.py
index 5588837..34f8304 100644
--- a/src/buildstream/_cas/casdprocessmanager.py
+++ b/src/buildstream/_cas/casdprocessmanager.py
@@ -20,7 +20,6 @@ import threading
import os
import random
import shutil
-import signal
import stat
import subprocess
import tempfile
@@ -34,7 +33,7 @@ from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc
from .._protos.build.buildgrid import local_cas_pb2_grpc
from .._protos.google.bytestream import bytestream_pb2_grpc
-from .. import _signals, utils
+from .. import utils
from .._exceptions import CASCacheError
_CASD_MAX_LOGFILES = 10
@@ -87,12 +86,11 @@ class CASDProcessManager:
self._logfile = self._rotate_and_get_next_logfile()
with open(self._logfile, "w", encoding="utf-8") as logfile_fp:
- # 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.process = subprocess.Popen( # pylint: disable=consider-using-with
- casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT
- )
+ # The frontend will take care of terminating buildbox-casd.
+ # Create a new process group for it such that SIGINT won't reach it.
+ self.process = subprocess.Popen( # pylint: disable=consider-using-with, subprocess-popen-preexec-fn
+ casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT, preexec_fn=os.setpgrp
+ )
# _make_socket_path()
#