diff --git a/.github/workflows/prod_release_cocoapod.yml b/.github/workflows/prod_release_cocoapod.yml index bcb3b35760..e3744c75fb 100644 --- a/.github/workflows/prod_release_cocoapod.yml +++ b/.github/workflows/prod_release_cocoapod.yml @@ -10,7 +10,7 @@ env: TAG: ${{ github.event.release.tag_name }} jobs: release-cocoapod-gRPC-Core: - runs-on: macos-14 + runs-on: macos-12 steps: - name: Repo checkout uses: actions/checkout@v3 @@ -28,7 +28,7 @@ jobs: version=${TAG#v} timeout 1h scripts/wait_for_pod_release.sh gRPC-Core $version release-cocoapod-gRPC-Cpp: - runs-on: macos-14 + runs-on: macos-12 needs: [release-cocoapod-gRPC-Core] steps: - name: Repo checkout @@ -47,7 +47,7 @@ jobs: version=${TAG#v} timeout 1h scripts/wait_for_pod_release.sh gRPC-C++ $version release-cocoapod-gRPC-RxLibrary: - runs-on: macos-14 + runs-on: macos-12 steps: - name: Repo checkout uses: actions/checkout@v3 @@ -66,7 +66,7 @@ jobs: timeout 1h scripts/wait_for_pod_release.sh gRPC-RxLibrary $version release-cocoapod-gRPC: - runs-on: macos-14 + runs-on: macos-12 needs: [release-cocoapod-gRPC-RxLibrary, release-cocoapod-gRPC-Core] steps: - name: Repo checkout @@ -86,7 +86,7 @@ jobs: timeout 1h scripts/wait_for_pod_release.sh gRPC $version release-cocoapod-gRPC-ProtoRPC: - runs-on: macos-14 + runs-on: macos-12 needs: [release-cocoapod-gRPC-RxLibrary, release-cocoapod-gRPC] steps: - name: Repo checkout diff --git a/Package.swift b/Package.swift index da387fef6e..f0d84d9921 100644 --- a/Package.swift +++ b/Package.swift @@ -24,7 +24,7 @@ let package = Package( ], dependencies: [ - .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20240116.1"..<"0.20240117.0"), + .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20240722.0"..<"0.20240723.0"), .package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.32.0"..<"0.33.0"), ], diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 786cb4bd24..f7032d2b37 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - version = '1.68.0-dev' + version = '1.68.0-pre1' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' @@ -34,9 +34,9 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' @@ -97,7 +97,6 @@ Pod::Spec.new do |s| 'include/grpcpp/client_context.h', 'include/grpcpp/completion_queue.h', 'include/grpcpp/create_channel.h', - 'include/grpcpp/create_channel_binder.h', 'include/grpcpp/create_channel_posix.h', 'include/grpcpp/ext/call_metric_recorder.h', 'include/grpcpp/ext/health_check_service_server_builder_option.h', @@ -185,8 +184,6 @@ Pod::Spec.new do |s| 'include/grpcpp/security/auth_context.h', 'include/grpcpp/security/auth_metadata_processor.h', 'include/grpcpp/security/authorization_policy_provider.h', - 'include/grpcpp/security/binder_credentials.h', - 'include/grpcpp/security/binder_security_policy.h', 'include/grpcpp/security/credentials.h', 'include/grpcpp/security/server_credentials.h', 'include/grpcpp/security/tls_certificate_provider.h', @@ -313,44 +310,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/rbac/rbac_service_config_parser.h', 'src/core/ext/filters/stateful_session/stateful_session_filter.h', 'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h', - 'src/core/ext/transport/binder/client/binder_connector.cc', - 'src/core/ext/transport/binder/client/binder_connector.h', - 'src/core/ext/transport/binder/client/channel_create.cc', - 'src/core/ext/transport/binder/client/channel_create_impl.cc', - 'src/core/ext/transport/binder/client/channel_create_impl.h', - 'src/core/ext/transport/binder/client/connection_id_generator.cc', - 'src/core/ext/transport/binder/client/connection_id_generator.h', - 'src/core/ext/transport/binder/client/endpoint_binder_pool.cc', - 'src/core/ext/transport/binder/client/endpoint_binder_pool.h', - 'src/core/ext/transport/binder/client/jni_utils.cc', - 'src/core/ext/transport/binder/client/jni_utils.h', - 'src/core/ext/transport/binder/client/security_policy_setting.cc', - 'src/core/ext/transport/binder/client/security_policy_setting.h', - 'src/core/ext/transport/binder/security_policy/binder_security_policy.cc', - 'src/core/ext/transport/binder/server/binder_server.cc', - 'src/core/ext/transport/binder/server/binder_server.h', - 'src/core/ext/transport/binder/server/binder_server_credentials.cc', - 'src/core/ext/transport/binder/transport/binder_stream.h', - 'src/core/ext/transport/binder/transport/binder_transport.cc', - 'src/core/ext/transport/binder/transport/binder_transport.h', - 'src/core/ext/transport/binder/utils/binder_auto_utils.h', - 'src/core/ext/transport/binder/utils/ndk_binder.cc', - 'src/core/ext/transport/binder/utils/ndk_binder.h', - 'src/core/ext/transport/binder/utils/transport_stream_receiver.h', - 'src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc', - 'src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h', - 'src/core/ext/transport/binder/wire_format/binder.h', - 'src/core/ext/transport/binder/wire_format/binder_android.cc', - 'src/core/ext/transport/binder/wire_format/binder_android.h', - 'src/core/ext/transport/binder/wire_format/binder_constants.cc', - 'src/core/ext/transport/binder/wire_format/binder_constants.h', - 'src/core/ext/transport/binder/wire_format/transaction.cc', - 'src/core/ext/transport/binder/wire_format/transaction.h', - 'src/core/ext/transport/binder/wire_format/wire_reader.h', - 'src/core/ext/transport/binder/wire_format/wire_reader_impl.cc', - 'src/core/ext/transport/binder/wire_format/wire_reader_impl.h', - 'src/core/ext/transport/binder/wire_format/wire_writer.cc', - 'src/core/ext/transport/binder/wire_format/wire_writer.h', 'src/core/ext/transport/chttp2/alpn/alpn.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/transport/chttp2/server/chttp2_server.h', @@ -544,6 +503,8 @@ Pod::Spec.new do |s| 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h', @@ -792,6 +753,7 @@ Pod::Spec.new do |s| 'src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.h', + 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h', @@ -878,6 +840,7 @@ Pod::Spec.new do |s| 'src/core/handshaker/handshaker_registry.h', 'src/core/handshaker/http_connect/http_connect_handshaker.h', 'src/core/handshaker/http_connect/http_proxy_mapper.h', + 'src/core/handshaker/http_connect/xds_http_proxy_mapper.h', 'src/core/handshaker/proxy_mapper.h', 'src/core/handshaker/proxy_mapper_registry.h', 'src/core/handshaker/security/secure_endpoint.h', @@ -1636,26 +1599,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/rbac/rbac_service_config_parser.h', 'src/core/ext/filters/stateful_session/stateful_session_filter.h', 'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h', - 'src/core/ext/transport/binder/client/binder_connector.h', - 'src/core/ext/transport/binder/client/channel_create_impl.h', - 'src/core/ext/transport/binder/client/connection_id_generator.h', - 'src/core/ext/transport/binder/client/endpoint_binder_pool.h', - 'src/core/ext/transport/binder/client/jni_utils.h', - 'src/core/ext/transport/binder/client/security_policy_setting.h', - 'src/core/ext/transport/binder/server/binder_server.h', - 'src/core/ext/transport/binder/transport/binder_stream.h', - 'src/core/ext/transport/binder/transport/binder_transport.h', - 'src/core/ext/transport/binder/utils/binder_auto_utils.h', - 'src/core/ext/transport/binder/utils/ndk_binder.h', - 'src/core/ext/transport/binder/utils/transport_stream_receiver.h', - 'src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h', - 'src/core/ext/transport/binder/wire_format/binder.h', - 'src/core/ext/transport/binder/wire_format/binder_android.h', - 'src/core/ext/transport/binder/wire_format/binder_constants.h', - 'src/core/ext/transport/binder/wire_format/transaction.h', - 'src/core/ext/transport/binder/wire_format/wire_reader.h', - 'src/core/ext/transport/binder/wire_format/wire_reader_impl.h', - 'src/core/ext/transport/binder/wire_format/wire_writer.h', 'src/core/ext/transport/chttp2/alpn/alpn.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/transport/chttp2/server/chttp2_server.h', @@ -1849,6 +1792,8 @@ Pod::Spec.new do |s| 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h', @@ -2097,6 +2042,7 @@ Pod::Spec.new do |s| 'src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.h', + 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h', @@ -2183,6 +2129,7 @@ Pod::Spec.new do |s| 'src/core/handshaker/handshaker_registry.h', 'src/core/handshaker/http_connect/http_connect_handshaker.h', 'src/core/handshaker/http_connect/http_proxy_mapper.h', + 'src/core/handshaker/http_connect/xds_http_proxy_mapper.h', 'src/core/handshaker/proxy_mapper.h', 'src/core/handshaker/proxy_mapper_registry.h', 'src/core/handshaker/security/secure_endpoint.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index cc9c1a2a97..cc6a7207de 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.68.0-dev' + version = '1.68.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' @@ -38,9 +38,9 @@ Pod::Spec.new do |s| # which was released in Cocoapods v1.2.0. s.cocoapods_version = '>= 1.2.0' - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' @@ -625,6 +625,9 @@ Pod::Spec.new do |s| 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.c', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb_minitable.c', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb_minitable.h', @@ -1034,6 +1037,8 @@ Pod::Spec.new do |s| 'src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.c', 'src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.h', + 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c', + 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c', @@ -1205,6 +1210,8 @@ Pod::Spec.new do |s| 'src/core/handshaker/http_connect/http_connect_handshaker.h', 'src/core/handshaker/http_connect/http_proxy_mapper.cc', 'src/core/handshaker/http_connect/http_proxy_mapper.h', + 'src/core/handshaker/http_connect/xds_http_proxy_mapper.cc', + 'src/core/handshaker/http_connect/xds_http_proxy_mapper.h', 'src/core/handshaker/proxy_mapper.h', 'src/core/handshaker/proxy_mapper_registry.cc', 'src/core/handshaker/proxy_mapper_registry.h', @@ -1818,7 +1825,6 @@ Pod::Spec.new do |s| 'src/core/load_balancing/xds/xds_wrr_locality.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc', 'src/core/plugin_registry/grpc_plugin_registry_extra.cc', - 'src/core/resolver/binder/binder_resolver.cc', 'src/core/resolver/dns/c_ares/dns_resolver_ares.cc', 'src/core/resolver/dns/c_ares/dns_resolver_ares.h', 'src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h', @@ -2638,6 +2644,8 @@ Pod::Spec.new do |s| 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h', 'src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb_minitable.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h', + 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/cert.upb_minitable.h', 'src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h', @@ -2886,6 +2894,7 @@ Pod::Spec.new do |s| 'src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.h', + 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h', 'src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h', @@ -2972,6 +2981,7 @@ Pod::Spec.new do |s| 'src/core/handshaker/handshaker_registry.h', 'src/core/handshaker/http_connect/http_connect_handshaker.h', 'src/core/handshaker/http_connect/http_proxy_mapper.h', + 'src/core/handshaker/http_connect/xds_http_proxy_mapper.h', 'src/core/handshaker/proxy_mapper.h', 'src/core/handshaker/proxy_mapper_registry.h', 'src/core/handshaker/security/secure_endpoint.h', diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 291a494cd2..1ccb71dd5c 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.68.0-dev' + version = '1.68.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' @@ -33,9 +33,9 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index b79eacfc79..cd560d1398 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.68.0-dev' + version = '1.68.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' @@ -33,9 +33,9 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' diff --git a/gRPC.podspec b/gRPC.podspec index 2db370d71f..9d8d206d06 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.68.0-dev' + version = '1.68.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' @@ -45,9 +45,9 @@ Pod::Spec.new do |s| 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', } - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' @@ -80,9 +80,9 @@ Pod::Spec.new do |s| "src/objective-c/GRPCClient/GRPCTypes.mm" ss.dependency "gRPC-RxLibrary/Interface", version ss.dependency "#{s.name}/Privacy", version - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' end @@ -116,9 +116,9 @@ Pod::Spec.new do |s| ss.dependency "#{s.name}/Interface-Legacy", version ss.dependency "#{s.name}/Privacy", version - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' end @@ -154,9 +154,9 @@ Pod::Spec.new do |s| ss.dependency 'gRPC-Core', version ss.dependency 'gRPC-RxLibrary', version - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' end @@ -172,16 +172,16 @@ Pod::Spec.new do |s| ss.dependency 'gRPC-Core/Cronet-Implementation', version ss.dependency 'CronetFramework' - ss.ios.deployment_target = '10.0' + ss.ios.deployment_target = '11.0' end # CFStream is now default. Leaving this subspec only for compatibility purpose. s.subspec 'CFStream' do |ss| ss.dependency "#{s.name}/GRPCCore", version - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' end @@ -192,9 +192,9 @@ Pod::Spec.new do |s| ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,mm}' ss.header_mappings_dir = 'src/objective-c/GRPCClient' - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.12' - s.tvos.deployment_target = '12.0' + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.14' + s.tvos.deployment_target = '13.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' end diff --git a/include/grpc/support/metrics.h b/include/grpc/support/metrics.h index 6252575662..55d60d5de1 100644 --- a/include/grpc/support/metrics.h +++ b/include/grpc/support/metrics.h @@ -24,7 +24,11 @@ namespace grpc_core { namespace experimental { // Configuration (scope) for a specific client channel to be used for stats -// plugins. +// plugins. For some components like XdsClient where the same XdsClient instance +// can be shared across multiple channels that share the same target name but +// have different default authority and channel arguments, the component uses +// the configuration from the first channel that uses this XdsClient instance to +// determine StatsPluginChannelScope. class StatsPluginChannelScope { public: StatsPluginChannelScope( diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 5fb7426af2..04a79ef3c8 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -172,7 +172,6 @@ #if __ANDROID_API__ < 21 #error "Requires Android API v21 and above" #endif -#define GPR_SUPPORT_BINDER_TRANSPORT 1 // TODO(apolcyn): re-evaluate support for c-ares // on android after upgrading our c-ares dependency. // See https://github.com/grpc/grpc/issues/18038. @@ -195,6 +194,12 @@ #define GPR_HAS_PTHREAD_H 1 #define GPR_GETPID_IN_UNISTD_H 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 +#if defined(__has_include) +#if __has_include() +#include +#endif /* __has_include() */ +#endif /* defined(__has_include) */ +#include #elif defined(__linux__) #define GPR_PLATFORM_STRING "linux" #ifndef _BSD_SOURCE diff --git a/include/grpcpp/create_channel_binder.h b/include/grpcpp/create_channel_binder.h deleted file mode 100644 index f19792a184..0000000000 --- a/include/grpcpp/create_channel_binder.h +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2021 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. - -#ifndef GRPCPP_CREATE_CHANNEL_BINDER_H -#define GRPCPP_CREATE_CHANNEL_BINDER_H - -#include - -#ifdef GPR_ANDROID - -#include -#include -#include -#include - -#include - -#include "absl/strings/string_view.h" - -namespace grpc { -namespace experimental { - -/// EXPERIMENTAL Create a new \a Channel based on binder transport. The package -/// name and class name will be used identify the specific application component -/// to connect to. -/// -/// \param jni_env_void Pointer to a JNIEnv structure -/// \param context The context that we will use to invoke \a bindService See -/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int) -/// for detail. -/// \param package_name Package name of the component to be connected to -/// \param class_name Class name of the component to be connected to -/// \param security_policy Used for checking if remote component is allowed to -/// connect -std::shared_ptr CreateBinderChannel( - void* jni_env_void, jobject context, absl::string_view package_name, - absl::string_view class_name, - std::shared_ptr - security_policy); - -/// EXPERIMENTAL Create a new \a Channel based on binder transport. The package -/// name and class name will be used identify the specific application component -/// to connect to. -/// -/// \param jni_env_void Pointer to a JNIEnv structure -/// \param context The context that we will use to invoke \a bindService See -/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int) -/// for detail. -/// \param package_name Package name of the component to be connected to -/// \param class_name Class name of the component to be connected to -/// \param security_policy Used for checking if remote component is allowed to -/// connect -/// \param args Options for channel creation. -std::shared_ptr CreateCustomBinderChannel( - void* jni_env_void, jobject context, absl::string_view package_name, - absl::string_view class_name, - std::shared_ptr security_policy, - const ChannelArguments& args); - -/// EXPERIMENTAL Create a new \a Channel based on binder transport. -/// -/// \param jni_env_void Pointer to a JNIEnv structure -/// \param context The context that we will use to invoke \a bindService See -/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int) -/// for detail. -/// \param uri An URI that can be parsed as an `Intent` with -/// https://developer.android.com/reference/android/content/Intent#parseUri(java.lang.String,%20int) -/// \param security_policy Used for checking if remote component is allowed to -/// connect -std::shared_ptr CreateBinderChannel( - void* jni_env_void, jobject context, absl::string_view uri, - std::shared_ptr - security_policy); - -/// EXPERIMENTAL Create a new \a Channel based on binder transport. -/// -/// \param jni_env_void Pointer to a JNIEnv structure -/// \param context The context that we will use to invoke \a bindService See -/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int) -/// for detail. -/// \param uri An URI that can be parsed as an `Intent` with -/// https://developer.android.com/reference/android/content/Intent#parseUri(java.lang.String,%20int) -/// \param security_policy Used for checking if remote component is allowed to -/// connect -/// \param args Options for channel creation. -std::shared_ptr CreateCustomBinderChannel( - void* jni_env_void, jobject context, absl::string_view uri, - std::shared_ptr security_policy, - const ChannelArguments& args); - -/// EXPERIMENTAL Finds internal binder transport Java code. To create channels -/// in threads created in native code, it is required to call this function -/// once beforehand in a thread that is not created in native code. -/// See -/// https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class -/// for details of this limitation. -/// Returns true when the initialization is successful. -bool InitializeBinderChannelJavaClass(void* jni_env_void); - -/// EXPERIMENTAL Alternative version of `InitializeBinderChannelJavaClass(void* -/// jni_env_void)`. This version used a user-specified function to find the -/// required internal Java class. When a class is found, the `class_finder` -/// function should return a local reference to the class (jclass type). The -/// returned jclass will then be used to create global reference for gRPC to use -/// it later. After that, gRPC will DeleteLocalRef the returned local reference. -bool InitializeBinderChannelJavaClass( - void* jni_env_void, std::function class_finder); - -} // namespace experimental -} // namespace grpc - -#endif - -#endif // GRPCPP_CREATE_CHANNEL_BINDER_H diff --git a/include/grpcpp/security/binder_credentials.h b/include/grpcpp/security/binder_credentials.h deleted file mode 100644 index 3c38b5129d..0000000000 --- a/include/grpcpp/security/binder_credentials.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2021 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. - -#ifndef GRPCPP_SECURITY_BINDER_CREDENTIALS_H -#define GRPCPP_SECURITY_BINDER_CREDENTIALS_H - -#include -#include - -#include - -namespace grpc { - -class ChannelCredentials; - -namespace experimental { - -/// EXPERIMENTAL Builds Binder ServerCredentials. -/// -/// This should be used along with `binder:` URI scheme. The path in the URI can -/// later be used to access the server's endpoint binder. -/// Note that calling \a ServerBuilder::AddListeningPort() with Binder -/// ServerCredentials in a non-supported environment will make the subsequent -/// call to \a ServerBuilder::BuildAndStart() return a null pointer. -std::shared_ptr BinderServerCredentials( - std::shared_ptr - security_policy); - -} // namespace experimental -} // namespace grpc - -#endif // GRPCPP_SECURITY_BINDER_CREDENTIALS_H diff --git a/include/grpcpp/security/binder_security_policy.h b/include/grpcpp/security/binder_security_policy.h deleted file mode 100644 index e1c951fc66..0000000000 --- a/include/grpcpp/security/binder_security_policy.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 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. - -#ifndef GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H -#define GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H - -#include - -#ifdef GPR_ANDROID - -#include - -#endif - -namespace grpc { -namespace experimental { -namespace binder { - -// EXPERIMENTAL Determinines if a connection is allowed to be -// established on Android. See https://source.android.com/security/app-sandbox -// for more info about UID. -class SecurityPolicy { - public: - virtual ~SecurityPolicy() = default; - // Returns true if the UID is authorized to connect. - // Must return the same value for the same inputs so callers can safely cache - // the result. - virtual bool IsAuthorized(int uid) = 0; -}; - -// EXPERIMENTAL Allows all connection. Anything on the Android device will be -// able to connect, use with caution! -class UntrustedSecurityPolicy : public SecurityPolicy { - public: - UntrustedSecurityPolicy(); - ~UntrustedSecurityPolicy() override; - bool IsAuthorized(int uid) override; -}; - -// EXPERIMENTAL Only allows the connections from processes with the same UID. In -// most cases this means "from the same APK". -class InternalOnlySecurityPolicy : public SecurityPolicy { - public: - InternalOnlySecurityPolicy(); - ~InternalOnlySecurityPolicy() override; - bool IsAuthorized(int uid) override; -}; - -#ifdef GPR_ANDROID - -// EXPERIMENTAL Only allows the connections from the APK that have the same -// signature. -class SameSignatureSecurityPolicy : public SecurityPolicy { - public: - // `context` is required for getting PackageManager Java class - SameSignatureSecurityPolicy(JavaVM* jvm, jobject context); - ~SameSignatureSecurityPolicy() override; - bool IsAuthorized(int uid) override; - - private: - JavaVM* jvm_; - jobject context_; -}; - -#endif - -} // namespace binder -} // namespace experimental -} // namespace grpc - -#endif // GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H diff --git a/include/grpcpp/support/async_stream.h b/include/grpcpp/support/async_stream.h index 931d321a98..7264fa1504 100644 --- a/include/grpcpp/support/async_stream.h +++ b/include/grpcpp/support/async_stream.h @@ -38,7 +38,11 @@ class ClientAsyncStreamingInterface { /// Start the call that was set up by the constructor, but only if the /// constructor was invoked through the "Prepare" API which doesn't actually - /// start the call + /// start the call. + /// + /// It is illegal to start a write-type operation (eg. Write(), WriteLast(), + /// WritesDone()) while the `StartCall()` operation has not finished + /// (determined by the returning of \a tag). virtual void StartCall(void* tag) = 0; /// Request notification of the reading of the initial metadata. Completion diff --git a/include/grpcpp/version_info.h b/include/grpcpp/version_info.h index e9de5915e6..85a747ba67 100644 --- a/include/grpcpp/version_info.h +++ b/include/grpcpp/version_info.h @@ -21,7 +21,7 @@ #define GRPC_CPP_VERSION_MAJOR 1 #define GRPC_CPP_VERSION_MINOR 68 #define GRPC_CPP_VERSION_PATCH 0 -#define GRPC_CPP_VERSION_TAG "dev" -#define GRPC_CPP_VERSION_STRING "1.68.0-dev" +#define GRPC_CPP_VERSION_TAG "pre1" +#define GRPC_CPP_VERSION_STRING "1.68.0-pre1" #endif // GRPCPP_VERSION_INFO_H diff --git a/src/core/client_channel/backup_poller.cc b/src/core/client_channel/backup_poller.cc index 43b485dc7e..973df54ee4 100644 --- a/src/core/client_channel/backup_poller.cc +++ b/src/core/client_channel/backup_poller.cc @@ -57,8 +57,19 @@ static backup_poller* g_poller = nullptr; // guarded by g_poller_mu // treated as const. static grpc_core::Duration g_poll_interval = grpc_core::Duration::Milliseconds(DEFAULT_POLL_INTERVAL_MS); +// TODO(hork): delete the backup poller when EventEngine is rolled out +// everywhere. +static bool g_backup_polling_disabled; void grpc_client_channel_global_init_backup_polling() { + // Disable backup polling if EventEngine is used everywhere. + g_backup_polling_disabled = grpc_core::IsEventEngineClientEnabled() && + grpc_core::IsEventEngineListenerEnabled() && + grpc_core::IsEventEngineDnsEnabled(); + if (g_backup_polling_disabled) { + return; + } + gpr_mu_init(&g_poller_mu); int32_t poll_interval_ms = grpc_core::ConfigVars::Get().ClientChannelBackupPollIntervalMs(); @@ -146,7 +157,8 @@ static void g_poller_init_locked() { void grpc_client_channel_start_backup_polling( grpc_pollset_set* interested_parties) { - if (g_poll_interval == grpc_core::Duration::Zero() || + if (g_backup_polling_disabled || + g_poll_interval == grpc_core::Duration::Zero() || grpc_iomgr_run_in_background()) { return; } @@ -165,7 +177,8 @@ void grpc_client_channel_start_backup_polling( void grpc_client_channel_stop_backup_polling( grpc_pollset_set* interested_parties) { - if (g_poll_interval == grpc_core::Duration::Zero() || + if (g_backup_polling_disabled || + g_poll_interval == grpc_core::Duration::Zero() || grpc_iomgr_run_in_background()) { return; } diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index 0486f7e3bf..ba6bb81ac6 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -59,6 +59,9 @@ #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/event_engine/extensions/supports_fd.h" #include "src/core/lib/event_engine/query_extensions.h" +#include "src/core/lib/event_engine/resolved_address_internal.h" +#include "src/core/lib/event_engine/tcp_socket_utils.h" +#include "src/core/lib/event_engine/utils.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/event_engine_shims/endpoint.h" @@ -113,7 +116,8 @@ using AcceptorPtr = std::unique_ptr; class Chttp2ServerListener : public Server::ListenerInterface { public: - static grpc_error_handle Create(Server* server, grpc_resolved_address* addr, + static grpc_error_handle Create(Server* server, + const EventEngine::ResolvedAddress& addr, const ChannelArgs& args, Chttp2ServerArgsModifier args_modifier, int* port_num); @@ -627,8 +631,10 @@ void Chttp2ServerListener::ActiveConnection::SendGoAway() { } if (transport != nullptr) { grpc_transport_op* op = grpc_make_transport_op(nullptr); - op->goaway_error = - GRPC_ERROR_CREATE("Server is stopping to serve requests."); + // Set an HTTP2 error of NO_ERROR to do graceful GOAWAYs. + op->goaway_error = grpc_error_set_int( + GRPC_ERROR_CREATE("Server is stopping to serve requests."), + StatusIntProperty::kHttp2Error, GRPC_HTTP2_NO_ERROR); transport->PerformOp(op); } } @@ -701,8 +707,9 @@ void Chttp2ServerListener::ActiveConnection::OnDrainGraceTimeExpiry() { // grpc_error_handle Chttp2ServerListener::Create( - Server* server, grpc_resolved_address* addr, const ChannelArgs& args, - Chttp2ServerArgsModifier args_modifier, int* port_num) { + Server* server, const EventEngine::ResolvedAddress& addr, + const ChannelArgs& args, Chttp2ServerArgsModifier args_modifier, + int* port_num) { // Create Chttp2ServerListener. OrphanablePtr listener = MakeOrphanable(server, args, args_modifier, @@ -714,18 +721,24 @@ grpc_error_handle Chttp2ServerListener::Create( &listener->tcp_server_shutdown_complete_, ChannelArgsEndpointConfig(args), OnAccept, listener.get(), &listener->tcp_server_); if (!error.ok()) return error; + // TODO(yijiem): remove this conversion when we remove all + // grpc_resolved_address usages. + grpc_resolved_address iomgr_addr = + grpc_event_engine::experimental::CreateGRPCResolvedAddress(addr); if (listener->config_fetcher_ != nullptr) { - listener->resolved_address_ = *addr; + listener->resolved_address_ = iomgr_addr; // TODO(yashykt): Consider binding so as to be able to return the port // number. } else { - error = grpc_tcp_server_add_port(listener->tcp_server_, addr, port_num); + error = + grpc_tcp_server_add_port(listener->tcp_server_, &iomgr_addr, port_num); if (!error.ok()) return error; } // Create channelz node. if (args.GetBool(GRPC_ARG_ENABLE_CHANNELZ) .value_or(GRPC_ENABLE_CHANNELZ_DEFAULT)) { - auto string_address = grpc_sockaddr_to_uri(addr); + auto string_address = + grpc_event_engine::experimental::ResolvedAddressToURI(addr); if (!string_address.ok()) { return GRPC_ERROR_CREATE(string_address.status().ToString()); } @@ -955,37 +968,68 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr, args_modifier); } *port_num = -1; - absl::StatusOr> resolved_or; + absl::StatusOr> resolved; + absl::StatusOr> results = + std::vector(); std::vector error_list; std::string parsed_addr = URI::PercentDecode(addr); absl::string_view parsed_addr_unprefixed{parsed_addr}; // Using lambda to avoid use of goto. grpc_error_handle error = [&]() { grpc_error_handle error; + // TODO(ladynana, yijiem): this code does not handle address URIs correctly: + // it's parsing `unix://foo/bar` as path `/foo/bar` when it should be + // parsing it as authority `foo` and path `/bar`. Also add API documentation + // on the valid URIs that grpc_server_add_http2_port accepts. if (absl::ConsumePrefix(&parsed_addr_unprefixed, kUnixUriPrefix)) { - resolved_or = grpc_resolve_unix_domain_address(parsed_addr_unprefixed); + resolved = grpc_resolve_unix_domain_address(parsed_addr_unprefixed); + GRPC_RETURN_IF_ERROR(resolved.status()); } else if (absl::ConsumePrefix(&parsed_addr_unprefixed, kUnixAbstractUriPrefix)) { - resolved_or = + resolved = grpc_resolve_unix_abstract_domain_address(parsed_addr_unprefixed); + GRPC_RETURN_IF_ERROR(resolved.status()); } else if (absl::ConsumePrefix(&parsed_addr_unprefixed, kVSockUriPrefix)) { - resolved_or = grpc_resolve_vsock_address(parsed_addr_unprefixed); + resolved = grpc_resolve_vsock_address(parsed_addr_unprefixed); + GRPC_RETURN_IF_ERROR(resolved.status()); } else { - resolved_or = - GetDNSResolver()->LookupHostnameBlocking(parsed_addr, "https"); + if (IsEventEngineDnsNonClientChannelEnabled()) { + absl::StatusOr> ee_resolver = + args.GetObjectRef()->GetDNSResolver( + EventEngine::DNSResolver::ResolverOptions()); + GRPC_RETURN_IF_ERROR(ee_resolver.status()); + results = grpc_event_engine::experimental::LookupHostnameBlocking( + ee_resolver->get(), parsed_addr, "https"); + } else { + // TODO(yijiem): Remove this after event_engine_dns_non_client_channel + // is fully enabled. + absl::StatusOr> iomgr_results = + GetDNSResolver()->LookupHostnameBlocking(parsed_addr, "https"); + GRPC_RETURN_IF_ERROR(iomgr_results.status()); + for (const auto& addr : *iomgr_results) { + results->push_back( + grpc_event_engine::experimental::CreateResolvedAddress(addr)); + } + } } - if (!resolved_or.ok()) { - return absl_status_to_grpc_error(resolved_or.status()); + if (resolved.ok()) { + for (const auto& addr : *resolved) { + results->push_back( + grpc_event_engine::experimental::CreateResolvedAddress(addr)); + } } + GRPC_RETURN_IF_ERROR(results.status()); // Create a listener for each resolved address. - for (auto& addr : *resolved_or) { + for (EventEngine::ResolvedAddress& addr : *results) { // If address has a wildcard port (0), use the same port as a previous // listener. - if (*port_num != -1 && grpc_sockaddr_get_port(&addr) == 0) { - grpc_sockaddr_set_port(&addr, *port_num); + if (*port_num != -1 && + grpc_event_engine::experimental::ResolvedAddressGetPort(addr) == 0) { + grpc_event_engine::experimental::ResolvedAddressSetPort(addr, + *port_num); } int port_temp = -1; - error = Chttp2ServerListener::Create(server, &addr, args, args_modifier, + error = Chttp2ServerListener::Create(server, addr, args, args_modifier, &port_temp); if (!error.ok()) { error_list.push_back(error); @@ -997,17 +1041,17 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr, } } } - if (error_list.size() == resolved_or->size()) { + if (error_list.size() == results->size()) { std::string msg = absl::StrFormat( "No address added out of total %" PRIuPTR " resolved for '%s'", - resolved_or->size(), addr); + results->size(), addr); return GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(), error_list.size()); } else if (!error_list.empty()) { - std::string msg = absl::StrFormat( - "Only %" PRIuPTR " addresses added out of total %" PRIuPTR - " resolved", - resolved_or->size() - error_list.size(), resolved_or->size()); + std::string msg = + absl::StrFormat("Only %" PRIuPTR + " addresses added out of total %" PRIuPTR " resolved", + results->size() - error_list.size(), results->size()); error = GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(), error_list.size()); LOG(INFO) << "WARNING: " << StatusToString(error); diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 7fa290db46..f1c7e07a21 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -68,6 +68,8 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" #include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/random_early_detection.h" #include "src/core/util/ref_counted_ptr.h" #include "src/core/util/status_helper.h" @@ -642,6 +644,18 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t, GRPC_HTTP2_REFUSED_STREAM, nullptr)); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM); return init_header_skip_frame_parser(t, priority_type, is_eoh); + } else if (grpc_core::IsRqFastRejectEnabled() && + GPR_UNLIKELY(t->memory_owner.IsMemoryPressureHigh())) { + // We have more streams allocated than we'd like, so apply some pushback + // by refusing this stream. + grpc_core::global_stats().IncrementRqCallsRejected(); + ++t->num_pending_induced_frames; + grpc_slice_buffer_add( + &t->qbuf, + grpc_chttp2_rst_stream_create(t->incoming_stream_id, + GRPC_HTTP2_ENHANCE_YOUR_CALM, nullptr)); + grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM); + return init_header_skip_frame_parser(t, priority_type, is_eoh); } else if (GPR_UNLIKELY( t->max_concurrent_streams_overload_protection && t->streams_allocated.load(std::memory_order_relaxed) > diff --git a/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h b/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h new file mode 100644 index 0000000000..7e07f5b8e5 --- /dev/null +++ b/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h @@ -0,0 +1,106 @@ +/* This file was generated by upb_generator from the input file: + * + * envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#ifndef ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPB_H_ +#define ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPB_H_ + +#include "upb/generated_code_support.h" + +#include "envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h" + +#include "envoy/config/core/v3/base.upb_minitable.h" +#include "udpa/annotations/status.upb_minitable.h" +#include "validate/validate.upb_minitable.h" + +// Must be last. +#include "upb/port/def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport { upb_Message UPB_PRIVATE(base); } envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport; +struct envoy_config_core_v3_TransportSocket; + + + +/* envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport */ + +UPB_INLINE envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_new(upb_Arena* arena) { + return (envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport*)_upb_Message_New(&envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init, arena); +} +UPB_INLINE envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_parse(const char* buf, size_t size, upb_Arena* arena) { + envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* ret = envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_new(arena); + if (!ret) return NULL; + if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init, NULL, 0, arena) != + kUpb_DecodeStatus_Ok) { + return NULL; + } + return ret; +} +UPB_INLINE envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_parse_ex(const char* buf, size_t size, + const upb_ExtensionRegistry* extreg, + int options, upb_Arena* arena) { + envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* ret = envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_new(arena); + if (!ret) return NULL; + if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init, extreg, options, + arena) != kUpb_DecodeStatus_Ok) { + return NULL; + } + return ret; +} +UPB_INLINE char* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_serialize(const envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* msg, upb_Arena* arena, size_t* len) { + char* ptr; + (void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init, 0, arena, &ptr, len); + return ptr; +} +UPB_INLINE char* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_serialize_ex(const envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* msg, int options, + upb_Arena* arena, size_t* len) { + char* ptr; + (void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init, options, arena, &ptr, len); + return ptr; +} +UPB_INLINE void envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_clear_transport_socket(envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* msg) { + const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE const struct envoy_config_core_v3_TransportSocket* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_transport_socket(const envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* msg) { + const struct envoy_config_core_v3_TransportSocket* default_val = NULL; + const struct envoy_config_core_v3_TransportSocket* ret; + const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + UPB_PRIVATE(_upb_MiniTable_StrongReference)(&envoy__config__core__v3__TransportSocket_msg_init); + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_has_transport_socket(const envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* msg) { + const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} + +UPB_INLINE void envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_set_transport_socket(envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport *msg, struct envoy_config_core_v3_TransportSocket* value) { + const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + UPB_PRIVATE(_upb_MiniTable_StrongReference)(&envoy__config__core__v3__TransportSocket_msg_init); + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} +UPB_INLINE struct envoy_config_core_v3_TransportSocket* envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_mutable_transport_socket(envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport* msg, upb_Arena* arena) { + struct envoy_config_core_v3_TransportSocket* sub = (struct envoy_config_core_v3_TransportSocket*)envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_transport_socket(msg); + if (sub == NULL) { + sub = (struct envoy_config_core_v3_TransportSocket*)_upb_Message_New(&envoy__config__core__v3__TransportSocket_msg_init, arena); + if (sub) envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_set_transport_socket(msg, sub); + } + return sub; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port/undef.inc" + +#endif /* ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c b/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c new file mode 100644 index 0000000000..b831a158a4 --- /dev/null +++ b/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c @@ -0,0 +1,52 @@ +/* This file was generated by upb_generator from the input file: + * + * envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#include +#include "upb/generated_code_support.h" +#include "envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h" +#include "envoy/config/core/v3/base.upb_minitable.h" +#include "udpa/annotations/status.upb_minitable.h" +#include "validate/validate.upb_minitable.h" + +// Must be last. +#include "upb/port/def.inc" + +extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken); +static const upb_MiniTableSubInternal envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_submsgs[1] = { + {.UPB_PRIVATE(submsg) = &envoy__config__core__v3__TransportSocket_msg_init_ptr}, +}; + +static const upb_MiniTableField envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport__fields[1] = { + {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, +}; + +const upb_MiniTable envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init = { + &envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_submsgs[0], + &envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport__fields[0], + UPB_SIZE(16, 24), 1, kUpb_ExtMode_NonExtendable, 1, UPB_FASTTABLE_MASK(255), 0, +#ifdef UPB_TRACING_ENABLED + "envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport", +#endif +}; + +const upb_MiniTable* envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init_ptr = &envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init; +static const upb_MiniTable *messages_layout[1] = { + &envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init, +}; + +const upb_MiniTableFile envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_upb_file_layout = { + messages_layout, + NULL, + NULL, + 1, + 0, + 0, +}; + +#include "upb/port/undef.inc" + diff --git a/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h b/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h new file mode 100644 index 0000000000..5bf5df7088 --- /dev/null +++ b/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h @@ -0,0 +1,32 @@ +/* This file was generated by upb_generator from the input file: + * + * envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#ifndef ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPB_MINITABLE_H_ +#define ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPB_MINITABLE_H_ + +#include "upb/generated_code_support.h" + +// Must be last. +#include "upb/port/def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const upb_MiniTable envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init; +extern const upb_MiniTable* envoy__extensions__transport_0sockets__http_011_0proxy__v3__Http11ProxyUpstreamTransport_msg_init_ptr; + +extern const upb_MiniTableFile envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_upb_file_layout; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port/undef.inc" + +#endif /* ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPB_MINITABLE_H_ */ diff --git a/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c b/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c new file mode 100644 index 0000000000..df2a69438c --- /dev/null +++ b/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c @@ -0,0 +1,53 @@ +/* This file was generated by upb_generator from the input file: + * + * envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#include "upb/reflection/def.h" +#include "envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h" +#include "envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.h" + +extern _upb_DefPool_Init envoy_config_core_v3_base_proto_upbdefinit; +extern _upb_DefPool_Init udpa_annotations_status_proto_upbdefinit; +extern _upb_DefPool_Init validate_validate_proto_upbdefinit; +static const char descriptor[574] = {'\n', 'R', 'e', 'n', 'v', 'o', 'y', '/', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '/', 't', 'r', 'a', 'n', 's', 'p', +'o', 'r', 't', '_', 's', 'o', 'c', 'k', 'e', 't', 's', '/', 'h', 't', 't', 'p', '_', '1', '1', '_', 'p', 'r', 'o', 'x', 'y', +'/', 'v', '3', '/', 'u', 'p', 's', 't', 'r', 'e', 'a', 'm', '_', 'h', 't', 't', 'p', '_', '1', '1', '_', 'c', 'o', 'n', 'n', +'e', 'c', 't', '.', 'p', 'r', 'o', 't', 'o', '\022', '3', 'e', 'n', 'v', 'o', 'y', '.', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', +'n', 's', '.', 't', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', '_', 's', 'o', 'c', 'k', 'e', 't', 's', '.', 'h', 't', 't', 'p', +'_', '1', '1', '_', 'p', 'r', 'o', 'x', 'y', '.', 'v', '3', '\032', '\037', 'e', 'n', 'v', 'o', 'y', '/', 'c', 'o', 'n', 'f', 'i', +'g', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'b', 'a', 's', 'e', '.', 'p', 'r', 'o', 't', 'o', '\032', '\035', 'u', 'd', 'p', +'a', '/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's', '.', 'p', 'r', 'o', 't', +'o', '\032', '\027', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '/', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '.', 'p', 'r', 'o', 't', +'o', '\"', 'z', '\n', '\034', 'H', 't', 't', 'p', '1', '1', 'P', 'r', 'o', 'x', 'y', 'U', 'p', 's', 't', 'r', 'e', 'a', 'm', 'T', +'r', 'a', 'n', 's', 'p', 'o', 'r', 't', '\022', 'Z', '\n', '\020', 't', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', '_', 's', 'o', 'c', +'k', 'e', 't', '\030', '\001', ' ', '\001', '(', '\013', '2', '%', '.', 'e', 'n', 'v', 'o', 'y', '.', 'c', 'o', 'n', 'f', 'i', 'g', '.', +'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'T', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', 'S', 'o', 'c', 'k', 'e', 't', 'B', '\010', +'\372', 'B', '\005', '\212', '\001', '\002', '\020', '\001', 'R', '\017', 't', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', 'S', 'o', 'c', 'k', 'e', 't', +'B', '\325', '\001', '\n', 'A', 'i', 'o', '.', 'e', 'n', 'v', 'o', 'y', 'p', 'r', 'o', 'x', 'y', '.', 'e', 'n', 'v', 'o', 'y', '.', +'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '.', 't', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', '_', 's', 'o', 'c', 'k', +'e', 't', 's', '.', 'h', 't', 't', 'p', '_', '1', '1', '_', 'p', 'r', 'o', 'x', 'y', '.', 'v', '3', 'B', '\032', 'U', 'p', 's', +'t', 'r', 'e', 'a', 'm', 'H', 't', 't', 'p', '1', '1', 'C', 'o', 'n', 'n', 'e', 'c', 't', 'P', 'r', 'o', 't', 'o', 'P', '\001', +'Z', 'j', 'g', 'i', 't', 'h', 'u', 'b', '.', 'c', 'o', 'm', '/', 'e', 'n', 'v', 'o', 'y', 'p', 'r', 'o', 'x', 'y', '/', 'g', +'o', '-', 'c', 'o', 'n', 't', 'r', 'o', 'l', '-', 'p', 'l', 'a', 'n', 'e', '/', 'e', 'n', 'v', 'o', 'y', '/', 'e', 'x', 't', +'e', 'n', 's', 'i', 'o', 'n', 's', '/', 't', 'r', 'a', 'n', 's', 'p', 'o', 'r', 't', '_', 's', 'o', 'c', 'k', 'e', 't', 's', +'/', 'h', 't', 't', 'p', '_', '1', '1', '_', 'p', 'r', 'o', 'x', 'y', '/', 'v', '3', ';', 'h', 't', 't', 'p', '_', '1', '1', +'_', 'p', 'r', 'o', 'x', 'y', 'v', '3', '\272', '\200', '\310', '\321', '\006', '\002', '\020', '\002', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static _upb_DefPool_Init *deps[4] = { + &envoy_config_core_v3_base_proto_upbdefinit, + &udpa_annotations_status_proto_upbdefinit, + &validate_validate_proto_upbdefinit, + NULL +}; + +_upb_DefPool_Init envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_upbdefinit = { + deps, + &envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_upb_file_layout, + "envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto", + UPB_STRINGVIEW_INIT(descriptor, 574) +}; diff --git a/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h b/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h new file mode 100644 index 0000000000..f439037c50 --- /dev/null +++ b/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h @@ -0,0 +1,33 @@ +/* This file was generated by upb_generator from the input file: + * + * envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#ifndef ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPBDEFS_H_ +#define ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPBDEFS_H_ + +#include "upb/reflection/def.h" +#include "upb/reflection/internal/def_pool.h" + +#include "upb/port/def.inc" // Must be last. +#ifdef __cplusplus +extern "C" { +#endif + +extern _upb_DefPool_Init envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_upbdefinit; + +UPB_INLINE const upb_MessageDef *envoy_extensions_transport_sockets_http_11_proxy_v3_Http11ProxyUpstreamTransport_getmsgdef(upb_DefPool *s) { + _upb_DefPool_LoadDefInit(s, &envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_upbdefinit); + return upb_DefPool_FindMessageByName(s, "envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport"); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port/undef.inc" + +#endif /* ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_HTTP_11_PROXY_V3_UPSTREAM_HTTP_11_CONNECT_PROTO_UPBDEFS_H_ */ diff --git a/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc b/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc new file mode 100644 index 0000000000..8762711225 --- /dev/null +++ b/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc @@ -0,0 +1,57 @@ +// +// Copyright 2024 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 "src/core/handshaker/http_connect/xds_http_proxy_mapper.h" + +#include +#include + +#include "absl/log/log.h" +#include "absl/types/optional.h" +#include "src/core/handshaker/http_connect/http_connect_handshaker.h" +#include "src/core/lib/address_utils/parse_address.h" +#include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/xds/grpc/xds_endpoint.h" + +namespace grpc_core { + +absl::optional XdsHttpProxyMapper::MapAddress( + const grpc_resolved_address& endpoint_address, ChannelArgs* args) { + auto proxy_address_str = args->GetString(GRPC_ARG_XDS_HTTP_PROXY); + if (!proxy_address_str.has_value()) return absl::nullopt; + auto proxy_address = StringToSockaddr(*proxy_address_str); + if (!proxy_address.ok()) { + LOG(ERROR) << "error parsing address \"" << *proxy_address_str + << "\": " << proxy_address.status(); + return absl::nullopt; + } + auto endpoint_address_str = grpc_sockaddr_to_string(&endpoint_address, true); + if (!endpoint_address_str.ok()) { + LOG(ERROR) << "error converting address to string: " + << endpoint_address_str.status(); + return absl::nullopt; + } + *args = args->Set(GRPC_ARG_HTTP_CONNECT_SERVER, *endpoint_address_str); + return *proxy_address; +} + +void RegisterXdsHttpProxyMapper(CoreConfiguration::Builder* builder) { + builder->proxy_mapper_registry()->Register( + /*at_start=*/true, std::make_unique()); +} + +} // namespace grpc_core diff --git a/src/core/handshaker/http_connect/xds_http_proxy_mapper.h b/src/core/handshaker/http_connect/xds_http_proxy_mapper.h new file mode 100644 index 0000000000..176c6afb5f --- /dev/null +++ b/src/core/handshaker/http_connect/xds_http_proxy_mapper.h @@ -0,0 +1,46 @@ +// +// Copyright 2024 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. +// + +#ifndef GRPC_SRC_CORE_HANDSHAKER_HTTP_CONNECT_XDS_HTTP_PROXY_MAPPER_H +#define GRPC_SRC_CORE_HANDSHAKER_HTTP_CONNECT_XDS_HTTP_PROXY_MAPPER_H + +#include + +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" +#include "src/core/handshaker/proxy_mapper.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/config/core_configuration.h" +#include "src/core/lib/iomgr/resolved_address.h" + +namespace grpc_core { + +class XdsHttpProxyMapper final : public ProxyMapperInterface { + public: + absl::optional MapName(absl::string_view /*server_uri*/, + ChannelArgs* /*args*/) override { + return absl::nullopt; + } + + absl::optional MapAddress( + const grpc_resolved_address& address, ChannelArgs* args) override; +}; + +void RegisterXdsHttpProxyMapper(CoreConfiguration::Builder* builder); + +} // namespace grpc_core + +#endif // GRPC_SRC_CORE_HANDSHAKER_HTTP_CONNECT_XDS_HTTP_PROXY_MAPPER_H diff --git a/src/core/lib/event_engine/extensions/supports_fd.h b/src/core/lib/event_engine/extensions/supports_fd.h index c7a1bfdcd4..070bce175d 100644 --- a/src/core/lib/event_engine/extensions/supports_fd.h +++ b/src/core/lib/event_engine/extensions/supports_fd.h @@ -119,6 +119,23 @@ class EventEngineSupportsFdExtension { virtual std::unique_ptr CreateEndpointFromFd( int fd, const EndpointConfig& config) = 0; + /// Creates an EventEngine::Endpoint from a file descriptor that is configured + /// and bound locally but not yet connected to a remote peer. Returns a + /// connection handle to cancel the connection attempt if needed. Created + /// endpoint will be returned through `on_connect` callback. + /// \a fd - The socket file descriptor. + /// \a on_connect - The callback to invoke once fd is connected to peer. + /// \a addr - The remote peer to connect to. This should be the mapped peer + /// address returned when creating a new socket. + /// \a config - Additional configuration to be applied to the endpoint. + /// \a memory_allocator - The endpoint may use the provided memory allocator + /// to track memory allocations. + /// \a timeout - The timeout to use for the connection attempt. + virtual EventEngine::ConnectionHandle CreateEndpointFromUnconnectedFd( + int fd, EventEngine::OnConnectCallback on_connect, + const EventEngine::ResolvedAddress& addr, const EndpointConfig& config, + MemoryAllocator memory_allocator, EventEngine::Duration timeout) = 0; + /// Called when the posix listener has accepted a new client connection. /// \a listener_fd - The listening socket fd that accepted the new client /// connection. diff --git a/src/core/lib/event_engine/posix_engine/posix_engine.cc b/src/core/lib/event_engine/posix_engine/posix_engine.cc index f2275975b0..1c7f6df10b 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine.cc +++ b/src/core/lib/event_engine/posix_engine/posix_engine.cc @@ -238,14 +238,16 @@ void AsyncConnect::OnWritable(absl::Status status) } } -EventEngine::ConnectionHandle PosixEventEngine::ConnectInternal( - PosixSocketWrapper sock, OnConnectCallback on_connect, ResolvedAddress addr, - MemoryAllocator&& allocator, const PosixTcpOptions& options, - Duration timeout) { +EventEngine::ConnectionHandle +PosixEventEngine::CreateEndpointFromUnconnectedFdInternal( + int fd, EventEngine::OnConnectCallback on_connect, + const EventEngine::ResolvedAddress& addr, + const PosixTcpOptions& tcp_options, MemoryAllocator memory_allocator, + EventEngine::Duration timeout) { int err; int connect_errno; do { - err = connect(sock.Fd(), addr.address(), addr.size()); + err = connect(fd, addr.address(), addr.size()); } while (err < 0 && errno == EINTR); connect_errno = (err < 0) ? errno : 0; @@ -261,16 +263,15 @@ EventEngine::ConnectionHandle PosixEventEngine::ConnectInternal( std::string name = absl::StrCat("tcp-client:", addr_uri.value()); PosixEventPoller* poller = poller_manager_->Poller(); EventHandle* handle = - poller->CreateHandle(sock.Fd(), name, poller->CanTrackErrors()); + poller->CreateHandle(fd, name, poller->CanTrackErrors()); if (connect_errno == 0) { - // Connection already succeded. Return 0 to discourage any cancellation + // Connection already succeeded. Return 0 to discourage any cancellation // attempts. Run([on_connect = std::move(on_connect), - ep = CreatePosixEndpoint(handle, nullptr, shared_from_this(), - std::move(allocator), options)]() mutable { - on_connect(std::move(ep)); - }); + ep = CreatePosixEndpoint( + handle, nullptr, shared_from_this(), std::move(memory_allocator), + tcp_options)]() mutable { on_connect(std::move(ep)); }); return EventEngine::ConnectionHandle::kInvalid; } if (connect_errno != EWOULDBLOCK && connect_errno != EINPROGRESS) { @@ -288,9 +289,10 @@ EventEngine::ConnectionHandle PosixEventEngine::ConnectInternal( // Connection is still in progress. int64_t connection_id = last_connection_id_.fetch_add(1, std::memory_order_acq_rel); - AsyncConnect* ac = new AsyncConnect( - std::move(on_connect), shared_from_this(), executor_.get(), handle, - std::move(allocator), options, addr_uri.value(), connection_id); + AsyncConnect* ac = + new AsyncConnect(std::move(on_connect), shared_from_this(), + executor_.get(), handle, std::move(memory_allocator), + tcp_options, addr_uri.value(), connection_id); int shard_number = connection_id % connection_shards_.size(); struct ConnectionShard* shard = &connection_shards_[shard_number]; { @@ -635,14 +637,29 @@ EventEngine::ConnectionHandle PosixEventEngine::Connect( status = socket.status()]() mutable { on_connect(status); }); return EventEngine::ConnectionHandle::kInvalid; } - return ConnectInternal((*socket).sock, std::move(on_connect), - (*socket).mapped_target_addr, - std::move(memory_allocator), options, timeout); + return CreateEndpointFromUnconnectedFdInternal( + (*socket).sock.Fd(), std::move(on_connect), (*socket).mapped_target_addr, + options, std::move(memory_allocator), timeout); #else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING grpc_core::Crash("EventEngine::Connect is not supported on this platform"); #endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING } +EventEngine::ConnectionHandle PosixEventEngine::CreateEndpointFromUnconnectedFd( + int fd, EventEngine::OnConnectCallback on_connect, + const EventEngine::ResolvedAddress& addr, const EndpointConfig& config, + MemoryAllocator memory_allocator, EventEngine::Duration timeout) { +#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING + return CreateEndpointFromUnconnectedFdInternal( + fd, std::move(on_connect), addr, TcpOptionsFromEndpointConfig(config), + std::move(memory_allocator), timeout); +#else // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING + grpc_core::Crash( + "EventEngine::CreateEndpointFromUnconnectedFd is not supported on this " + "platform"); +#endif // GRPC_PLATFORM_SUPPORTS_POSIX_POLLING +} + std::unique_ptr PosixEventEngine::CreatePosixEndpointFromFd(int fd, const EndpointConfig& config, diff --git a/src/core/lib/event_engine/posix_engine/posix_engine.h b/src/core/lib/event_engine/posix_engine/posix_engine.h index 82be0bdd0e..63a142a11f 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine.h +++ b/src/core/lib/event_engine/posix_engine/posix_engine.h @@ -174,6 +174,11 @@ class PosixEventEngine final : public PosixEventEngineWithFdSupport, std::unique_ptr CreateEndpointFromFd( int fd, const EndpointConfig& config) override; + ConnectionHandle CreateEndpointFromUnconnectedFd( + int fd, EventEngine::OnConnectCallback on_connect, + const EventEngine::ResolvedAddress& addr, const EndpointConfig& config, + MemoryAllocator memory_allocator, EventEngine::Duration timeout) override; + absl::StatusOr> CreateListener( Listener::AcceptCallback on_accept, absl::AnyInvocable on_shutdown, @@ -235,12 +240,10 @@ class PosixEventEngine final : public PosixEventEngineWithFdSupport, static void PollerWorkInternal( std::shared_ptr poller_manager); - ConnectionHandle ConnectInternal( - grpc_event_engine::experimental::PosixSocketWrapper sock, - OnConnectCallback on_connect, ResolvedAddress addr, - MemoryAllocator&& allocator, - const grpc_event_engine::experimental::PosixTcpOptions& options, - Duration timeout); + ConnectionHandle CreateEndpointFromUnconnectedFdInternal( + int fd, EventEngine::OnConnectCallback on_connect, + const EventEngine::ResolvedAddress& addr, const PosixTcpOptions& options, + MemoryAllocator memory_allocator, EventEngine::Duration timeout); void OnConnectFinishInternal(int connection_handle); diff --git a/src/core/lib/event_engine/posix_engine/posix_engine_listener.h b/src/core/lib/event_engine/posix_engine/posix_engine_listener.h index 1ddbe1b3fb..3bc306c791 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +++ b/src/core/lib/event_engine/posix_engine/posix_engine_listener.h @@ -107,8 +107,11 @@ class PosixEngineListenerImpl } ListenerSocketsContainer::ListenerSocket& Socket() { return socket_; } ~AsyncConnectionAcceptor() { - // If uds socket, unlink it so that the corresponding file is deleted. - UnlinkIfUnixDomainSocket(*socket_.sock.LocalAddress()); + auto address = socket_.sock.LocalAddress(); + if (address.ok()) { + // If uds socket, unlink it so that the corresponding file is deleted. + UnlinkIfUnixDomainSocket(*address); + } handle_->OrphanHandle(nullptr, nullptr, ""); delete notify_on_accept_; } diff --git a/src/core/lib/event_engine/resolved_address.cc b/src/core/lib/event_engine/resolved_address.cc index 1a41663bed..2672923f8c 100644 --- a/src/core/lib/event_engine/resolved_address.cc +++ b/src/core/lib/event_engine/resolved_address.cc @@ -48,6 +48,9 @@ EventEngine::ResolvedAddress CreateResolvedAddress( grpc_resolved_address CreateGRPCResolvedAddress( const EventEngine::ResolvedAddress& ra) { + static_assert( + GRPC_MAX_SOCKADDR_SIZE == EventEngine::ResolvedAddress::MAX_SIZE_BYTES, + "size should match"); grpc_resolved_address grpc_addr; memset(&grpc_addr, 0, sizeof(grpc_resolved_address)); memcpy(grpc_addr.addr, ra.address(), ra.size()); diff --git a/src/core/lib/event_engine/utils.cc b/src/core/lib/event_engine/utils.cc index f2a202315c..ad4b44a287 100644 --- a/src/core/lib/event_engine/utils.cc +++ b/src/core/lib/event_engine/utils.cc @@ -20,6 +20,7 @@ #include #include "absl/strings/str_cat.h" +#include "src/core/util/notification.h" #include "src/core/util/time.h" namespace grpc_event_engine { @@ -38,5 +39,20 @@ grpc_core::Timestamp ToTimestamp(grpc_core::Timestamp now, grpc_core::Duration::Milliseconds(1); } +absl::StatusOr> +LookupHostnameBlocking(EventEngine::DNSResolver* dns_resolver, + absl::string_view name, absl::string_view default_port) { + absl::StatusOr> results; + grpc_core::Notification done; + dns_resolver->LookupHostname( + [&](absl::StatusOr> addresses) { + results = std::move(addresses); + done.Notify(); + }, + name, default_port); + done.WaitForNotification(); + return results; +} + } // namespace experimental } // namespace grpc_event_engine diff --git a/src/core/lib/event_engine/utils.h b/src/core/lib/event_engine/utils.h index 45675ee8d8..0e15d69b49 100644 --- a/src/core/lib/event_engine/utils.h +++ b/src/core/lib/event_engine/utils.h @@ -19,7 +19,10 @@ #include #include +#include +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" #include "src/core/util/time.h" namespace grpc_event_engine { @@ -36,6 +39,10 @@ std::string HandleToString(const Handle& handle) { grpc_core::Timestamp ToTimestamp(grpc_core::Timestamp now, EventEngine::Duration delta); +absl::StatusOr> +LookupHostnameBlocking(EventEngine::DNSResolver* dns_resolver, + absl::string_view name, absl::string_view default_port); + } // namespace experimental } // namespace grpc_event_engine diff --git a/src/core/lib/experiments/experiments.cc b/src/core/lib/experiments/experiments.cc index 8464f0756a..1e752e0ca9 100644 --- a/src/core/lib/experiments/experiments.cc +++ b/src/core/lib/experiments/experiments.cc @@ -41,6 +41,11 @@ const char* const additional_constraints_event_engine_client = "{}"; const char* const description_event_engine_dns = "If set, use EventEngine DNSResolver for client channel resolution"; const char* const additional_constraints_event_engine_dns = "{}"; +const char* const description_event_engine_dns_non_client_channel = + "If set, use EventEngine DNSResolver in other places besides client " + "channel."; +const char* const additional_constraints_event_engine_dns_non_client_channel = + "{}"; const char* const description_event_engine_listener = "Use EventEngine listeners instead of iomgr's grpc_tcp_server"; const char* const additional_constraints_event_engine_listener = "{}"; @@ -68,6 +73,10 @@ const char* const additional_constraints_pick_first_new = "{}"; const char* const description_promise_based_inproc_transport = "Use promises for the in-process transport."; const char* const additional_constraints_promise_based_inproc_transport = "{}"; +const char* const description_rq_fast_reject = + "Resource quota rejects requests immediately (before allocating the " + "request structure) under very high memory pressure."; +const char* const additional_constraints_rq_fast_reject = "{}"; const char* const description_schedule_cancellation_over_write = "Allow cancellation op to be scheduled over a write"; const char* const additional_constraints_schedule_cancellation_over_write = @@ -94,10 +103,6 @@ const char* const description_unconstrained_max_quota_buffer_size = "Discard the cap on the max free pool size for one memory allocator"; const char* const additional_constraints_unconstrained_max_quota_buffer_size = "{}"; -const char* const description_work_serializer_clears_time_cache = - "Have the work serializer clear the time cache when it dispatches work."; -const char* const additional_constraints_work_serializer_clears_time_cache = - "{}"; const char* const description_work_serializer_dispatch = "Have the work serializer dispatch work to event engine for every " "callback, instead of running things inline in the first thread that " @@ -122,6 +127,10 @@ const ExperimentMetadata g_experiment_metadata[] = { additional_constraints_event_engine_client, nullptr, 0, false, true}, {"event_engine_dns", description_event_engine_dns, additional_constraints_event_engine_dns, nullptr, 0, false, false}, + {"event_engine_dns_non_client_channel", + description_event_engine_dns_non_client_channel, + additional_constraints_event_engine_dns_non_client_channel, nullptr, 0, + false, false}, {"event_engine_listener", description_event_engine_listener, additional_constraints_event_engine_listener, nullptr, 0, false, true}, {"free_large_allocator", description_free_large_allocator, @@ -141,6 +150,8 @@ const ExperimentMetadata g_experiment_metadata[] = { description_promise_based_inproc_transport, additional_constraints_promise_based_inproc_transport, nullptr, 0, false, false}, + {"rq_fast_reject", description_rq_fast_reject, + additional_constraints_rq_fast_reject, nullptr, 0, false, true}, {"schedule_cancellation_over_write", description_schedule_cancellation_over_write, additional_constraints_schedule_cancellation_over_write, nullptr, 0, false, @@ -159,10 +170,6 @@ const ExperimentMetadata g_experiment_metadata[] = { description_unconstrained_max_quota_buffer_size, additional_constraints_unconstrained_max_quota_buffer_size, nullptr, 0, false, true}, - {"work_serializer_clears_time_cache", - description_work_serializer_clears_time_cache, - additional_constraints_work_serializer_clears_time_cache, nullptr, 0, true, - true}, {"work_serializer_dispatch", description_work_serializer_dispatch, additional_constraints_work_serializer_dispatch, nullptr, 0, false, true}, }; @@ -190,6 +197,11 @@ const char* const additional_constraints_event_engine_client = "{}"; const char* const description_event_engine_dns = "If set, use EventEngine DNSResolver for client channel resolution"; const char* const additional_constraints_event_engine_dns = "{}"; +const char* const description_event_engine_dns_non_client_channel = + "If set, use EventEngine DNSResolver in other places besides client " + "channel."; +const char* const additional_constraints_event_engine_dns_non_client_channel = + "{}"; const char* const description_event_engine_listener = "Use EventEngine listeners instead of iomgr's grpc_tcp_server"; const char* const additional_constraints_event_engine_listener = "{}"; @@ -217,6 +229,10 @@ const char* const additional_constraints_pick_first_new = "{}"; const char* const description_promise_based_inproc_transport = "Use promises for the in-process transport."; const char* const additional_constraints_promise_based_inproc_transport = "{}"; +const char* const description_rq_fast_reject = + "Resource quota rejects requests immediately (before allocating the " + "request structure) under very high memory pressure."; +const char* const additional_constraints_rq_fast_reject = "{}"; const char* const description_schedule_cancellation_over_write = "Allow cancellation op to be scheduled over a write"; const char* const additional_constraints_schedule_cancellation_over_write = @@ -243,10 +259,6 @@ const char* const description_unconstrained_max_quota_buffer_size = "Discard the cap on the max free pool size for one memory allocator"; const char* const additional_constraints_unconstrained_max_quota_buffer_size = "{}"; -const char* const description_work_serializer_clears_time_cache = - "Have the work serializer clear the time cache when it dispatches work."; -const char* const additional_constraints_work_serializer_clears_time_cache = - "{}"; const char* const description_work_serializer_dispatch = "Have the work serializer dispatch work to event engine for every " "callback, instead of running things inline in the first thread that " @@ -271,6 +283,10 @@ const ExperimentMetadata g_experiment_metadata[] = { additional_constraints_event_engine_client, nullptr, 0, true, true}, {"event_engine_dns", description_event_engine_dns, additional_constraints_event_engine_dns, nullptr, 0, true, false}, + {"event_engine_dns_non_client_channel", + description_event_engine_dns_non_client_channel, + additional_constraints_event_engine_dns_non_client_channel, nullptr, 0, + false, false}, {"event_engine_listener", description_event_engine_listener, additional_constraints_event_engine_listener, nullptr, 0, true, true}, {"free_large_allocator", description_free_large_allocator, @@ -290,6 +306,8 @@ const ExperimentMetadata g_experiment_metadata[] = { description_promise_based_inproc_transport, additional_constraints_promise_based_inproc_transport, nullptr, 0, false, false}, + {"rq_fast_reject", description_rq_fast_reject, + additional_constraints_rq_fast_reject, nullptr, 0, false, true}, {"schedule_cancellation_over_write", description_schedule_cancellation_over_write, additional_constraints_schedule_cancellation_over_write, nullptr, 0, false, @@ -308,10 +326,6 @@ const ExperimentMetadata g_experiment_metadata[] = { description_unconstrained_max_quota_buffer_size, additional_constraints_unconstrained_max_quota_buffer_size, nullptr, 0, false, true}, - {"work_serializer_clears_time_cache", - description_work_serializer_clears_time_cache, - additional_constraints_work_serializer_clears_time_cache, nullptr, 0, true, - true}, {"work_serializer_dispatch", description_work_serializer_dispatch, additional_constraints_work_serializer_dispatch, nullptr, 0, false, true}, }; @@ -339,6 +353,11 @@ const char* const additional_constraints_event_engine_client = "{}"; const char* const description_event_engine_dns = "If set, use EventEngine DNSResolver for client channel resolution"; const char* const additional_constraints_event_engine_dns = "{}"; +const char* const description_event_engine_dns_non_client_channel = + "If set, use EventEngine DNSResolver in other places besides client " + "channel."; +const char* const additional_constraints_event_engine_dns_non_client_channel = + "{}"; const char* const description_event_engine_listener = "Use EventEngine listeners instead of iomgr's grpc_tcp_server"; const char* const additional_constraints_event_engine_listener = "{}"; @@ -366,6 +385,10 @@ const char* const additional_constraints_pick_first_new = "{}"; const char* const description_promise_based_inproc_transport = "Use promises for the in-process transport."; const char* const additional_constraints_promise_based_inproc_transport = "{}"; +const char* const description_rq_fast_reject = + "Resource quota rejects requests immediately (before allocating the " + "request structure) under very high memory pressure."; +const char* const additional_constraints_rq_fast_reject = "{}"; const char* const description_schedule_cancellation_over_write = "Allow cancellation op to be scheduled over a write"; const char* const additional_constraints_schedule_cancellation_over_write = @@ -392,10 +415,6 @@ const char* const description_unconstrained_max_quota_buffer_size = "Discard the cap on the max free pool size for one memory allocator"; const char* const additional_constraints_unconstrained_max_quota_buffer_size = "{}"; -const char* const description_work_serializer_clears_time_cache = - "Have the work serializer clear the time cache when it dispatches work."; -const char* const additional_constraints_work_serializer_clears_time_cache = - "{}"; const char* const description_work_serializer_dispatch = "Have the work serializer dispatch work to event engine for every " "callback, instead of running things inline in the first thread that " @@ -417,9 +436,13 @@ const ExperimentMetadata g_experiment_metadata[] = { additional_constraints_event_engine_application_callbacks, nullptr, 0, true, true}, {"event_engine_client", description_event_engine_client, - additional_constraints_event_engine_client, nullptr, 0, false, true}, + additional_constraints_event_engine_client, nullptr, 0, true, true}, {"event_engine_dns", description_event_engine_dns, additional_constraints_event_engine_dns, nullptr, 0, true, false}, + {"event_engine_dns_non_client_channel", + description_event_engine_dns_non_client_channel, + additional_constraints_event_engine_dns_non_client_channel, nullptr, 0, + false, false}, {"event_engine_listener", description_event_engine_listener, additional_constraints_event_engine_listener, nullptr, 0, true, true}, {"free_large_allocator", description_free_large_allocator, @@ -439,6 +462,8 @@ const ExperimentMetadata g_experiment_metadata[] = { description_promise_based_inproc_transport, additional_constraints_promise_based_inproc_transport, nullptr, 0, false, false}, + {"rq_fast_reject", description_rq_fast_reject, + additional_constraints_rq_fast_reject, nullptr, 0, false, true}, {"schedule_cancellation_over_write", description_schedule_cancellation_over_write, additional_constraints_schedule_cancellation_over_write, nullptr, 0, false, @@ -457,10 +482,6 @@ const ExperimentMetadata g_experiment_metadata[] = { description_unconstrained_max_quota_buffer_size, additional_constraints_unconstrained_max_quota_buffer_size, nullptr, 0, false, true}, - {"work_serializer_clears_time_cache", - description_work_serializer_clears_time_cache, - additional_constraints_work_serializer_clears_time_cache, nullptr, 0, true, - true}, {"work_serializer_dispatch", description_work_serializer_dispatch, additional_constraints_work_serializer_dispatch, nullptr, 0, true, true}, }; diff --git a/src/core/lib/experiments/experiments.h b/src/core/lib/experiments/experiments.h index 8aa59e12f9..99702c5bbd 100644 --- a/src/core/lib/experiments/experiments.h +++ b/src/core/lib/experiments/experiments.h @@ -65,6 +65,7 @@ inline bool IsClientPrivacyEnabled() { return false; } inline bool IsEventEngineApplicationCallbacksEnabled() { return true; } inline bool IsEventEngineClientEnabled() { return false; } inline bool IsEventEngineDnsEnabled() { return false; } +inline bool IsEventEngineDnsNonClientChannelEnabled() { return false; } inline bool IsEventEngineListenerEnabled() { return false; } inline bool IsFreeLargeAllocatorEnabled() { return false; } inline bool IsLocalConnectorSecureEnabled() { return false; } @@ -75,6 +76,7 @@ inline bool IsMultipingEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_PICK_FIRST_NEW inline bool IsPickFirstNewEnabled() { return true; } inline bool IsPromiseBasedInprocTransportEnabled() { return false; } +inline bool IsRqFastRejectEnabled() { return false; } inline bool IsScheduleCancellationOverWriteEnabled() { return false; } inline bool IsServerPrivacyEnabled() { return false; } inline bool IsTcpFrameSizeTuningEnabled() { return false; } @@ -84,8 +86,6 @@ inline bool IsTimeCachingInPartyEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_TRACE_RECORD_CALLOPS inline bool IsTraceRecordCallopsEnabled() { return true; } inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return false; } -#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE -inline bool IsWorkSerializerClearsTimeCacheEnabled() { return true; } inline bool IsWorkSerializerDispatchEnabled() { return false; } #elif defined(GPR_WINDOWS) @@ -99,6 +99,7 @@ inline bool IsEventEngineApplicationCallbacksEnabled() { return true; } inline bool IsEventEngineClientEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS inline bool IsEventEngineDnsEnabled() { return true; } +inline bool IsEventEngineDnsNonClientChannelEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER inline bool IsEventEngineListenerEnabled() { return true; } inline bool IsFreeLargeAllocatorEnabled() { return false; } @@ -110,6 +111,7 @@ inline bool IsMultipingEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_PICK_FIRST_NEW inline bool IsPickFirstNewEnabled() { return true; } inline bool IsPromiseBasedInprocTransportEnabled() { return false; } +inline bool IsRqFastRejectEnabled() { return false; } inline bool IsScheduleCancellationOverWriteEnabled() { return false; } inline bool IsServerPrivacyEnabled() { return false; } inline bool IsTcpFrameSizeTuningEnabled() { return false; } @@ -119,8 +121,6 @@ inline bool IsTimeCachingInPartyEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_TRACE_RECORD_CALLOPS inline bool IsTraceRecordCallopsEnabled() { return true; } inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return false; } -#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE -inline bool IsWorkSerializerClearsTimeCacheEnabled() { return true; } inline bool IsWorkSerializerDispatchEnabled() { return false; } #else @@ -130,9 +130,11 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; } inline bool IsClientPrivacyEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_APPLICATION_CALLBACKS inline bool IsEventEngineApplicationCallbacksEnabled() { return true; } -inline bool IsEventEngineClientEnabled() { return false; } +#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT +inline bool IsEventEngineClientEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS inline bool IsEventEngineDnsEnabled() { return true; } +inline bool IsEventEngineDnsNonClientChannelEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER inline bool IsEventEngineListenerEnabled() { return true; } inline bool IsFreeLargeAllocatorEnabled() { return false; } @@ -144,6 +146,7 @@ inline bool IsMultipingEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_PICK_FIRST_NEW inline bool IsPickFirstNewEnabled() { return true; } inline bool IsPromiseBasedInprocTransportEnabled() { return false; } +inline bool IsRqFastRejectEnabled() { return false; } inline bool IsScheduleCancellationOverWriteEnabled() { return false; } inline bool IsServerPrivacyEnabled() { return false; } inline bool IsTcpFrameSizeTuningEnabled() { return false; } @@ -153,8 +156,6 @@ inline bool IsTimeCachingInPartyEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_TRACE_RECORD_CALLOPS inline bool IsTraceRecordCallopsEnabled() { return true; } inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return false; } -#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE -inline bool IsWorkSerializerClearsTimeCacheEnabled() { return true; } #define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_DISPATCH inline bool IsWorkSerializerDispatchEnabled() { return true; } #endif @@ -167,6 +168,7 @@ enum ExperimentIds { kExperimentIdEventEngineApplicationCallbacks, kExperimentIdEventEngineClient, kExperimentIdEventEngineDns, + kExperimentIdEventEngineDnsNonClientChannel, kExperimentIdEventEngineListener, kExperimentIdFreeLargeAllocator, kExperimentIdLocalConnectorSecure, @@ -175,6 +177,7 @@ enum ExperimentIds { kExperimentIdMultiping, kExperimentIdPickFirstNew, kExperimentIdPromiseBasedInprocTransport, + kExperimentIdRqFastReject, kExperimentIdScheduleCancellationOverWrite, kExperimentIdServerPrivacy, kExperimentIdTcpFrameSizeTuning, @@ -182,7 +185,6 @@ enum ExperimentIds { kExperimentIdTimeCachingInParty, kExperimentIdTraceRecordCallops, kExperimentIdUnconstrainedMaxQuotaBufferSize, - kExperimentIdWorkSerializerClearsTimeCache, kExperimentIdWorkSerializerDispatch, kNumExperiments }; @@ -210,6 +212,10 @@ inline bool IsEventEngineClientEnabled() { inline bool IsEventEngineDnsEnabled() { return IsExperimentEnabled(); } +#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS_NON_CLIENT_CHANNEL +inline bool IsEventEngineDnsNonClientChannelEnabled() { + return IsExperimentEnabled(); +} #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER inline bool IsEventEngineListenerEnabled() { return IsExperimentEnabled(); @@ -242,6 +248,10 @@ inline bool IsPickFirstNewEnabled() { inline bool IsPromiseBasedInprocTransportEnabled() { return IsExperimentEnabled(); } +#define GRPC_EXPERIMENT_IS_INCLUDED_RQ_FAST_REJECT +inline bool IsRqFastRejectEnabled() { + return IsExperimentEnabled(); +} #define GRPC_EXPERIMENT_IS_INCLUDED_SCHEDULE_CANCELLATION_OVER_WRITE inline bool IsScheduleCancellationOverWriteEnabled() { return IsExperimentEnabled(); @@ -270,10 +280,6 @@ inline bool IsTraceRecordCallopsEnabled() { inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return IsExperimentEnabled(); } -#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE -inline bool IsWorkSerializerClearsTimeCacheEnabled() { - return IsExperimentEnabled(); -} #define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_DISPATCH inline bool IsWorkSerializerDispatchEnabled() { return IsExperimentEnabled(); diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index f4102a524a..4899e17346 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h @@ -40,8 +40,8 @@ #define GRPC_HAVE_IP_PKTINFO 1 #define GRPC_HAVE_MSG_NOSIGNAL 1 #define GRPC_HAVE_UNIX_SOCKET 1 -#if defined(LINUX_VERSION_CODE) && defined(__GLIBC_PREREQ) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) && __GLIBC_PREREQ(2, 18) +#if defined(LINUX_VERSION_CODE) && defined(__NDK_MAJOR__) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) && __NDK_MAJOR__ >= 14 #define GRPC_HAVE_VSOCK 1 #endif #endif diff --git a/src/core/lib/promise/all_ok.h b/src/core/lib/promise/all_ok.h index 72d9d3815b..2ca128f3c8 100644 --- a/src/core/lib/promise/all_ok.h +++ b/src/core/lib/promise/all_ok.h @@ -77,7 +77,7 @@ class AllOk { // If any fail, cancel the rest and return the failure. // If all succeed, return Ok. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto AllOk(Promises... promises) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto AllOk(Promises... promises) { return promise_detail::AllOk(std::move(promises)...); } diff --git a/src/core/lib/promise/cancel_callback.h b/src/core/lib/promise/cancel_callback.h index ed999c293f..9ff66231a4 100644 --- a/src/core/lib/promise/cancel_callback.h +++ b/src/core/lib/promise/cancel_callback.h @@ -69,8 +69,8 @@ class Handler { // completion. // Returns a promise with the same result type as main_fn. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto OnCancel(MainFn main_fn, - CancelFn cancel_fn) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto OnCancel(MainFn main_fn, + CancelFn cancel_fn) { return [on_cancel = cancel_callback_detail::Handler(std::move(cancel_fn)), main_fn = promise_detail::PromiseLike( @@ -87,8 +87,8 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto OnCancel(MainFn main_fn, // resulting promise. If the factory is dropped without being called, cancel_fn // is called. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto OnCancelFactory(MainFn main_fn, - CancelFn cancel_fn) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto OnCancelFactory( + MainFn main_fn, CancelFn cancel_fn) { return [on_cancel = cancel_callback_detail::Handler(std::move(cancel_fn)), main_fn = std::move(main_fn)]() mutable { diff --git a/src/core/lib/promise/context.h b/src/core/lib/promise/context.h index a0eed9396e..65ee6f1a4a 100644 --- a/src/core/lib/promise/context.h +++ b/src/core/lib/promise/context.h @@ -105,13 +105,13 @@ class WithContext { // Return true if a context of type T is currently active. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION bool HasContext() { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline bool HasContext() { return promise_detail::Context::get() != nullptr; } // Retrieve the current value of a context, or abort if the value is unset. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* GetContext() { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline T* GetContext() { auto* p = promise_detail::Context::get(); DCHECK_NE(p, nullptr); return p; @@ -119,12 +119,12 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* GetContext() { // Retrieve the current value of a context, or nullptr if the value is unset. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* MaybeGetContext() { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline T* MaybeGetContext() { return promise_detail::Context::get(); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION void SetContext(T* p) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline void SetContext(T* p) { promise_detail::Context::set(p); } diff --git a/src/core/lib/promise/detail/promise_factory.h b/src/core/lib/promise/detail/promise_factory.h index 49dc25c330..eba027464d 100644 --- a/src/core/lib/promise/detail/promise_factory.h +++ b/src/core/lib/promise/detail/promise_factory.h @@ -124,7 +124,7 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION // Promote a callable() -> T|Poll to a PromiseFactory(A) -> Promise // by dropping the argument passed to the factory. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< !IsVoidCallable>::value, PromiseLike>> PromiseFactoryImpl(F f, A&&) { return PromiseLike(std::move(f)); @@ -132,7 +132,7 @@ PromiseFactoryImpl(F f, A&&) { // Promote a callable() -> T|Poll to a PromiseFactory() -> Promise template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< !IsVoidCallable>::value, PromiseLike>> PromiseFactoryImpl(F f) { return PromiseLike(std::move(f)); @@ -140,7 +140,7 @@ PromiseFactoryImpl(F f) { // Given a callable(A) -> Promise, name it a PromiseFactory and use it. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< IsVoidCallable>::value, PromiseLike()(std::declval()))>> PromiseFactoryImpl(F&& f, A&& arg) { @@ -149,7 +149,7 @@ PromiseFactoryImpl(F&& f, A&& arg) { // Given a callable(A) -> Promise, name it a PromiseFactory and use it. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::enable_if_t< +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::enable_if_t< IsVoidCallable>::value, PromiseLike()(std::declval()))>> PromiseFactoryImpl(F& f, A&& arg) { diff --git a/src/core/lib/promise/detail/promise_like.h b/src/core/lib/promise/detail/promise_like.h index 8515e8b46f..b31d912645 100644 --- a/src/core/lib/promise/detail/promise_like.h +++ b/src/core/lib/promise/detail/promise_like.h @@ -63,7 +63,7 @@ struct PollWrapper> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto WrapInPoll(T&& x) +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto WrapInPoll(T&& x) -> decltype(PollWrapper::Wrap(std::forward(x))) { return PollWrapper::Wrap(std::forward(x)); } diff --git a/src/core/lib/promise/detail/status.h b/src/core/lib/promise/detail/status.h index d33c32644c..335c5365c2 100644 --- a/src/core/lib/promise/detail/status.h +++ b/src/core/lib/promise/detail/status.h @@ -30,7 +30,7 @@ namespace promise_detail { // Convert with a move the input status to an absl::Status. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION absl::Status IntoStatus( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline absl::Status IntoStatus( absl::StatusOr* status) { return std::move(status->status()); } @@ -103,7 +103,7 @@ struct StatusCastImpl&> { // For cases where the status is guaranteed to be a failure (and hence not // needing to preserve values) see FailureStatusCast<> below. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION To StatusCast(From&& from) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline To StatusCast(From&& from) { return StatusCastImpl::Cast(std::forward(from)); } @@ -127,7 +127,7 @@ struct FailureStatusCastImpl, const absl::Status&> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION To FailureStatusCast(From&& from) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline To FailureStatusCast(From&& from) { DCHECK(!IsStatusOk(from)); return FailureStatusCastImpl::Cast(std::forward(from)); } diff --git a/src/core/lib/promise/for_each.h b/src/core/lib/promise/for_each.h index c990f24984..b3c266b578 100644 --- a/src/core/lib/promise/for_each.h +++ b/src/core/lib/promise/for_each.h @@ -77,8 +77,8 @@ struct NextValueTraits> { return NextValueType::kEndOfStream; } - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Value& MutableValue(T& t) { - return *t; + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Value&& TakeValue(T& t) { + return std::move(*t); } }; @@ -95,9 +95,9 @@ struct NextValueTraits>> { return NextValueType::kError; } - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Value& MutableValue( + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Value&& TakeValue( ValueOrFailure>& t) { - return **t; + return std::move(**t); } }; @@ -179,7 +179,7 @@ class ForEach { << DebugTag() << " PollReaderNext: got value"; Destruct(&reader_next_); auto action = action_factory_.Make( - std::move(NextValueTraits::MutableValue(*p))); + NextValueTraits::TakeValue(*p)); Construct(&in_action_, std::move(action), std::move(*p)); reading_next_ = false; return PollAction(); @@ -229,7 +229,8 @@ class ForEach { /// For each item acquired by calling Reader::Next, run the promise Action. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION for_each_detail::ForEach +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline for_each_detail::ForEach ForEach(Reader reader, Action action, DebugLocation whence = {}) { return for_each_detail::ForEach(std::move(reader), std::move(action), whence); diff --git a/src/core/lib/promise/if.h b/src/core/lib/promise/if.h index 55d18aa74c..17e584c8ad 100644 --- a/src/core/lib/promise/if.h +++ b/src/core/lib/promise/if.h @@ -32,8 +32,8 @@ namespace grpc_core { namespace promise_detail { template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION typename CallPoll::PollResult ChooseIf( - CallPoll call_poll, bool result, T* if_true, F* if_false) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline typename CallPoll::PollResult +ChooseIf(CallPoll call_poll, bool result, T* if_true, F* if_false) { if (result) { auto promise = if_true->Make(); return call_poll(promise); @@ -44,8 +44,9 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION typename CallPoll::PollResult ChooseIf( } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION typename CallPoll::PollResult ChooseIf( - CallPoll call_poll, absl::StatusOr result, T* if_true, F* if_false) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline typename CallPoll::PollResult +ChooseIf(CallPoll call_poll, absl::StatusOr result, T* if_true, + F* if_false) { if (!result.ok()) { return typename CallPoll::PollResult(result.status()); } else if (*result) { @@ -199,7 +200,7 @@ class If { // This makes it safe to capture lambda arguments in the promise factory by // reference. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::If If( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::If If( C condition, T if_true, F if_false) { return promise_detail::If(std::move(condition), std::move(if_true), std::move(if_false)); diff --git a/src/core/lib/promise/loop.h b/src/core/lib/promise/loop.h index 768746f7b6..d2fda934cc 100644 --- a/src/core/lib/promise/loop.h +++ b/src/core/lib/promise/loop.h @@ -140,7 +140,7 @@ class Loop { // Expects F returns LoopCtl - if it's Continue, then run the loop again - // otherwise yield the returned value as the result of the loop. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Loop Loop(F f) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Loop Loop(F f) { return promise_detail::Loop(std::move(f)); } diff --git a/src/core/lib/promise/map.h b/src/core/lib/promise/map.h index 52023fd2dc..f93a852fcb 100644 --- a/src/core/lib/promise/map.h +++ b/src/core/lib/promise/map.h @@ -67,8 +67,8 @@ class Map { // Takes a promise, and a synchronous function to mutate its result, and // returns a promise. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Map Map( - Promise promise, Fn fn) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Map +Map(Promise promise, Fn fn) { return promise_detail::Map(std::move(promise), std::move(fn)); } @@ -76,7 +76,7 @@ GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Map Map( // and a bool indicating whether there was ever a Pending{} value observed from // polling. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto CheckDelayed(Promise promise) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto CheckDelayed(Promise promise) { using P = promise_detail::PromiseLike; return [delayed = false, promise = P(std::move(promise))]() mutable -> Poll> { diff --git a/src/core/lib/promise/poll.h b/src/core/lib/promise/poll.h index 879a5f4233..fc932f2f9e 100644 --- a/src/core/lib/promise/poll.h +++ b/src/core/lib/promise/poll.h @@ -222,8 +222,8 @@ struct PollTraits> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION bool operator==(const Poll& a, - const Poll& b) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline bool operator==(const Poll& a, + const Poll& b) { if (a.pending() && b.pending()) return true; if (a.ready() && b.ready()) return a.value() == b.value(); return false; @@ -262,7 +262,7 @@ struct PollCastImpl> { }; template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll poll_cast(U poll) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline Poll poll_cast(U poll) { return PollCastImpl::Cast(std::move(poll)); } diff --git a/src/core/lib/promise/promise.h b/src/core/lib/promise/promise.h index b5ac75d73d..8f98ab8d5d 100644 --- a/src/core/lib/promise/promise.h +++ b/src/core/lib/promise/promise.h @@ -71,8 +71,8 @@ class Immediate { // Return \a value immediately template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Immediate Immediate( - T value) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Immediate +Immediate(T value) { return promise_detail::Immediate(std::move(value)); } @@ -89,7 +89,7 @@ struct ImmediateOkStatus { // should fail to compile. When modifying this code these should be uncommented // and their miscompilation verified. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION auto WithResult(F f) -> +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto WithResult(F f) -> typename std::enable_if>::value, F>::type { return f; diff --git a/src/core/lib/promise/race.h b/src/core/lib/promise/race.h index a17fc074b7..96c5eb53ab 100644 --- a/src/core/lib/promise/race.h +++ b/src/core/lib/promise/race.h @@ -74,8 +74,8 @@ class Race { /// If two results are simultaneously available, bias towards the first result /// listed. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Race Race( - Promises... promises) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Race +Race(Promises... promises) { return promise_detail::Race(std::move(promises)...); } diff --git a/src/core/lib/promise/seq.h b/src/core/lib/promise/seq.h index 80cd298130..4c55daf28d 100644 --- a/src/core/lib/promise/seq.h +++ b/src/core/lib/promise/seq.h @@ -106,32 +106,33 @@ struct SeqIterResultTraits { // etc // Return the final value. template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION F Seq(F functor) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline F Seq(F functor) { return functor; } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq Seq( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq( F0 f0, F1 f1, DebugLocation whence = {}) { return promise_detail::Seq(std::move(f0), std::move(f1), whence); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq Seq( +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq( F0 f0, F1 f1, F2 f2, DebugLocation whence = {}) { return promise_detail::Seq(std::move(f0), std::move(f1), std::move(f2), whence); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq Seq( - F0 f0, F1 f1, F2 f2, F3 f3, DebugLocation whence = {}) { +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq +Seq(F0 f0, F1 f1, F2 f2, F3 f3, DebugLocation whence = {}) { return promise_detail::Seq( std::move(f0), std::move(f1), std::move(f2), std::move(f3), whence); } template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, DebugLocation whence = {}) { return promise_detail::Seq(std::move(f0), std::move(f1), std::move(f2), std::move(f3), @@ -140,7 +141,8 @@ Seq(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, DebugLocation whence = {}) { template -GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION promise_detail::Seq +GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline promise_detail::Seq Seq(F0 f0, F1 f1, F2 f2, F3 f3, F4 f4, F5 f5, DebugLocation whence = {}) { return promise_detail::Seq( std::move(f0), std::move(f1), std::move(f2), std::move(f3), std::move(f4), diff --git a/src/core/lib/promise/try_join.h b/src/core/lib/promise/try_join.h index e80eaee9a8..03a38c04e2 100644 --- a/src/core/lib/promise/try_join.h +++ b/src/core/lib/promise/try_join.h @@ -133,13 +133,14 @@ struct WrapInStatusOrTuple { // If any fail, cancel the rest and return the failure. // If all succeed, return Ok(tuple-of-results). template