From c42dfe32e7837ac08d2bc644c9c9d34121e9e5a5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 16 Feb 2022 12:53:07 -0800 Subject: [PATCH] Remove chttp2 plugin (#28882) * Remove chttp2 plugin * Automated change: Fix sanity tests * fix tsan Co-authored-by: ctiller --- BUILD | 1 - CMakeLists.txt | 2 -- Makefile | 2 -- build_autogenerated.yaml | 2 -- config.m4 | 1 - config.w32 | 1 - gRPC-Core.podspec | 1 - grpc.gemspec | 1 - grpc.gyp | 2 -- package.xml | 1 - .../chttp2/transport/chttp2_plugin.cc | 36 ------------------- .../chttp2/transport/chttp2_transport.cc | 14 +++++--- .../chttp2/transport/chttp2_transport.h | 2 -- .../plugin_registry/grpc_plugin_registry.cc | 1 - src/python/grpcio/grpc_core_dependencies.py | 1 - tools/doxygen/Doxyfile.c++.internal | 1 - tools/doxygen/Doxyfile.core.internal | 1 - 17 files changed, 9 insertions(+), 61 deletions(-) delete mode 100644 src/core/ext/transport/chttp2/transport/chttp2_plugin.cc diff --git a/BUILD b/BUILD index e95c27bcb30..e844d933405 100644 --- a/BUILD +++ b/BUILD @@ -4339,7 +4339,6 @@ grpc_cc_library( srcs = [ "src/core/ext/transport/chttp2/transport/bin_decoder.cc", "src/core/ext/transport/chttp2/transport/bin_encoder.cc", - "src/core/ext/transport/chttp2/transport/chttp2_plugin.cc", "src/core/ext/transport/chttp2/transport/chttp2_transport.cc", "src/core/ext/transport/chttp2/transport/context_list.cc", "src/core/ext/transport/chttp2/transport/flow_control.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index ed13bef7353..a2b3c36eb40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1648,7 +1648,6 @@ add_library(grpc src/core/ext/transport/chttp2/server/chttp2_server.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc src/core/ext/transport/chttp2/transport/chttp2_transport.cc src/core/ext/transport/chttp2/transport/context_list.cc src/core/ext/transport/chttp2/transport/flow_control.cc @@ -2568,7 +2567,6 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/server/chttp2_server.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc src/core/ext/transport/chttp2/transport/chttp2_transport.cc src/core/ext/transport/chttp2/transport/context_list.cc src/core/ext/transport/chttp2/transport/flow_control.cc diff --git a/Makefile b/Makefile index 0d021a1370d..2667c420735 100644 --- a/Makefile +++ b/Makefile @@ -1101,7 +1101,6 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/server/chttp2_server.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ src/core/ext/transport/chttp2/transport/context_list.cc \ src/core/ext/transport/chttp2/transport/flow_control.cc \ @@ -1868,7 +1867,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/server/chttp2_server.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ src/core/ext/transport/chttp2/transport/context_list.cc \ src/core/ext/transport/chttp2/transport/flow_control.cc \ diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index bf588cb2291..c786fd3288e 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -1142,7 +1142,6 @@ libs: - src/core/ext/transport/chttp2/server/chttp2_server.cc - src/core/ext/transport/chttp2/transport/bin_decoder.cc - src/core/ext/transport/chttp2/transport/bin_encoder.cc - - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc - src/core/ext/transport/chttp2/transport/chttp2_transport.cc - src/core/ext/transport/chttp2/transport/context_list.cc - src/core/ext/transport/chttp2/transport/flow_control.cc @@ -2238,7 +2237,6 @@ libs: - src/core/ext/transport/chttp2/server/chttp2_server.cc - src/core/ext/transport/chttp2/transport/bin_decoder.cc - src/core/ext/transport/chttp2/transport/bin_encoder.cc - - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc - src/core/ext/transport/chttp2/transport/chttp2_transport.cc - src/core/ext/transport/chttp2/transport/context_list.cc - src/core/ext/transport/chttp2/transport/flow_control.cc diff --git a/config.m4 b/config.m4 index c259e2d0948..0c551ea8a46 100644 --- a/config.m4 +++ b/config.m4 @@ -119,7 +119,6 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/server/chttp2_server.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ src/core/ext/transport/chttp2/transport/context_list.cc \ src/core/ext/transport/chttp2/transport/flow_control.cc \ diff --git a/config.w32 b/config.w32 index b0adc249bf8..595a962e8d6 100644 --- a/config.w32 +++ b/config.w32 @@ -85,7 +85,6 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\transport\\chttp2\\server\\chttp2_server.cc " + "src\\core\\ext\\transport\\chttp2\\transport\\bin_decoder.cc " + "src\\core\\ext\\transport\\chttp2\\transport\\bin_encoder.cc " + - "src\\core\\ext\\transport\\chttp2\\transport\\chttp2_plugin.cc " + "src\\core\\ext\\transport\\chttp2\\transport\\chttp2_transport.cc " + "src\\core\\ext\\transport\\chttp2\\transport\\context_list.cc " + "src\\core\\ext\\transport\\chttp2\\transport\\flow_control.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index dc34854e1e9..6c0f0e7b6ca 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -331,7 +331,6 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/bin_decoder.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', - 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', 'src/core/ext/transport/chttp2/transport/chttp2_transport.cc', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', 'src/core/ext/transport/chttp2/transport/context_list.cc', diff --git a/grpc.gemspec b/grpc.gemspec index 1cbd02fd4d6..f470ffc4912 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -250,7 +250,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.cc ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) - s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_plugin.cc ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.cc ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) s.files += %w( src/core/ext/transport/chttp2/transport/context_list.cc ) diff --git a/grpc.gyp b/grpc.gyp index 57b10b4dc43..cac65544f77 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -551,7 +551,6 @@ 'src/core/ext/transport/chttp2/server/chttp2_server.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', - 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', 'src/core/ext/transport/chttp2/transport/chttp2_transport.cc', 'src/core/ext/transport/chttp2/transport/context_list.cc', 'src/core/ext/transport/chttp2/transport/flow_control.cc', @@ -1291,7 +1290,6 @@ 'src/core/ext/transport/chttp2/server/chttp2_server.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', - 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', 'src/core/ext/transport/chttp2/transport/chttp2_transport.cc', 'src/core/ext/transport/chttp2/transport/context_list.cc', 'src/core/ext/transport/chttp2/transport/flow_control.cc', diff --git a/package.xml b/package.xml index c743721417d..5a50cd371b6 100644 --- a/package.xml +++ b/package.xml @@ -230,7 +230,6 @@ - diff --git a/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc b/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc deleted file mode 100644 index eacf695e132..00000000000 --- a/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright 2015 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. - * - */ - -#include - -#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/global_config.h" - -GPR_GLOBAL_CONFIG_DEFINE_BOOL( - grpc_experimental_disable_flow_control, false, - "If set, flow control will be effectively disabled. Max out all values and " - "assume the remote peer does the same. Thus we can ignore any flow control " - "bookkeeping, error checking, and decision making"); - -void grpc_chttp2_plugin_init(void) { - g_flow_control_enabled = - !GPR_GLOBAL_CONFIG_GET(grpc_experimental_disable_flow_control); -} - -void grpc_chttp2_plugin_shutdown(void) {} diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 89a165e534f..9519c2439a6 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -58,6 +58,12 @@ #include "src/core/lib/transport/transport_impl.h" #include "src/core/lib/uri/uri_parser.h" +GPR_GLOBAL_CONFIG_DEFINE_BOOL( + grpc_experimental_disable_flow_control, false, + "If set, flow control will be effectively disabled. Max out all values and " + "assume the remote peer does the same. Thus we can ignore any flow control " + "bookkeeping, error checking, and decision making"); + #define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024) #define MAX_WINDOW 0x7fffffffu #define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024) @@ -163,10 +169,6 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error_handle error); static void reset_byte_stream(void* arg, grpc_error_handle error); -// Flow control default enabled. Can be disabled by setting -// GRPC_EXPERIMENTAL_DISABLE_FLOW_CONTROL -bool g_flow_control_enabled = true; - namespace grpc_core { namespace { @@ -510,7 +512,9 @@ grpc_chttp2_transport::grpc_chttp2_transport( enable_bdp = read_channel_args(this, channel_args, is_client); } - if (g_flow_control_enabled) { + static const bool kEnableFlowControl = + !GPR_GLOBAL_CONFIG_GET(grpc_experimental_disable_flow_control); + if (kEnableFlowControl) { flow_control.Init(this, enable_bdp); } else { diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index 28e32da4bdb..aab837e484e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -32,8 +32,6 @@ extern grpc_core::TraceFlag grpc_trace_http2_stream_state; extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount; extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_hpack_parser; -extern bool g_flow_control_enabled; - /// Creates a CHTTP2 Transport. This takes ownership of a \a resource_user ref /// from the caller; if the caller still needs the resource_user after creating /// a transport, the caller must take another ref. diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index bd243856c27..806ba2765f5 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -68,7 +68,6 @@ void grpc_resolver_binder_shutdown(void); #endif void grpc_register_built_in_plugins(void) { - grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); grpc_register_plugin(grpc_core::ServiceConfigParserInit, grpc_core::ServiceConfigParserShutdown); grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 62ab2d01cea..2f5dcfac5f8 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -94,7 +94,6 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/server/chttp2_server.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', - 'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc', 'src/core/ext/transport/chttp2/transport/chttp2_transport.cc', 'src/core/ext/transport/chttp2/transport/context_list.cc', 'src/core/ext/transport/chttp2/transport/flow_control.cc', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 60ecfff1cd6..6224de3cf16 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1229,7 +1229,6 @@ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.h \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ -src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ src/core/ext/transport/chttp2/transport/context_list.cc \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 3e7801bca08..abc17d07edf 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1019,7 +1019,6 @@ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.h \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ -src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ src/core/ext/transport/chttp2/transport/context_list.cc \