grpc 1.75.0.pre1 → 1.76.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +18 -5
- data/include/grpc/credentials.h +21 -5
- data/src/core/call/call_filters.cc +4 -4
- data/src/core/call/call_filters.h +36 -36
- data/src/core/call/call_spine.h +27 -27
- data/src/core/call/client_call.cc +6 -5
- data/src/core/call/filter_fusion.h +5 -5
- data/src/core/call/metadata_batch.h +3 -3
- data/src/core/call/security_context.cc +1 -1
- data/src/core/call/server_call.cc +4 -4
- data/src/core/call/server_call.h +1 -1
- data/src/core/channelz/channelz.cc +12 -18
- data/src/core/channelz/channelz.h +32 -16
- data/src/core/channelz/channelz_registry.h +11 -0
- data/src/core/channelz/property_list.cc +18 -0
- data/src/core/channelz/property_list.h +10 -1
- data/src/core/channelz/text_encode.cc +66 -0
- data/src/core/channelz/text_encode.h +29 -0
- data/src/core/channelz/v2tov1/convert.cc +11 -0
- data/src/core/channelz/v2tov1/legacy_api.cc +15 -8
- data/src/core/channelz/ztrace_collector.h +247 -86
- data/src/core/client_channel/backup_poller.cc +5 -6
- data/src/core/client_channel/client_channel.cc +20 -13
- data/src/core/client_channel/client_channel_filter.cc +53 -45
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_internal.h +3 -4
- data/src/core/client_channel/config_selector.h +3 -3
- data/src/core/client_channel/dynamic_filters.cc +3 -3
- data/src/core/client_channel/global_subchannel_pool.cc +0 -37
- data/src/core/client_channel/global_subchannel_pool.h +0 -27
- data/src/core/client_channel/load_balanced_call_destination.cc +7 -7
- data/src/core/client_channel/local_subchannel_pool.cc +4 -4
- data/src/core/client_channel/retry_filter.h +3 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
- data/src/core/client_channel/subchannel.cc +8 -8
- data/src/core/client_channel/subchannel_stream_client.cc +4 -4
- data/src/core/config/config_vars.cc +30 -1
- data/src/core/config/config_vars.h +21 -0
- data/src/core/config/core_configuration.cc +5 -5
- data/src/core/config/core_configuration.h +7 -7
- data/src/core/config/load_config.cc +12 -0
- data/src/core/config/load_config.h +2 -0
- data/src/core/credentials/call/call_credentials.h +2 -2
- data/src/core/credentials/call/call_creds_util.cc +4 -3
- data/src/core/credentials/call/composite/composite_call_credentials.cc +4 -4
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +3 -3
- data/src/core/credentials/call/external/external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/iam/iam_credentials.cc +4 -4
- data/src/core/credentials/call/jwt/json_token.cc +3 -3
- data/src/core/credentials/call/jwt/jwt_credentials.cc +2 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +14 -13
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +20 -12
- data/src/core/credentials/call/plugin/plugin_credentials.cc +2 -2
- data/src/core/credentials/transport/alts/alts_credentials.cc +4 -4
- data/src/core/credentials/transport/alts/alts_security_connector.cc +14 -12
- data/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc +22 -2
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.cc +10 -1
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.h +31 -0
- data/src/core/credentials/transport/alts/grpc_alts_credentials_server_options.cc +8 -3
- data/src/core/credentials/transport/composite/composite_channel_credentials.cc +5 -5
- data/src/core/credentials/transport/fake/fake_security_connector.cc +2 -2
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +78 -28
- data/src/core/credentials/transport/insecure/insecure_security_connector.cc +3 -3
- data/src/core/credentials/transport/local/local_security_connector.cc +8 -8
- data/src/core/credentials/transport/security_connector.cc +5 -5
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +12 -12
- data/src/core/credentials/transport/ssl/ssl_credentials.h +2 -2
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +3 -3
- data/src/core/credentials/transport/tls/certificate_provider_registry.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +24 -24
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +5 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +17 -17
- data/src/core/credentials/transport/tls/ssl_utils.cc +14 -9
- data/src/core/credentials/transport/tls/tls_credentials.cc +2 -2
- data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -11
- data/src/core/credentials/transport/transport_credentials.cc +2 -2
- data/src/core/credentials/transport/transport_credentials.h +2 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +5 -5
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +2 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
- data/src/core/ext/filters/http/message_compress/compression_filter.h +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +7 -7
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -9
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +96 -88
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +12 -7
- data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +60 -0
- data/src/core/ext/transport/chttp2/transport/frame.cc +32 -10
- data/src/core/ext/transport/chttp2/transport/frame.h +16 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +28 -12
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -27
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +543 -366
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +198 -277
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +11 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +179 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +51 -23
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +13 -6
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +115 -71
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -14
- data/src/core/ext/transport/chttp2/transport/message_assembler.h +7 -7
- data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -15
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +62 -26
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +58 -22
- data/src/core/ext/transport/chttp2/transport/stream.h +207 -0
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +328 -187
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/transport_common.cc +17 -1
- data/src/core/ext/transport/chttp2/transport/transport_common.h +52 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +2 -2
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +181 -79
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +3 -3
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +740 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +218 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +46 -0
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +87 -55
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +23 -21
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c +80 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.c +129 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.h +72 -0
- data/src/core/filter/auth/server_auth_filter.cc +2 -2
- data/src/core/handshaker/handshaker.cc +3 -3
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +2 -2
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +2 -2
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +31 -8
- data/src/core/handshaker/security/secure_endpoint.cc +16 -6
- data/src/core/handshaker/security/security_handshaker.cc +3 -3
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +2 -2
- data/src/core/lib/channel/channel_stack.cc +8 -5
- data/src/core/lib/channel/channel_stack.h +3 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -0
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/promise_based_filter.cc +69 -64
- data/src/core/lib/channel/promise_based_filter.h +16 -15
- data/src/core/lib/compression/compression_internal.cc +2 -2
- data/src/core/lib/compression/message_compress.cc +7 -7
- data/src/core/lib/event_engine/ares_resolver.cc +22 -20
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -2
- data/src/core/lib/event_engine/extensions/channelz.h +2 -2
- data/src/core/lib/event_engine/extensions/supports_fd.h +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +8 -8
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -10
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +23 -22
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +11 -11
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +168 -170
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +33 -54
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +3 -3
- data/src/core/lib/event_engine/resolved_address.cc +3 -3
- data/src/core/lib/event_engine/shim.cc +8 -11
- data/src/core/lib/event_engine/shim.h +2 -1
- data/src/core/lib/event_engine/slice.cc +2 -2
- data/src/core/lib/event_engine/tcp_socket_utils.cc +11 -11
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +7 -7
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -31
- data/src/core/lib/event_engine/windows/iocp.cc +10 -10
- data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -11
- data/src/core/lib/event_engine/windows/windows_engine.cc +16 -14
- data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
- data/src/core/lib/experiments/experiments.cc +105 -18
- data/src/core/lib/experiments/experiments.h +43 -11
- data/src/core/lib/iomgr/call_combiner.cc +3 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +6 -6
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +5 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -14
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -15
- data/src/core/lib/iomgr/ev_poll_posix.cc +11 -11
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +5 -4
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +8 -8
- data/src/core/lib/iomgr/iomgr_windows.cc +3 -3
- data/src/core/lib/iomgr/lockfree_event.cc +2 -2
- data/src/core/lib/iomgr/polling_entity.cc +3 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +2 -2
- data/src/core/lib/iomgr/socket_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_posix.cc +42 -42
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +7 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +47 -27
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
- data/src/core/lib/iomgr/tcp_server_windows.cc +68 -29
- data/src/core/lib/iomgr/tcp_windows.cc +7 -7
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -2
- data/src/core/lib/promise/activity.cc +2 -2
- data/src/core/lib/promise/activity.h +6 -6
- data/src/core/lib/promise/context.h +2 -2
- data/src/core/lib/promise/detail/join_state.h +9 -9
- data/src/core/lib/promise/detail/seq_state.h +13 -13
- data/src/core/lib/promise/detail/status.h +2 -2
- data/src/core/lib/promise/for_each.h +5 -5
- data/src/core/lib/promise/interceptor_list.h +2 -2
- data/src/core/lib/promise/latch.h +7 -7
- data/src/core/lib/promise/mpsc.cc +26 -26
- data/src/core/lib/promise/mpsc.h +2 -2
- data/src/core/lib/promise/observable.h +4 -4
- data/src/core/lib/promise/party.cc +32 -25
- data/src/core/lib/promise/party.h +16 -19
- data/src/core/lib/promise/pipe.h +15 -15
- data/src/core/lib/promise/poll.h +5 -4
- data/src/core/lib/promise/promise.h +0 -2
- data/src/core/lib/promise/sleep.cc +3 -1
- data/src/core/lib/promise/status_flag.h +7 -7
- data/src/core/lib/promise/try_join.h +2 -2
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resource_quota/arena.h +15 -2
- data/src/core/lib/resource_quota/connection_quota.cc +9 -7
- data/src/core/lib/resource_quota/memory_quota.cc +45 -24
- data/src/core/lib/resource_quota/memory_quota.h +48 -16
- data/src/core/lib/resource_quota/telemetry.h +54 -0
- data/src/core/lib/resource_quota/thread_quota.cc +2 -2
- data/src/core/lib/resource_tracker/resource_tracker.cc +33 -0
- data/src/core/lib/resource_tracker/resource_tracker.h +46 -0
- data/src/core/lib/security/authorization/audit_logging.cc +5 -5
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +2 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -2
- data/src/core/lib/surface/call.cc +16 -14
- data/src/core/lib/surface/call.h +1 -1
- data/src/core/lib/surface/call_utils.cc +2 -2
- data/src/core/lib/surface/call_utils.h +2 -2
- data/src/core/lib/surface/channel.cc +4 -4
- data/src/core/lib/surface/channel_create.cc +10 -6
- data/src/core/lib/surface/channel_init.cc +80 -23
- data/src/core/lib/surface/channel_init.h +26 -11
- data/src/core/lib/surface/completion_queue.cc +17 -16
- data/src/core/lib/surface/completion_queue_factory.cc +7 -7
- data/src/core/lib/surface/connection_context.h +45 -2
- data/src/core/lib/surface/filter_stack_call.cc +12 -23
- data/src/core/lib/surface/filter_stack_call.h +3 -4
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/validate_metadata.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +3 -3
- data/src/core/lib/transport/promise_endpoint.cc +3 -3
- data/src/core/lib/transport/promise_endpoint.h +8 -8
- data/src/core/lib/transport/timeout_encoding.cc +4 -4
- data/src/core/load_balancing/child_policy_handler.cc +4 -4
- data/src/core/load_balancing/endpoint_list.cc +2 -2
- data/src/core/load_balancing/grpclb/grpclb.cc +24 -24
- data/src/core/load_balancing/health_check_client.cc +4 -4
- data/src/core/load_balancing/health_check_client_internal.h +2 -2
- data/src/core/load_balancing/lb_policy_registry.cc +2 -2
- data/src/core/load_balancing/oob_backend_metric.cc +4 -4
- data/src/core/load_balancing/oob_backend_metric_internal.h +2 -2
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
- data/src/core/load_balancing/pick_first/pick_first.cc +14 -14
- data/src/core/load_balancing/priority/priority.cc +23 -24
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -3
- data/src/core/load_balancing/rls/rls.cc +13 -13
- data/src/core/load_balancing/round_robin/round_robin.cc +9 -9
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +3 -3
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -26
- data/src/core/load_balancing/weighted_target/weighted_target.cc +5 -5
- data/src/core/load_balancing/xds/cds.cc +76 -32
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +3 -3
- data/src/core/load_balancing/xds/xds_override_host.cc +4 -4
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +33 -33
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -10
- data/src/core/resolver/dns/dns_resolver_plugin.cc +6 -3
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +2 -2
- data/src/core/resolver/endpoint_addresses.cc +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +41 -54
- data/src/core/resolver/polling_resolver.cc +3 -3
- data/src/core/resolver/resolver_registry.cc +5 -4
- data/src/core/resolver/xds/xds_dependency_manager.cc +5 -5
- data/src/core/resolver/xds/xds_resolver.cc +9 -9
- data/src/core/server/server.cc +38 -38
- data/src/core/server/server_call_tracer_filter.h +4 -4
- data/src/core/server/server_config_selector_filter.cc +2 -2
- data/src/core/server/xds_server_config_fetcher.cc +9 -8
- data/src/core/service_config/service_config_impl.h +2 -2
- data/src/core/telemetry/call_tracer.cc +39 -49
- data/src/core/telemetry/call_tracer.h +199 -22
- data/src/core/telemetry/histogram.h +205 -0
- data/src/core/telemetry/instrument.cc +719 -0
- data/src/core/telemetry/instrument.h +932 -0
- data/src/core/telemetry/metrics.cc +13 -5
- data/src/core/telemetry/metrics.h +3 -1
- data/src/core/telemetry/stats_data.cc +0 -19
- data/src/core/telemetry/stats_data.h +0 -19
- data/src/core/transport/auth_context.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +78 -45
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -31
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +7 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +9 -9
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -3
- data/src/core/tsi/ssl_transport_security.cc +26 -25
- data/src/core/tsi/ssl_transport_security_utils.cc +9 -9
- data/src/core/util/chunked_vector.h +4 -4
- data/src/core/util/event_log.cc +2 -2
- data/src/core/util/gcp_metadata_query.cc +2 -2
- data/src/core/util/grpc_check.cc +22 -0
- data/src/core/util/grpc_check.h +103 -0
- data/src/core/util/http_client/httpcli.cc +3 -3
- data/src/core/util/http_client/parser.cc +4 -4
- data/src/core/util/latent_see.h +7 -4
- data/src/core/util/lru_cache.h +4 -4
- data/src/core/util/memory_usage.h +16 -0
- data/src/core/util/posix/directory_reader.cc +3 -2
- data/src/core/util/posix/sync.cc +24 -24
- data/src/core/util/postmortem_emit.cc +52 -0
- data/src/core/util/postmortem_emit.h +30 -0
- data/src/core/util/ref_counted_ptr.h +5 -0
- data/src/core/util/trie_lookup.h +170 -0
- data/src/core/util/unique_ptr_with_bitset.h +5 -5
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +6 -1
- data/src/core/xds/grpc/xds_certificate_provider.cc +3 -3
- data/src/core/xds/grpc/xds_client_grpc.cc +34 -15
- data/src/core/xds/grpc/xds_client_grpc.h +4 -1
- data/src/core/xds/grpc/xds_cluster_parser.cc +2 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_endpoint_parser.cc +2 -2
- data/src/core/xds/grpc/xds_http_filter_registry.cc +4 -3
- data/src/core/xds/grpc/xds_listener_parser.cc +3 -3
- data/src/core/xds/grpc/xds_matcher.cc +277 -0
- data/src/core/xds/grpc/xds_matcher.h +432 -0
- data/src/core/xds/grpc/xds_matcher_action.cc +47 -0
- data/src/core/xds/grpc/xds_matcher_action.h +48 -0
- data/src/core/xds/grpc/xds_matcher_context.cc +29 -0
- data/src/core/xds/grpc/xds_matcher_context.h +46 -0
- data/src/core/xds/grpc/xds_matcher_input.cc +79 -0
- data/src/core/xds/grpc/xds_matcher_input.h +105 -0
- data/src/core/xds/grpc/xds_matcher_parse.cc +356 -0
- data/src/core/xds/grpc/xds_matcher_parse.h +39 -0
- data/src/core/xds/grpc/xds_metadata.cc +4 -3
- data/src/core/xds/grpc/xds_route_config_parser.cc +6 -6
- data/src/core/xds/grpc/xds_routing.cc +3 -3
- data/src/core/xds/grpc/xds_transport_grpc.cc +10 -10
- data/src/core/xds/xds_client/lrs_client.cc +6 -6
- data/src/core/xds/xds_client/xds_client.cc +9 -9
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/abseil-cpp/absl/container/internal/node_slot_policy.h +95 -0
- data/third_party/abseil-cpp/absl/container/node_hash_map.h +687 -0
- metadata +37 -2
@@ -27,7 +27,6 @@
|
|
27
27
|
|
28
28
|
#include "absl/base/attributes.h"
|
29
29
|
#include "absl/functional/any_invocable.h"
|
30
|
-
#include "absl/log/check.h"
|
31
30
|
#include "absl/strings/string_view.h"
|
32
31
|
#include "src/core/channelz/channelz.h"
|
33
32
|
#include "src/core/channelz/property_list.h"
|
@@ -41,6 +40,7 @@
|
|
41
40
|
#include "src/core/util/check_class_size.h"
|
42
41
|
#include "src/core/util/construct_destruct.h"
|
43
42
|
#include "src/core/util/crash.h"
|
43
|
+
#include "src/core/util/grpc_check.h"
|
44
44
|
#include "src/core/util/json/json_writer.h"
|
45
45
|
#include "src/core/util/ref_counted.h"
|
46
46
|
#include "src/core/util/ref_counted_ptr.h"
|
@@ -211,7 +211,7 @@ class Party : public Activity, private Wakeable {
|
|
211
211
|
party->state_.compare_exchange_weak(prev_state_,
|
212
212
|
(prev_state_ | kLocked) + kOneRef,
|
213
213
|
std::memory_order_relaxed)) {
|
214
|
-
|
214
|
+
GRPC_DCHECK_EQ(prev_state_ & ~(kRefMask | kAllocatedMask), 0u)
|
215
215
|
<< "Party should have contained no wakeups on lock";
|
216
216
|
// If we win, record that fact for the destructor
|
217
217
|
party->LogStateChange("WakeupHold", prev_state_,
|
@@ -349,7 +349,7 @@ class Party : public Activity, private Wakeable {
|
|
349
349
|
// Activity implementation: not allowed to be overridden by derived types.
|
350
350
|
void ForceImmediateRepoll(WakeupMask mask) final;
|
351
351
|
WakeupMask CurrentParticipant() const final {
|
352
|
-
|
352
|
+
GRPC_DCHECK(currently_polling_ != kNotPolling);
|
353
353
|
return 1u << currently_polling_;
|
354
354
|
}
|
355
355
|
Waker MakeOwningWaker() final;
|
@@ -383,7 +383,7 @@ class Party : public Activity, private Wakeable {
|
|
383
383
|
SpawnSerializer* MakeSpawnSerializer() {
|
384
384
|
auto* const serializer = arena_->New<SpawnSerializer>(this);
|
385
385
|
const size_t slot = AddParticipant(serializer);
|
386
|
-
|
386
|
+
GRPC_DCHECK_NE(slot, std::numeric_limits<size_t>::max());
|
387
387
|
serializer->wakeup_mask_ = 1ull << slot;
|
388
388
|
return serializer;
|
389
389
|
}
|
@@ -401,8 +401,9 @@ class Party : public Activity, private Wakeable {
|
|
401
401
|
|
402
402
|
// Derived types should be constructed upon `arena`.
|
403
403
|
explicit Party(RefCountedPtr<Arena> arena) : arena_(std::move(arena)) {
|
404
|
-
|
405
|
-
|
404
|
+
GRPC_CHECK(
|
405
|
+
arena_->GetContext<grpc_event_engine::experimental::EventEngine>() !=
|
406
|
+
nullptr);
|
406
407
|
}
|
407
408
|
~Party() override;
|
408
409
|
|
@@ -455,15 +456,11 @@ class Party : public Activity, private Wakeable {
|
|
455
456
|
channelz::PropertyList ChannelzProperties() override {
|
456
457
|
return channelz::PropertyList()
|
457
458
|
.Set("on_complete", TypeName<OnComplete>())
|
458
|
-
.Set("factory",
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
factory.Set("factory",
|
464
|
-
TypeName<typename Factory::UnderlyingFactory>());
|
465
|
-
}
|
466
|
-
return factory;
|
459
|
+
.Set("factory", TypeName<typename Factory::UnderlyingFactory>())
|
460
|
+
.Merge([this]() {
|
461
|
+
channelz::PropertyList p;
|
462
|
+
if (started_) p.Set("promise", PromiseProperty(&promise_));
|
463
|
+
return p;
|
467
464
|
}());
|
468
465
|
}
|
469
466
|
|
@@ -636,7 +633,7 @@ class Party : public Activity, private Wakeable {
|
|
636
633
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION void WakeupFromState(
|
637
634
|
uint64_t cur_state, WakeupMask wakeup_mask) {
|
638
635
|
GRPC_LATENT_SEE_SCOPE("Party::WakeupFromState");
|
639
|
-
|
636
|
+
GRPC_DCHECK_NE(wakeup_mask & kWakeupMask, 0u)
|
640
637
|
<< "Wakeup mask must be non-zero: " << wakeup_mask;
|
641
638
|
while (true) {
|
642
639
|
if (cur_state & kLocked) {
|
@@ -644,9 +641,9 @@ class Party : public Activity, private Wakeable {
|
|
644
641
|
// we'll immediately unref. Since something is running this should never
|
645
642
|
// bring the refcount to zero.
|
646
643
|
if constexpr (kReffed) {
|
647
|
-
|
644
|
+
GRPC_DCHECK_GT(cur_state & kRefMask, kOneRef);
|
648
645
|
} else {
|
649
|
-
|
646
|
+
GRPC_DCHECK_GE(cur_state & kRefMask, kOneRef);
|
650
647
|
}
|
651
648
|
const uint64_t new_state =
|
652
649
|
(cur_state | wakeup_mask) - (kReffed ? kOneRef : 0);
|
@@ -657,7 +654,7 @@ class Party : public Activity, private Wakeable {
|
|
657
654
|
}
|
658
655
|
} else {
|
659
656
|
// If the party is not locked, we need to lock it and run.
|
660
|
-
|
657
|
+
GRPC_DCHECK_EQ(cur_state & kWakeupMask, 0u);
|
661
658
|
const uint64_t new_state =
|
662
659
|
(cur_state | kLocked) + (kReffed ? 0 : kOneRef);
|
663
660
|
if (state_.compare_exchange_weak(cur_state, new_state,
|
data/src/core/lib/promise/pipe.h
CHANGED
@@ -25,7 +25,6 @@
|
|
25
25
|
#include <utility>
|
26
26
|
#include <variant>
|
27
27
|
|
28
|
-
#include "absl/log/check.h"
|
29
28
|
#include "absl/log/log.h"
|
30
29
|
#include "absl/strings/str_cat.h"
|
31
30
|
#include "src/core/lib/promise/activity.h"
|
@@ -37,6 +36,7 @@
|
|
37
36
|
#include "src/core/lib/promise/seq.h"
|
38
37
|
#include "src/core/lib/resource_quota/arena.h"
|
39
38
|
#include "src/core/util/debug_location.h"
|
39
|
+
#include "src/core/util/grpc_check.h"
|
40
40
|
#include "src/core/util/ref_counted_ptr.h"
|
41
41
|
|
42
42
|
namespace grpc_core {
|
@@ -58,10 +58,10 @@ struct Pipe;
|
|
58
58
|
template <typename T>
|
59
59
|
class NextResult final {
|
60
60
|
public:
|
61
|
-
NextResult() : center_(nullptr) {}
|
61
|
+
NextResult() : center_(nullptr), cancelled_(true) {}
|
62
62
|
explicit NextResult(RefCountedPtr<pipe_detail::Center<T>> center)
|
63
|
-
: center_(std::move(center)) {
|
64
|
-
|
63
|
+
: center_(std::move(center)), cancelled_(false) {
|
64
|
+
GRPC_CHECK(center_ != nullptr);
|
65
65
|
}
|
66
66
|
explicit NextResult(bool cancelled)
|
67
67
|
: center_(nullptr), cancelled_(cancelled) {}
|
@@ -77,11 +77,11 @@ class NextResult final {
|
|
77
77
|
bool has_value() const;
|
78
78
|
// Only valid if has_value()
|
79
79
|
const T& value() const {
|
80
|
-
|
80
|
+
GRPC_CHECK(has_value());
|
81
81
|
return **this;
|
82
82
|
}
|
83
83
|
T& value() {
|
84
|
-
|
84
|
+
GRPC_CHECK(has_value());
|
85
85
|
return **this;
|
86
86
|
}
|
87
87
|
const T& operator*() const;
|
@@ -118,7 +118,7 @@ class Center : public InterceptorList<T> {
|
|
118
118
|
GRPC_TRACE_VLOG(promise_primitives, 2)
|
119
119
|
<< DebugOpString("IncrementRefCount");
|
120
120
|
refs_++;
|
121
|
-
|
121
|
+
GRPC_DCHECK_NE(refs_, 0);
|
122
122
|
}
|
123
123
|
|
124
124
|
RefCountedPtr<Center> Ref() {
|
@@ -130,7 +130,7 @@ class Center : public InterceptorList<T> {
|
|
130
130
|
// If no refs remain, destroy this object
|
131
131
|
void Unref() {
|
132
132
|
GRPC_TRACE_VLOG(promise_primitives, 2) << DebugOpString("Unref");
|
133
|
-
|
133
|
+
GRPC_DCHECK_GT(refs_, 0);
|
134
134
|
refs_--;
|
135
135
|
if (0 == refs_) {
|
136
136
|
this->~Center();
|
@@ -143,7 +143,7 @@ class Center : public InterceptorList<T> {
|
|
143
143
|
// Return false if the recv end is closed.
|
144
144
|
Poll<bool> Push(T* value) {
|
145
145
|
GRPC_TRACE_LOG(promise_primitives, INFO) << DebugOpString("Push");
|
146
|
-
|
146
|
+
GRPC_DCHECK_NE(refs_, 0);
|
147
147
|
switch (value_state_) {
|
148
148
|
case ValueState::kClosed:
|
149
149
|
case ValueState::kReadyClosed:
|
@@ -165,7 +165,7 @@ class Center : public InterceptorList<T> {
|
|
165
165
|
|
166
166
|
Poll<bool> PollAck() {
|
167
167
|
GRPC_TRACE_LOG(promise_primitives, INFO) << DebugOpString("PollAck");
|
168
|
-
|
168
|
+
GRPC_DCHECK_NE(refs_, 0);
|
169
169
|
switch (value_state_) {
|
170
170
|
case ValueState::kClosed:
|
171
171
|
return true;
|
@@ -191,7 +191,7 @@ class Center : public InterceptorList<T> {
|
|
191
191
|
// Return nullopt if the send end is closed and no value had been pushed.
|
192
192
|
Poll<std::optional<T>> Next() {
|
193
193
|
GRPC_TRACE_LOG(promise_primitives, INFO) << DebugOpString("Next");
|
194
|
-
|
194
|
+
GRPC_DCHECK_NE(refs_, 0);
|
195
195
|
switch (value_state_) {
|
196
196
|
case ValueState::kEmpty:
|
197
197
|
case ValueState::kAcked:
|
@@ -216,7 +216,7 @@ class Center : public InterceptorList<T> {
|
|
216
216
|
Poll<bool> PollClosedForSender() {
|
217
217
|
GRPC_TRACE_LOG(promise_primitives, INFO)
|
218
218
|
<< DebugOpString("PollClosedForSender");
|
219
|
-
|
219
|
+
GRPC_DCHECK_NE(refs_, 0);
|
220
220
|
switch (value_state_) {
|
221
221
|
case ValueState::kEmpty:
|
222
222
|
case ValueState::kAcked:
|
@@ -238,7 +238,7 @@ class Center : public InterceptorList<T> {
|
|
238
238
|
Poll<bool> PollClosedForReceiver() {
|
239
239
|
GRPC_TRACE_LOG(promise_primitives, INFO)
|
240
240
|
<< DebugOpString("PollClosedForReceiver");
|
241
|
-
|
241
|
+
GRPC_DCHECK_NE(refs_, 0);
|
242
242
|
switch (value_state_) {
|
243
243
|
case ValueState::kEmpty:
|
244
244
|
case ValueState::kAcked:
|
@@ -257,7 +257,7 @@ class Center : public InterceptorList<T> {
|
|
257
257
|
|
258
258
|
Poll<Empty> PollEmpty() {
|
259
259
|
GRPC_TRACE_LOG(promise_primitives, INFO) << DebugOpString("PollEmpty");
|
260
|
-
|
260
|
+
GRPC_DCHECK_NE(refs_, 0);
|
261
261
|
switch (value_state_) {
|
262
262
|
case ValueState::kReady:
|
263
263
|
case ValueState::kReadyClosed:
|
@@ -646,7 +646,7 @@ class Push {
|
|
646
646
|
return Pending{};
|
647
647
|
}
|
648
648
|
}
|
649
|
-
|
649
|
+
GRPC_DCHECK(std::holds_alternative<AwaitingAck>(state_));
|
650
650
|
return center_->PollAck();
|
651
651
|
}
|
652
652
|
|
data/src/core/lib/promise/poll.h
CHANGED
@@ -21,10 +21,11 @@
|
|
21
21
|
#include <string>
|
22
22
|
#include <utility>
|
23
23
|
|
24
|
-
#include "absl/
|
24
|
+
#include "absl/status/statusor.h"
|
25
25
|
#include "absl/strings/str_format.h"
|
26
26
|
#include "absl/strings/str_join.h"
|
27
27
|
#include "src/core/util/construct_destruct.h"
|
28
|
+
#include "src/core/util/grpc_check.h"
|
28
29
|
|
29
30
|
namespace grpc_core {
|
30
31
|
|
@@ -112,12 +113,12 @@ class Poll {
|
|
112
113
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION bool ready() const { return ready_; }
|
113
114
|
|
114
115
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T& value() {
|
115
|
-
|
116
|
+
GRPC_DCHECK(ready());
|
116
117
|
return value_;
|
117
118
|
}
|
118
119
|
|
119
120
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION const T& value() const {
|
120
|
-
|
121
|
+
GRPC_DCHECK(ready());
|
121
122
|
return value_;
|
122
123
|
}
|
123
124
|
|
@@ -174,7 +175,7 @@ class Poll<Empty> {
|
|
174
175
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION bool ready() const { return ready_; }
|
175
176
|
|
176
177
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Empty value() const {
|
177
|
-
|
178
|
+
GRPC_DCHECK(ready());
|
178
179
|
return Empty{};
|
179
180
|
}
|
180
181
|
|
@@ -56,7 +56,9 @@ Poll<absl::Status> Sleep::operator()() {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
Sleep::ActiveClosure::ActiveClosure(Timestamp deadline)
|
59
|
-
: waker_(
|
59
|
+
: waker_((IsSleepUseNonOwningWakerEnabled())
|
60
|
+
? GetContext<Activity>()->MakeNonOwningWaker()
|
61
|
+
: GetContext<Activity>()->MakeOwningWaker()),
|
60
62
|
event_engine_(GetContext<EventEngine>()->shared_from_this()),
|
61
63
|
timer_handle_(
|
62
64
|
event_engine_->RunAfter(deadline - Timestamp::Now(), this)) {}
|
@@ -20,12 +20,12 @@
|
|
20
20
|
#include <optional>
|
21
21
|
#include <ostream>
|
22
22
|
|
23
|
-
#include "absl/log/check.h"
|
24
23
|
#include "absl/status/status.h"
|
25
24
|
#include "absl/status/statusor.h"
|
26
25
|
#include "absl/strings/str_cat.h"
|
27
26
|
#include "absl/strings/str_join.h"
|
28
27
|
#include "src/core/lib/promise/detail/status.h"
|
28
|
+
#include "src/core/util/grpc_check.h"
|
29
29
|
|
30
30
|
namespace grpc_core {
|
31
31
|
|
@@ -198,7 +198,7 @@ template <typename T>
|
|
198
198
|
struct FailureStatusCastImpl<absl::StatusOr<T>, StatusFlag> {
|
199
199
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static absl::StatusOr<T> Cast(
|
200
200
|
StatusFlag flag) {
|
201
|
-
|
201
|
+
GRPC_DCHECK(!flag.ok());
|
202
202
|
return absl::CancelledError();
|
203
203
|
}
|
204
204
|
};
|
@@ -207,7 +207,7 @@ template <typename T>
|
|
207
207
|
struct FailureStatusCastImpl<absl::StatusOr<T>, StatusFlag&> {
|
208
208
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static absl::StatusOr<T> Cast(
|
209
209
|
StatusFlag flag) {
|
210
|
-
|
210
|
+
GRPC_DCHECK(!flag.ok());
|
211
211
|
return absl::CancelledError();
|
212
212
|
}
|
213
213
|
};
|
@@ -216,7 +216,7 @@ template <typename T>
|
|
216
216
|
struct FailureStatusCastImpl<absl::StatusOr<T>, const StatusFlag&> {
|
217
217
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static absl::StatusOr<T> Cast(
|
218
218
|
StatusFlag flag) {
|
219
|
-
|
219
|
+
GRPC_DCHECK(!flag.ok());
|
220
220
|
return absl::CancelledError();
|
221
221
|
}
|
222
222
|
};
|
@@ -230,7 +230,7 @@ class ValueOrFailure {
|
|
230
230
|
// NOLINTNEXTLINE(google-explicit-constructor)
|
231
231
|
ValueOrFailure(Failure) {}
|
232
232
|
// NOLINTNEXTLINE(google-explicit-constructor)
|
233
|
-
ValueOrFailure(StatusFlag status) {
|
233
|
+
ValueOrFailure(StatusFlag status) { GRPC_CHECK(!status.ok()); }
|
234
234
|
|
235
235
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static ValueOrFailure FromOptional(
|
236
236
|
std::optional<T> value) {
|
@@ -356,7 +356,7 @@ template <typename T>
|
|
356
356
|
struct StatusCastImpl<ValueOrFailure<T>, StatusFlag&> {
|
357
357
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static ValueOrFailure<T> Cast(
|
358
358
|
StatusFlag f) {
|
359
|
-
|
359
|
+
GRPC_CHECK(!f.ok());
|
360
360
|
return ValueOrFailure<T>(Failure{});
|
361
361
|
}
|
362
362
|
};
|
@@ -365,7 +365,7 @@ template <typename T>
|
|
365
365
|
struct StatusCastImpl<ValueOrFailure<T>, StatusFlag> {
|
366
366
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static ValueOrFailure<T> Cast(
|
367
367
|
StatusFlag f) {
|
368
|
-
|
368
|
+
GRPC_CHECK(!f.ok());
|
369
369
|
return ValueOrFailure<T>(Failure{});
|
370
370
|
}
|
371
371
|
};
|
@@ -20,7 +20,6 @@
|
|
20
20
|
#include <tuple>
|
21
21
|
#include <variant>
|
22
22
|
|
23
|
-
#include "absl/log/check.h"
|
24
23
|
#include "absl/meta/type_traits.h"
|
25
24
|
#include "absl/status/status.h"
|
26
25
|
#include "absl/status/statusor.h"
|
@@ -28,6 +27,7 @@
|
|
28
27
|
#include "src/core/lib/promise/map.h"
|
29
28
|
#include "src/core/lib/promise/poll.h"
|
30
29
|
#include "src/core/lib/promise/status_flag.h"
|
30
|
+
#include "src/core/util/grpc_check.h"
|
31
31
|
|
32
32
|
namespace grpc_core {
|
33
33
|
|
@@ -212,7 +212,7 @@ struct TryJoinTraits {
|
|
212
212
|
template <typename R, typename T>
|
213
213
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static R EarlyReturn(
|
214
214
|
const ValueOrFailure<T>& x) {
|
215
|
-
|
215
|
+
GRPC_CHECK(!x.ok());
|
216
216
|
return FailureStatusCast<R>(Failure{});
|
217
217
|
}
|
218
218
|
template <typename... A>
|
@@ -21,7 +21,6 @@
|
|
21
21
|
#include <type_traits>
|
22
22
|
#include <utility>
|
23
23
|
|
24
|
-
#include "absl/log/check.h"
|
25
24
|
#include "absl/meta/type_traits.h"
|
26
25
|
#include "absl/status/status.h"
|
27
26
|
#include "absl/status/statusor.h"
|
@@ -31,6 +30,7 @@
|
|
31
30
|
#include "src/core/lib/promise/detail/status.h"
|
32
31
|
#include "src/core/lib/promise/poll.h"
|
33
32
|
#include "src/core/lib/promise/status_flag.h"
|
33
|
+
#include "src/core/util/grpc_check.h"
|
34
34
|
|
35
35
|
namespace grpc_core {
|
36
36
|
|
@@ -208,7 +208,7 @@ struct TrySeqTraitsWithSfinae<
|
|
208
208
|
}
|
209
209
|
template <typename R>
|
210
210
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static R ReturnValue(T&& status) {
|
211
|
-
|
211
|
+
GRPC_DCHECK(!IsStatusOk(status));
|
212
212
|
return FailureStatusCast<R>(status.status());
|
213
213
|
}
|
214
214
|
template <typename Result, typename RunNext>
|
@@ -102,6 +102,20 @@ template <typename T>
|
|
102
102
|
const uint16_t ArenaContextTraits<T>::id_ =
|
103
103
|
BaseArenaContextTraits::MakeId(DestroyArenaContext<T>);
|
104
104
|
|
105
|
+
template <typename T, typename SfinaeVoid = void>
|
106
|
+
struct GetContextId {
|
107
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static uint16_t id() {
|
108
|
+
return ArenaContextTraits<T>::id();
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
template <typename T>
|
113
|
+
struct GetContextId<T, std::void_t<typename ContextSubclass<T>::Base>> {
|
114
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static uint16_t id() {
|
115
|
+
return GetContextId<typename ContextSubclass<T>::Base>::id();
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
105
119
|
template <typename T, typename A, typename B>
|
106
120
|
struct IfArray {
|
107
121
|
using Result = A;
|
@@ -292,8 +306,7 @@ class Arena final : public RefCounted<Arena, NonPolymorphicRefCount,
|
|
292
306
|
// often needs to access these directly.
|
293
307
|
template <typename T>
|
294
308
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION T* GetContext() {
|
295
|
-
return static_cast<T*>(
|
296
|
-
contexts()[arena_detail::ArenaContextTraits<T>::id()]);
|
309
|
+
return static_cast<T*>(contexts()[arena_detail::GetContextId<T>::id()]);
|
297
310
|
}
|
298
311
|
|
299
312
|
template <typename T>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
#include <atomic>
|
20
20
|
#include <cstdint>
|
21
21
|
|
22
|
-
#include "
|
22
|
+
#include "src/core/util/grpc_check.h"
|
23
23
|
|
24
24
|
namespace grpc_core {
|
25
25
|
|
@@ -27,16 +27,17 @@ ConnectionQuota::ConnectionQuota() = default;
|
|
27
27
|
|
28
28
|
void ConnectionQuota::SetMaxIncomingConnections(int max_incoming_connections) {
|
29
29
|
// The maximum can only be configured once.
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
GRPC_CHECK_LT(max_incoming_connections, INT_MAX);
|
31
|
+
GRPC_CHECK(max_incoming_connections_.exchange(max_incoming_connections,
|
32
|
+
std::memory_order_release) ==
|
33
|
+
INT_MAX);
|
33
34
|
}
|
34
35
|
|
35
36
|
// Returns true if the incoming connection is allowed to be accepted on the
|
36
37
|
// server.
|
37
38
|
bool ConnectionQuota::AllowIncomingConnection(MemoryQuotaRefPtr mem_quota,
|
38
39
|
absl::string_view /*peer*/) {
|
39
|
-
if (mem_quota->
|
40
|
+
if (mem_quota->RejectNewConnectionsUnderHighMemoryPressure()) {
|
40
41
|
return false;
|
41
42
|
}
|
42
43
|
|
@@ -62,8 +63,9 @@ void ConnectionQuota::ReleaseConnections(int num_connections) {
|
|
62
63
|
if (max_incoming_connections_.load(std::memory_order_relaxed) == INT_MAX) {
|
63
64
|
return;
|
64
65
|
}
|
65
|
-
|
66
|
-
|
66
|
+
GRPC_CHECK(active_incoming_connections_.fetch_sub(
|
67
|
+
num_connections, std::memory_order_acq_rel) >=
|
68
|
+
num_connections);
|
67
69
|
}
|
68
70
|
|
69
71
|
} // namespace grpc_core
|
@@ -28,7 +28,6 @@
|
|
28
28
|
#include <tuple>
|
29
29
|
#include <utility>
|
30
30
|
|
31
|
-
#include "absl/log/check.h"
|
32
31
|
#include "absl/log/log.h"
|
33
32
|
#include "absl/status/status.h"
|
34
33
|
#include "absl/strings/str_cat.h"
|
@@ -40,7 +39,9 @@
|
|
40
39
|
#include "src/core/lib/promise/map.h"
|
41
40
|
#include "src/core/lib/promise/race.h"
|
42
41
|
#include "src/core/lib/promise/seq.h"
|
42
|
+
#include "src/core/lib/resource_tracker/resource_tracker.h"
|
43
43
|
#include "src/core/lib/slice/slice_refcount.h"
|
44
|
+
#include "src/core/util/grpc_check.h"
|
44
45
|
#include "src/core/util/mpscq.h"
|
45
46
|
#include "src/core/util/useful.h"
|
46
47
|
|
@@ -132,16 +133,20 @@ class SliceRefCount : public grpc_slice_refcount {
|
|
132
133
|
size_t size_;
|
133
134
|
};
|
134
135
|
|
135
|
-
std::atomic<double> container_memory_pressure{0.0};
|
136
|
-
|
137
136
|
} // namespace
|
138
137
|
|
139
|
-
void SetContainerMemoryPressure(double pressure) {
|
140
|
-
container_memory_pressure.store(pressure, std::memory_order_relaxed);
|
141
|
-
}
|
142
|
-
|
143
138
|
double ContainerMemoryPressure() {
|
144
|
-
|
139
|
+
auto* tracker = ResourceTracker::Get();
|
140
|
+
if (tracker == nullptr) {
|
141
|
+
return 0.0;
|
142
|
+
}
|
143
|
+
auto value = tracker->GetMetricValue("memory");
|
144
|
+
if (!value.ok()) {
|
145
|
+
LOG(WARNING) << "Failed to get 'memory' metric from ResourceTracker: "
|
146
|
+
<< value.status();
|
147
|
+
return 0.0;
|
148
|
+
}
|
149
|
+
return *value;
|
145
150
|
}
|
146
151
|
|
147
152
|
//
|
@@ -272,9 +277,9 @@ GrpcMemoryAllocatorImpl::GrpcMemoryAllocatorImpl(
|
|
272
277
|
}
|
273
278
|
|
274
279
|
GrpcMemoryAllocatorImpl::~GrpcMemoryAllocatorImpl() {
|
275
|
-
|
276
|
-
|
277
|
-
|
280
|
+
GRPC_CHECK_EQ(free_bytes_.load(std::memory_order_acquire) +
|
281
|
+
sizeof(GrpcMemoryAllocatorImpl),
|
282
|
+
taken_bytes_.load(std::memory_order_relaxed));
|
278
283
|
memory_quota_->Return(taken_bytes_.load(std::memory_order_relaxed));
|
279
284
|
}
|
280
285
|
|
@@ -285,7 +290,7 @@ void GrpcMemoryAllocatorImpl::Shutdown() {
|
|
285
290
|
reclamation_handles[kNumReclamationPasses];
|
286
291
|
{
|
287
292
|
MutexLock lock(&reclaimer_mu_);
|
288
|
-
|
293
|
+
GRPC_CHECK(!shutdown_);
|
289
294
|
shutdown_ = true;
|
290
295
|
memory_quota = memory_quota_;
|
291
296
|
for (size_t i = 0; i < kNumReclamationPasses; i++) {
|
@@ -297,8 +302,8 @@ void GrpcMemoryAllocatorImpl::Shutdown() {
|
|
297
302
|
size_t GrpcMemoryAllocatorImpl::Reserve(MemoryRequest request) {
|
298
303
|
// Validate request - performed here so we don't bloat the generated code with
|
299
304
|
// inlined asserts.
|
300
|
-
|
301
|
-
|
305
|
+
GRPC_CHECK(request.min() <= request.max());
|
306
|
+
GRPC_CHECK(request.max() <= MemoryRequest::max_allowed_size());
|
302
307
|
size_t old_free = free_bytes_.load(std::memory_order_relaxed);
|
303
308
|
|
304
309
|
while (true) {
|
@@ -376,7 +381,7 @@ void GrpcMemoryAllocatorImpl::MaybeDonateBack() {
|
|
376
381
|
std::memory_order_acquire)) {
|
377
382
|
GRPC_TRACE_LOG(resource_quota, INFO)
|
378
383
|
<< "[" << this << "] Early return " << ret << " bytes";
|
379
|
-
|
384
|
+
GRPC_CHECK(taken_bytes_.fetch_sub(ret, std::memory_order_relaxed) >= ret);
|
380
385
|
memory_quota_->Return(ret);
|
381
386
|
return;
|
382
387
|
}
|
@@ -448,11 +453,20 @@ class BasicMemoryQuota::WaitForSweepPromise {
|
|
448
453
|
};
|
449
454
|
|
450
455
|
BasicMemoryQuota::BasicMemoryQuota(
|
451
|
-
RefCountedPtr<channelz::ResourceQuotaNode> channelz_node
|
452
|
-
|
456
|
+
RefCountedPtr<channelz::ResourceQuotaNode> channelz_node,
|
457
|
+
InstrumentStorageRefPtr<ResourceQuotaDomain> telemetry_storage)
|
458
|
+
: channelz::DataSource(channelz_node),
|
459
|
+
GaugeProvider(telemetry_storage),
|
460
|
+
telemetry_storage_(std::move(telemetry_storage)) {
|
461
|
+
ProviderConstructed();
|
453
462
|
channelz::DataSource::SourceConstructed();
|
454
463
|
}
|
455
464
|
|
465
|
+
BasicMemoryQuota::~BasicMemoryQuota() {
|
466
|
+
ProviderDestructing();
|
467
|
+
channelz::DataSource::SourceDestructing();
|
468
|
+
}
|
469
|
+
|
456
470
|
void BasicMemoryQuota::Start() {
|
457
471
|
auto self = shared_from_this();
|
458
472
|
|
@@ -518,7 +532,7 @@ void BasicMemoryQuota::Start() {
|
|
518
532
|
reclaimer_activity_ =
|
519
533
|
MakeActivity(std::move(reclamation_loop), ExecCtxWakeupScheduler(),
|
520
534
|
[](absl::Status status) {
|
521
|
-
|
535
|
+
GRPC_CHECK(status.code() == absl::StatusCode::kCancelled);
|
522
536
|
});
|
523
537
|
}
|
524
538
|
|
@@ -538,7 +552,7 @@ void BasicMemoryQuota::SetSize(size_t new_size) {
|
|
538
552
|
void BasicMemoryQuota::Take(GrpcMemoryAllocatorImpl* allocator, size_t amount) {
|
539
553
|
// If there's a request for nothing, then do nothing!
|
540
554
|
if (amount == 0) return;
|
541
|
-
|
555
|
+
GRPC_DCHECK(amount <= std::numeric_limits<intptr_t>::max());
|
542
556
|
// Grab memory from the quota.
|
543
557
|
auto prior = free_bytes_.fetch_sub(amount, std::memory_order_acq_rel);
|
544
558
|
// If we push into overcommit, awake the reclaimer.
|
@@ -698,12 +712,21 @@ BasicMemoryQuota::PressureInfo BasicMemoryQuota::GetPressureInfo() {
|
|
698
712
|
return pressure_info;
|
699
713
|
}
|
700
714
|
|
715
|
+
void BasicMemoryQuota::PopulateGaugeData(GaugeSink<ResourceQuotaDomain>& sink) {
|
716
|
+
auto pressure_info = GetPressureInfo();
|
717
|
+
sink.Set(ResourceQuotaDomain::kInstantaneousMemoryPressure,
|
718
|
+
pressure_info.instantaneous_pressure);
|
719
|
+
sink.Set(ResourceQuotaDomain::kMemoryPressureControlValue,
|
720
|
+
pressure_info.pressure_control_value);
|
721
|
+
}
|
722
|
+
|
701
723
|
void BasicMemoryQuota::AddData(channelz::DataSink sink) {
|
702
724
|
sink.AddData(
|
703
725
|
"memory_quota",
|
704
726
|
channelz::PropertyList()
|
705
727
|
.Set("free_bytes", free_bytes_.load(std::memory_order_relaxed))
|
706
728
|
.Set("quota_size", quota_size_.load(std::memory_order_relaxed))
|
729
|
+
.Set("container_memory_pressure", ContainerMemoryPressure())
|
707
730
|
.Merge(pressure_tracker_.ChannelzProperties())
|
708
731
|
.Set("allocators",
|
709
732
|
[this]() {
|
@@ -815,8 +838,6 @@ std::string PressureController::DebugString() const {
|
|
815
838
|
}
|
816
839
|
|
817
840
|
double PressureTracker::AddSampleAndGetControlValue(double sample) {
|
818
|
-
static const double kSetPoint = 0.95;
|
819
|
-
|
820
841
|
double max_so_far = max_this_round_.load(std::memory_order_relaxed);
|
821
842
|
if (sample > max_so_far) {
|
822
843
|
max_this_round_.compare_exchange_weak(max_so_far, sample,
|
@@ -825,7 +846,7 @@ double PressureTracker::AddSampleAndGetControlValue(double sample) {
|
|
825
846
|
}
|
826
847
|
// If memory pressure is almost done, immediately hit the brakes and report
|
827
848
|
// full memory usage.
|
828
|
-
if (sample >=
|
849
|
+
if (sample >= memory_pressure_threshold_) {
|
829
850
|
report_.store(1.0, std::memory_order_relaxed);
|
830
851
|
}
|
831
852
|
update_.Tick([&](Duration) {
|
@@ -833,11 +854,11 @@ double PressureTracker::AddSampleAndGetControlValue(double sample) {
|
|
833
854
|
const double current_estimate =
|
834
855
|
max_this_round_.exchange(sample, std::memory_order_relaxed);
|
835
856
|
double report;
|
836
|
-
if (current_estimate >
|
857
|
+
if (current_estimate > memory_pressure_threshold_) {
|
837
858
|
// Under very high memory pressure we... just max things out.
|
838
859
|
report = controller_.Update(1e99);
|
839
860
|
} else {
|
840
|
-
report = controller_.Update(current_estimate -
|
861
|
+
report = controller_.Update(current_estimate - target_memory_pressure_);
|
841
862
|
}
|
842
863
|
GRPC_TRACE_LOG(resource_quota, INFO)
|
843
864
|
<< "RQ: pressure:" << current_estimate << " report:" << report
|