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/07/10 18:53:34 UTC

[buildstream] 01/01: setup.py, setup.cfg: Disable gRPC fork support

This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/grpc
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 269b4912dfe76dbd621181dd199a3601a0093a41
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Sun Jul 10 20:43:25 2022 +0200

    setup.py, setup.cfg: Disable gRPC fork support
    
    gRPC fork support is not compatible with the default polling engine on
    modern Linux systems (epollex) and it also does not work if another
    thread is calling into gRPC.
    
    As BuildStream, after gRPC initialization, uses `fork()` only to
    `exec()` subprocesses, the gRPC fork support (`atfork` handler) is not
    needed. Setting `GRPC_ENABLE_FORK_SUPPORT=0` disables gRPC fork support,
    fixing Python segmentation faults and error messages caused by the
    `atfork` handler.
    
    https://github.com/grpc/grpc/issues/29044
---
 setup.cfg | 1 +
 setup.py  | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/setup.cfg b/setup.cfg
index 283d78099..aea4bdcc8 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -13,6 +13,7 @@ norecursedirs = src tests/integration/project tests/plugins/loading tests/plugin
 python_files = tests/*/*.py
 env =
     D:BST_TEST_SUITE=True
+    D:GRPC_ENABLE_FORK_SUPPORT=0
 
 markers =
     datafiles: data files for tests
diff --git a/setup.py b/setup.py
index 61abd1e9e..5c09fbc91 100755
--- a/setup.py
+++ b/setup.py
@@ -114,11 +114,13 @@ def list_testing_datafiles():
 # which we believe was also inspired from the code from `setuptools` project.
 TEMPLATE = """\
 # -*- coding: utf-8 -*-
+import os
 import sys
 
 from {0} import {1}
 
 if __name__ == '__main__':
+    os.environ['GRPC_ENABLE_FORK_SUPPORT'] = '0'
     sys.exit({2}())"""