mirror of https://github.com/grpc/grpc.git
Fix Python epoll1 Fork Support (#32196)
* WIP. A seemingly properly failing test * WIP. Pre-fork handlers now work * Roughly working. * Clean up * Clean up more * Add to CI * Format * Ugh. Remove swap file * And another * clean up * Add copyright * Format * Remove another debug line * Add stub forkable methods * Remove use of 3.9+ function * Remove unintentional double copyright * drfloob review comments * Only hold lock during Close once * Create separate job for fork test * Bump up gdb timeout * Formatpull/32278/head
parent
7d8a978aa0
commit
190d095a62
17 changed files with 423 additions and 68 deletions
@ -0,0 +1,37 @@ |
||||
# Copyright 2023 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
load("//bazel:cython_library.bzl", "pyx_library") |
||||
|
||||
pyx_library( |
||||
name = "native_debug", |
||||
srcs = ["native_debug.pyx"], |
||||
deps = ["@com_google_absl//absl/debugging:failure_signal_handler"], |
||||
) |
||||
|
||||
py_test( |
||||
name = "fork_test", |
||||
srcs = glob(["*.py"]), |
||||
imports = ["../.."], |
||||
main = "_fork_interop_test.py", |
||||
python_version = "PY3", |
||||
deps = [ |
||||
":native_debug", |
||||
"//src/proto/grpc/testing:empty_py_pb2", |
||||
"//src/proto/grpc/testing:py_messages_proto", |
||||
"//src/proto/grpc/testing:test_py_pb2_grpc", |
||||
"//src/python/grpcio/grpc:grpcio", |
||||
"//src/python/grpcio_tests/tests/interop:service", |
||||
"//src/python/grpcio_tests/tests/unit:test_common", |
||||
], |
||||
) |
@ -0,0 +1,33 @@ |
||||
# Copyright 2023 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
from libcpp cimport bool |
||||
|
||||
|
||||
cdef extern from "absl/debugging/failure_signal_handler.h" namespace "absl": |
||||
ctypedef struct FailureSignalHandlerOptions "::absl::FailureSignalHandlerOptions": |
||||
bool symbolize_stacktrace |
||||
bool use_alternate_stack |
||||
int alarm_on_failure_secs |
||||
bool call_previous_handler |
||||
void (*writerfn)(const char*) |
||||
|
||||
void InstallFailureSignalHandler(const FailureSignalHandlerOptions& options) |
||||
|
||||
def install_failure_signal_handler(**kwargs): |
||||
cdef FailureSignalHandlerOptions opts = FailureSignalHandlerOptions( |
||||
True, False, -1, False, NULL |
||||
) |
||||
|
||||
InstallFailureSignalHandler(opts) |
@ -0,0 +1,26 @@ |
||||
#!/usr/bin/env bash |
||||
# Copyright 2023 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
set -ex |
||||
|
||||
RESULTSTORE_RESULTS_FLAG="--bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc" |
||||
BAZEL_FLAGS="--test_output=errors" |
||||
|
||||
python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path python_bazel_tests_fork_support |
||||
|
||||
# TODO(https://github.com/grpc/grpc/issues/32207): Pull this out into a |
||||
# separate Kokoro job so we can do more runs without impacting overall PR |
||||
# presubmit duration. |
||||
python_bazel_tests_fork_support/bazel_wrapper ${RESULTSTORE_RESULTS_FLAG} test --config=fork_support --runs_per_test=16 ${BAZEL_FLAGS} //src/python/grpcio_tests/tests/fork:fork_test |
@ -0,0 +1,30 @@ |
||||
# Copyright 2023 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
# Config file for the internal CI (in protobuf text format) |
||||
|
||||
# Location of the continuous shell script in repository. |
||||
build_file: "grpc/tools/internal_ci/linux/grpc_bazel.sh" |
||||
timeout_mins: 240 |
||||
action { |
||||
define_artifacts { |
||||
regex: "**/*sponge_log.*" |
||||
regex: "github/grpc/reports/**" |
||||
} |
||||
} |
||||
|
||||
env_vars { |
||||
key: "BAZEL_SCRIPT" |
||||
value: "tools/internal_ci/linux/grpc_python_bazel_test_fork_in_docker.sh" |
||||
} |
Loading…
Reference in new issue