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
@@ -22,14 +22,23 @@
|
|
22
22
|
#include <vector>
|
23
23
|
|
24
24
|
#include "absl/container/flat_hash_set.h"
|
25
|
+
#include "absl/status/status.h"
|
26
|
+
#include "google/protobuf/any.upb.h"
|
27
|
+
#include "google/protobuf/any.upbdefs.h"
|
28
|
+
#include "google/protobuf/timestamp.upb.h"
|
25
29
|
#include "src/core/channelz/channelz.h"
|
30
|
+
#include "src/core/channelz/text_encode.h"
|
26
31
|
#include "src/core/lib/debug/trace.h"
|
32
|
+
#include "src/core/util/function_signature.h"
|
27
33
|
#include "src/core/util/json/json_writer.h"
|
28
34
|
#include "src/core/util/memory_usage.h"
|
29
35
|
#include "src/core/util/single_set_ptr.h"
|
30
36
|
#include "src/core/util/string.h"
|
31
37
|
#include "src/core/util/sync.h"
|
32
38
|
#include "src/core/util/time.h"
|
39
|
+
#include "src/proto/grpc/channelz/v2/channelz.upb.h"
|
40
|
+
#include "src/proto/grpc/channelz/v2/service.upb.h"
|
41
|
+
#include "upb/mem/arena.hpp"
|
33
42
|
|
34
43
|
#ifdef GRPC_NO_ZTRACE
|
35
44
|
namespace grpc_core::channelz {
|
@@ -38,14 +47,10 @@ class ZTraceImpl final : public ZTrace {
|
|
38
47
|
public:
|
39
48
|
explicit ZTraceImpl() {}
|
40
49
|
|
41
|
-
void Run(
|
50
|
+
void Run(Args args,
|
42
51
|
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
43
52
|
event_engine,
|
44
|
-
|
45
|
-
event_engine->Run([callback = std::move(callback)]() mutable {
|
46
|
-
callback(Json::FromBool(false));
|
47
|
-
});
|
48
|
-
}
|
53
|
+
Callback callback) override {}
|
49
54
|
};
|
50
55
|
|
51
56
|
class StubImpl {
|
@@ -70,14 +75,33 @@ template <typename T>
|
|
70
75
|
using Collection = std::deque<std::pair<gpr_cycle_counter, T> >;
|
71
76
|
|
72
77
|
template <typename T>
|
73
|
-
void AppendResults(const Collection<T>& data,
|
78
|
+
void AppendResults(const Collection<T>& data,
|
79
|
+
grpc_channelz_v2_QueryTraceResponse* response,
|
80
|
+
upb_Arena* arena) {
|
81
|
+
size_t original_size;
|
82
|
+
grpc_channelz_v2_QueryTraceResponse_events(response, &original_size);
|
83
|
+
grpc_channelz_v2_TraceEvent** events =
|
84
|
+
grpc_channelz_v2_QueryTraceResponse_resize_events(
|
85
|
+
response, original_size + data.size(), arena);
|
86
|
+
size_t event_index = original_size;
|
74
87
|
for (const auto& value : data) {
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
88
|
+
grpc_channelz_v2_TraceEvent* event = grpc_channelz_v2_TraceEvent_new(arena);
|
89
|
+
events[event_index] = event;
|
90
|
+
google_protobuf_Timestamp* timestamp =
|
91
|
+
grpc_channelz_v2_TraceEvent_mutable_timestamp(event, arena);
|
92
|
+
const gpr_timespec gpr_ts = gpr_convert_clock_type(
|
93
|
+
gpr_cycle_counter_to_time(value.first), GPR_CLOCK_REALTIME);
|
94
|
+
google_protobuf_Timestamp_set_seconds(timestamp, gpr_ts.tv_sec);
|
95
|
+
google_protobuf_Timestamp_set_nanos(timestamp, gpr_ts.tv_nsec);
|
96
|
+
grpc_channelz_v2_Data** data =
|
97
|
+
grpc_channelz_v2_TraceEvent_resize_data(event, 1, arena);
|
98
|
+
grpc_channelz_v2_Data* data_value = grpc_channelz_v2_Data_new(arena);
|
99
|
+
data[0] = data_value;
|
100
|
+
grpc_channelz_v2_Data_set_name(data_value,
|
101
|
+
StdStringToUpbString(TypeName<T>()));
|
102
|
+
value.second.ChannelzProperties().FillAny(
|
103
|
+
grpc_channelz_v2_Data_mutable_value(data_value, arena), arena);
|
104
|
+
++event_index;
|
81
105
|
}
|
82
106
|
}
|
83
107
|
|
@@ -93,13 +117,15 @@ constexpr bool kIsElement<Needle, H, Haystack...> =
|
|
93
117
|
|
94
118
|
} // namespace ztrace_collector_detail
|
95
119
|
|
96
|
-
inline std::optional<int64_t> IntFromArgs(
|
97
|
-
|
120
|
+
inline std::optional<int64_t> IntFromArgs(const ZTrace::Args& args,
|
121
|
+
const std::string& name) {
|
98
122
|
auto it = args.find(name);
|
99
123
|
if (it == args.end()) return std::nullopt;
|
100
|
-
int64_t
|
101
|
-
|
102
|
-
|
124
|
+
if (const int64_t* value = std::get_if<int64_t>(&it->second);
|
125
|
+
value != nullptr) {
|
126
|
+
return *value;
|
127
|
+
}
|
128
|
+
return std::nullopt;
|
103
129
|
}
|
104
130
|
|
105
131
|
// Generic collector infrastructure for ztrace queries.
|
@@ -125,16 +151,28 @@ inline std::optional<int64_t> IntFromArgs(
|
|
125
151
|
template <typename Config, typename... Data>
|
126
152
|
class ZTraceCollector {
|
127
153
|
public:
|
154
|
+
// Append a value to any traces that are currently active.
|
155
|
+
// If no trace is active, this is a no-op.
|
156
|
+
// One can pass in the value to be appended, and that value will be used
|
157
|
+
// directly.
|
158
|
+
// Or one can pass in a producer - a lambda that will return the value to be
|
159
|
+
// appended. This will only be called if the value is needed - so that we can
|
160
|
+
// elide construction costs if the value is not traced.
|
161
|
+
// Prefer the latter if there is an allocation for example, but if you're
|
162
|
+
// tracing one int that's already on the stack then no need to inject more
|
163
|
+
// complexity.
|
128
164
|
template <typename X>
|
129
165
|
void Append(X producer_or_value) {
|
130
166
|
GRPC_TRACE_LOG(ztrace, INFO) << "ZTRACE[" << this << "]: " << [&]() {
|
131
|
-
|
167
|
+
upb::Arena arena;
|
168
|
+
google_protobuf_Any* any = google_protobuf_Any_new(arena.ptr());
|
132
169
|
if constexpr (ztrace_collector_detail::kIsElement<X, Data...>) {
|
133
|
-
producer_or_value.
|
170
|
+
producer_or_value.ChannelzProperties().FillAny(any, arena.ptr());
|
134
171
|
} else {
|
135
|
-
producer_or_value().
|
172
|
+
producer_or_value().ChannelzProperties().FillAny(any, arena.ptr());
|
136
173
|
}
|
137
|
-
return
|
174
|
+
return TextEncode(reinterpret_cast<upb_Message*>(any),
|
175
|
+
google_protobuf_Any_getmsgdef);
|
138
176
|
}();
|
139
177
|
if (!impl_.is_set()) return;
|
140
178
|
if constexpr (ztrace_collector_detail::kIsElement<X, Data...>) {
|
@@ -144,6 +182,19 @@ class ZTraceCollector {
|
|
144
182
|
}
|
145
183
|
}
|
146
184
|
|
185
|
+
// Try to avoid using this method!
|
186
|
+
// Returns true if (instantaneously) there are any tracers active.
|
187
|
+
// It's about as expensive as Append() so there's no point guarding Append()
|
188
|
+
// with this. However, if you'd need to do a large amount of work perhaps
|
189
|
+
// asynchronously before doing an Append, this can be useful to control that
|
190
|
+
// work.
|
191
|
+
bool IsActive() {
|
192
|
+
if (!impl_.is_set()) return false;
|
193
|
+
auto impl = impl_.Get();
|
194
|
+
MutexLock lock(&impl->mu);
|
195
|
+
return !impl->instances.empty();
|
196
|
+
}
|
197
|
+
|
147
198
|
std::unique_ptr<ZTrace> MakeZTrace() {
|
148
199
|
return std::make_unique<ZTraceImpl>(impl_.GetOrCreate());
|
149
200
|
}
|
@@ -152,42 +203,148 @@ class ZTraceCollector {
|
|
152
203
|
template <typename T>
|
153
204
|
using Collection = ztrace_collector_detail::Collection<T>;
|
154
205
|
|
155
|
-
|
156
|
-
|
206
|
+
class Instance : public RefCounted<Instance> {
|
207
|
+
public:
|
208
|
+
Instance(ZTrace::Args args,
|
157
209
|
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
158
|
-
event_engine
|
159
|
-
absl::AnyInvocable<void(Json)> done)
|
210
|
+
event_engine)
|
160
211
|
: memory_cap_(IntFromArgs(args, "memory_cap").value_or(1024 * 1024)),
|
161
|
-
|
162
|
-
|
163
|
-
done(std::move(done)) {}
|
212
|
+
config_(std::move(args)),
|
213
|
+
event_engine_(std::move(event_engine)) {}
|
164
214
|
using Collections = std::tuple<Collection<Data>...>;
|
215
|
+
template <typename T>
|
216
|
+
void Append(std::pair<gpr_cycle_counter, T> value) {
|
217
|
+
switch (state_) {
|
218
|
+
case State::kIdle:
|
219
|
+
case State::kReady:
|
220
|
+
state_ = State::kReady;
|
221
|
+
break;
|
222
|
+
case State::kReadyDone:
|
223
|
+
case State::kDone:
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
if (state_ == State::kDone) return;
|
227
|
+
++items_matched_;
|
228
|
+
memory_used_ += MemoryUsageOf(value.second);
|
229
|
+
while (memory_used_ > memory_cap_) {
|
230
|
+
auto memory_used_before = memory_used_;
|
231
|
+
RemoveMostRecent();
|
232
|
+
CHECK_LT(memory_used_, memory_used_before);
|
233
|
+
}
|
234
|
+
std::get<Collection<T> >(data_).push_back(std::move(value));
|
235
|
+
if (callback_ != nullptr) QueueCallback();
|
236
|
+
}
|
237
|
+
|
238
|
+
template <typename T>
|
239
|
+
bool Finishes(const T& value) {
|
240
|
+
return config_.Finishes(value);
|
241
|
+
}
|
242
|
+
|
243
|
+
void Finish(absl::Status status) {
|
244
|
+
switch (state_) {
|
245
|
+
case State::kIdle:
|
246
|
+
state_ = State::kDone;
|
247
|
+
break;
|
248
|
+
case State::kReady:
|
249
|
+
state_ = State::kReadyDone;
|
250
|
+
break;
|
251
|
+
case State::kReadyDone:
|
252
|
+
case State::kDone:
|
253
|
+
return;
|
254
|
+
}
|
255
|
+
GRPC_TRACE_LOG(ztrace, INFO) << "ZTRACE[" << this << "]: Finish";
|
256
|
+
status_ = std::move(status);
|
257
|
+
if (callback_ != nullptr) QueueCallback();
|
258
|
+
}
|
259
|
+
|
260
|
+
void Next(ZTrace::Callback callback) {
|
261
|
+
callback_ = std::move(callback);
|
262
|
+
if (state_ != State::kIdle) QueueCallback();
|
263
|
+
}
|
264
|
+
|
265
|
+
Timestamp start_time() const { return start_time_; }
|
266
|
+
|
267
|
+
private:
|
268
|
+
enum class State {
|
269
|
+
kIdle,
|
270
|
+
kReady,
|
271
|
+
kReadyDone,
|
272
|
+
kDone,
|
273
|
+
};
|
274
|
+
|
165
275
|
struct RemoveMostRecentState {
|
166
276
|
void (*enact)(Instance*) = nullptr;
|
167
277
|
gpr_cycle_counter most_recent =
|
168
278
|
std::numeric_limits<gpr_cycle_counter>::max();
|
169
279
|
};
|
170
|
-
|
171
|
-
void
|
172
|
-
|
173
|
-
|
174
|
-
|
280
|
+
|
281
|
+
void QueueCallback() {
|
282
|
+
switch (state_) {
|
283
|
+
case State::kIdle:
|
284
|
+
LOG(FATAL) << "BUG: kIdle";
|
285
|
+
break;
|
286
|
+
case State::kReady:
|
287
|
+
QueueCallbackReady();
|
288
|
+
state_ = State::kIdle;
|
289
|
+
break;
|
290
|
+
case State::kReadyDone:
|
291
|
+
QueueCallbackReady();
|
292
|
+
state_ = State::kDone;
|
293
|
+
break;
|
294
|
+
case State::kDone:
|
295
|
+
QueueCallbackDone();
|
296
|
+
break;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
void QueueCallbackReady() {
|
301
|
+
Collections data = std::move(data_);
|
302
|
+
size_t items_matched = std::exchange(items_matched_, 0);
|
303
|
+
memory_used_ = 0;
|
304
|
+
event_engine_->Run(
|
305
|
+
[data = std::move(data), items_matched,
|
306
|
+
callback = std::exchange(callback_, nullptr)]() mutable {
|
307
|
+
upb::Arena arena;
|
308
|
+
grpc_channelz_v2_QueryTraceResponse* response =
|
309
|
+
grpc_channelz_v2_QueryTraceResponse_new(arena.ptr());
|
310
|
+
grpc_channelz_v2_QueryTraceResponse_set_num_events_matched(
|
311
|
+
response, items_matched);
|
312
|
+
(ztrace_collector_detail::AppendResults(
|
313
|
+
std::get<Collection<Data> >(data), response, arena.ptr()),
|
314
|
+
...);
|
315
|
+
size_t len = 0;
|
316
|
+
char* serialized = grpc_channelz_v2_QueryTraceResponse_serialize(
|
317
|
+
response, arena.ptr(), &len);
|
318
|
+
callback(std::string(serialized, len));
|
319
|
+
});
|
175
320
|
}
|
321
|
+
|
322
|
+
void QueueCallbackDone() {
|
323
|
+
event_engine_->Run(
|
324
|
+
[callback = std::exchange(callback_, nullptr),
|
325
|
+
status = std::exchange(status_, absl::Status())]() mutable {
|
326
|
+
if (status.ok()) {
|
327
|
+
callback(std::nullopt);
|
328
|
+
} else {
|
329
|
+
callback(status);
|
330
|
+
}
|
331
|
+
});
|
332
|
+
}
|
333
|
+
|
176
334
|
void RemoveMostRecent() {
|
177
335
|
RemoveMostRecentState state;
|
178
336
|
(UpdateRemoveMostRecentState<Data>(&state), ...);
|
179
337
|
CHECK(state.enact != nullptr);
|
180
338
|
state.enact(this);
|
181
|
-
++items_removed_;
|
182
339
|
}
|
183
340
|
template <typename T>
|
184
341
|
void UpdateRemoveMostRecentState(RemoveMostRecentState* state) {
|
185
|
-
auto& collection = std::get<Collection<T> >(
|
342
|
+
auto& collection = std::get<Collection<T> >(data_);
|
186
343
|
if (collection.empty()) return;
|
187
344
|
if (state->enact == nullptr ||
|
188
345
|
collection.front().first < state->most_recent) {
|
189
346
|
state->enact = +[](Instance* instance) {
|
190
|
-
auto& collection = std::get<Collection<T> >(instance->
|
347
|
+
auto& collection = std::get<Collection<T> >(instance->data_);
|
191
348
|
const size_t ent_usage = MemoryUsageOf(collection.front().second);
|
192
349
|
CHECK_GE(instance->memory_used_, ent_usage);
|
193
350
|
instance->memory_used_ -= ent_usage;
|
@@ -196,33 +353,18 @@ class ZTraceCollector {
|
|
196
353
|
state->most_recent = collection.front().first;
|
197
354
|
}
|
198
355
|
}
|
199
|
-
|
200
|
-
|
201
|
-
status = std::move(status), memory_used = memory_used_,
|
202
|
-
items_removed = items_removed_]() mutable {
|
203
|
-
Json::Array entries;
|
204
|
-
(ztrace_collector_detail::AppendResults(
|
205
|
-
std::get<Collection<Data> >(data), entries),
|
206
|
-
...);
|
207
|
-
Json::Object result;
|
208
|
-
result["entries"] = Json::FromArray(entries);
|
209
|
-
result["status"] = Json::FromString(status.ToString());
|
210
|
-
result["memory_used"] =
|
211
|
-
Json::FromNumber(static_cast<uint64_t>(memory_used));
|
212
|
-
result["items_removed"] = Json::FromNumber(items_removed);
|
213
|
-
done(Json::FromObject(std::move(result)));
|
214
|
-
});
|
215
|
-
}
|
356
|
+
|
357
|
+
const Timestamp start_time_ = Timestamp::Now();
|
216
358
|
size_t memory_used_ = 0;
|
217
359
|
size_t memory_cap_ = 0;
|
218
|
-
uint64_t
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
360
|
+
uint64_t items_matched_ = 0;
|
361
|
+
State state_ = State::kIdle;
|
362
|
+
Config config_;
|
363
|
+
Collections data_;
|
364
|
+
absl::Status status_;
|
365
|
+
ZTrace::Callback callback_;
|
366
|
+
const std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
367
|
+
event_engine_;
|
226
368
|
};
|
227
369
|
struct Impl : public RefCounted<Impl> {
|
228
370
|
Mutex mu;
|
@@ -232,43 +374,62 @@ class ZTraceCollector {
|
|
232
374
|
public:
|
233
375
|
explicit ZTraceImpl(RefCountedPtr<Impl> impl) : impl_(std::move(impl)) {}
|
234
376
|
|
235
|
-
|
377
|
+
~ZTraceImpl() override {
|
378
|
+
if (instance_ != nullptr) {
|
379
|
+
MutexLock lock(&impl_->mu);
|
380
|
+
instance_->Finish(absl::CancelledError());
|
381
|
+
}
|
382
|
+
}
|
383
|
+
|
384
|
+
void Run(ZTrace::Args args,
|
236
385
|
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
237
386
|
event_engine,
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
auto impl = std::move(impl_);
|
387
|
+
ZTrace::Callback callback) override {
|
388
|
+
CHECK(instance_ == nullptr);
|
389
|
+
instance_ = MakeRefCounted<Instance>(std::move(args), event_engine);
|
242
390
|
RefCountedPtr<Instance> oldest_instance;
|
243
|
-
MutexLock lock(&
|
244
|
-
if (
|
391
|
+
MutexLock lock(&impl_->mu);
|
392
|
+
if (impl_->instances.size() > 20) {
|
245
393
|
// Eject oldest running trace
|
246
394
|
Timestamp oldest_time = Timestamp::InfFuture();
|
247
|
-
for (auto& instance :
|
248
|
-
if (instance->start_time < oldest_time) {
|
249
|
-
oldest_time = instance->start_time;
|
395
|
+
for (auto& instance : impl_->instances) {
|
396
|
+
if (instance->start_time() < oldest_time) {
|
397
|
+
oldest_time = instance->start_time();
|
250
398
|
oldest_instance = instance;
|
251
399
|
}
|
252
400
|
}
|
253
401
|
CHECK(oldest_instance != nullptr);
|
254
|
-
|
402
|
+
impl_->instances.erase(oldest_instance);
|
255
403
|
oldest_instance->Finish(
|
256
404
|
absl::ResourceExhaustedError("Too many concurrent ztrace queries"));
|
257
405
|
}
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
{
|
262
|
-
MutexLock lock(&impl->mu);
|
263
|
-
finish = impl->instances.erase(instance);
|
264
|
-
}
|
265
|
-
if (finish) instance->Finish(absl::DeadlineExceededError(""));
|
266
|
-
});
|
267
|
-
impl->instances.insert(instance);
|
406
|
+
impl_->instances.insert(instance_);
|
407
|
+
NextCallback(std::make_shared<Callback>(std::move(callback)), impl_,
|
408
|
+
instance_);
|
268
409
|
}
|
269
410
|
|
270
411
|
private:
|
271
|
-
|
412
|
+
static void NextCallback(std::shared_ptr<ZTrace::Callback> callback,
|
413
|
+
RefCountedPtr<Impl> impl,
|
414
|
+
RefCountedPtr<Instance> instance) {
|
415
|
+
instance->Next([callback = std::move(callback), impl = std::move(impl),
|
416
|
+
instance = std::move(instance)](
|
417
|
+
absl::StatusOr<std::optional<std::string> > response) {
|
418
|
+
const bool end =
|
419
|
+
(response.ok() && !response->has_value()) || !response.ok();
|
420
|
+
(*callback)(std::move(response));
|
421
|
+
MutexLock lock(&impl->mu);
|
422
|
+
if (end) {
|
423
|
+
impl->instances.erase(instance);
|
424
|
+
} else {
|
425
|
+
NextCallback(std::move(callback), std::move(impl),
|
426
|
+
std::move(instance));
|
427
|
+
}
|
428
|
+
});
|
429
|
+
}
|
430
|
+
|
431
|
+
const RefCountedPtr<Impl> impl_;
|
432
|
+
RefCountedPtr<Instance> instance_;
|
272
433
|
};
|
273
434
|
|
274
435
|
template <typename T>
|
@@ -283,7 +444,7 @@ class ZTraceCollector {
|
|
283
444
|
case 1: {
|
284
445
|
auto& instances = impl->instances;
|
285
446
|
auto& instance = *instances.begin();
|
286
|
-
const bool finishes = instance->
|
447
|
+
const bool finishes = instance->Finishes(value.second);
|
287
448
|
instance->Append(std::move(value));
|
288
449
|
if (finishes) {
|
289
450
|
instance->Finish(absl::OkStatus());
|
@@ -293,7 +454,7 @@ class ZTraceCollector {
|
|
293
454
|
default: {
|
294
455
|
std::vector<RefCountedPtr<Instance> > finished;
|
295
456
|
for (auto& instance : impl->instances) {
|
296
|
-
const bool finishes = instance->
|
457
|
+
const bool finishes = instance->Finishes(value.second);
|
297
458
|
instance->Append(value);
|
298
459
|
if (finishes) {
|
299
460
|
finished.push_back(instance);
|
@@ -62,14 +62,13 @@ static grpc_core::Duration g_poll_interval =
|
|
62
62
|
static bool g_backup_polling_disabled;
|
63
63
|
|
64
64
|
void grpc_client_channel_global_init_backup_polling() {
|
65
|
-
#ifndef GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER
|
66
|
-
// Disable backup polling if EventEngine is used everywhere.
|
67
65
|
g_backup_polling_disabled = grpc_core::IsEventEngineClientEnabled() &&
|
68
66
|
grpc_core::IsEventEngineListenerEnabled() &&
|
69
67
|
grpc_core::IsEventEngineDnsEnabled();
|
70
|
-
#
|
71
|
-
|
72
|
-
|
68
|
+
#ifdef GRPC_PYTHON_BUILD
|
69
|
+
if (!grpc_core::IsEventEnginePollerForPythonEnabled()) {
|
70
|
+
g_backup_polling_disabled = false;
|
71
|
+
}
|
73
72
|
#endif
|
74
73
|
if (g_backup_polling_disabled) {
|
75
74
|
return;
|
@@ -161,7 +160,7 @@ static void g_poller_init_locked() {
|
|
161
160
|
}
|
162
161
|
|
163
162
|
static bool g_can_poll_in_background() {
|
164
|
-
#ifndef
|
163
|
+
#ifndef GRPC_PYTHON_BUILD
|
165
164
|
return grpc_iomgr_run_in_background();
|
166
165
|
#else
|
167
166
|
// No iomgr "event_engines" (not to be confused with the new EventEngine)
|
@@ -220,7 +220,7 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
|
|
220
220
|
WatcherWrapper(
|
221
221
|
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
|
222
222
|
watcher,
|
223
|
-
|
223
|
+
WeakRefCountedPtr<SubchannelWrapper> subchannel_wrapper)
|
224
224
|
: watcher_(std::move(watcher)),
|
225
225
|
subchannel_wrapper_(std::move(subchannel_wrapper)) {}
|
226
226
|
|
@@ -233,9 +233,7 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
|
|
233
233
|
GRPC_TRACE_LOG(client_channel, INFO)
|
234
234
|
<< "client_channel=" << subchannel_wrapper_->client_channel_.get()
|
235
235
|
<< ": connectivity change for subchannel wrapper "
|
236
|
-
<< subchannel_wrapper_.get() << "
|
237
|
-
<< subchannel_wrapper_->subchannel_.get()
|
238
|
-
<< "; hopping into work_serializer";
|
236
|
+
<< subchannel_wrapper_.get() << "; hopping into work_serializer";
|
239
237
|
auto self = RefAsSubclass<WatcherWrapper>();
|
240
238
|
subchannel_wrapper_->client_channel_->work_serializer_->Run(
|
241
239
|
[self, state, status]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(
|
@@ -298,7 +296,7 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
|
|
298
296
|
|
299
297
|
std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
|
300
298
|
watcher_;
|
301
|
-
|
299
|
+
WeakRefCountedPtr<SubchannelWrapper> subchannel_wrapper_;
|
302
300
|
};
|
303
301
|
|
304
302
|
ClientChannel::SubchannelWrapper::SubchannelWrapper(
|
@@ -363,6 +361,20 @@ void ClientChannel::SubchannelWrapper::Orphaned() {
|
|
363
361
|
}
|
364
362
|
}
|
365
363
|
}
|
364
|
+
if (IsSubchannelWrapperCleanupOnOrphanEnabled()) {
|
365
|
+
// We need to make sure that the internal subchannel gets unreffed
|
366
|
+
// inside of the WorkSerializer, so that updates to the local
|
367
|
+
// subchannel pool are properly synchronized. To that end, we
|
368
|
+
// drop our ref to the internal subchannel here. We also cancel
|
369
|
+
// any watchers that were not properly cancelled, in case any of
|
370
|
+
// them are holding a ref to the internal subchannel.
|
371
|
+
for (const auto& [_, watcher] : self->watcher_map_) {
|
372
|
+
self->subchannel_->CancelConnectivityStateWatch(watcher);
|
373
|
+
}
|
374
|
+
self->watcher_map_.clear();
|
375
|
+
self->data_watchers_.clear();
|
376
|
+
self->subchannel_.reset();
|
377
|
+
}
|
366
378
|
});
|
367
379
|
}
|
368
380
|
|
@@ -372,7 +384,7 @@ void ClientChannel::SubchannelWrapper::WatchConnectivityState(
|
|
372
384
|
CHECK(watcher_wrapper == nullptr);
|
373
385
|
watcher_wrapper = new WatcherWrapper(
|
374
386
|
std::move(watcher),
|
375
|
-
|
387
|
+
WeakRefAsSubclass<SubchannelWrapper>(DEBUG_LOCATION, "WatcherWrapper"));
|
376
388
|
subchannel_->WatchConnectivityState(
|
377
389
|
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
|
378
390
|
watcher_wrapper));
|
@@ -516,11 +528,7 @@ RefCountedPtr<SubchannelPoolInterface> GetSubchannelPool(
|
|
516
528
|
if (args.GetBool(GRPC_ARG_USE_LOCAL_SUBCHANNEL_POOL).value_or(false)) {
|
517
529
|
return MakeRefCounted<LocalSubchannelPool>();
|
518
530
|
}
|
519
|
-
|
520
|
-
return GlobalSubchannelPool::instance();
|
521
|
-
} else {
|
522
|
-
return LegacyGlobalSubchannelPool::instance();
|
523
|
-
}
|
531
|
+
return GlobalSubchannelPool::instance();
|
524
532
|
}
|
525
533
|
|
526
534
|
} // namespace
|
@@ -896,8 +904,7 @@ void ClientChannel::StartCall(UnstartedCallHandler unstarted_handler) {
|
|
896
904
|
if (!status.ok()) return status;
|
897
905
|
// If the call was queued, add trace annotation.
|
898
906
|
if (was_queued) {
|
899
|
-
auto* call_tracer =
|
900
|
-
MaybeGetContext<CallTracerAnnotationInterface>();
|
907
|
+
auto* call_tracer = MaybeGetContext<CallSpan>();
|
901
908
|
if (call_tracer != nullptr) {
|
902
909
|
call_tracer->RecordAnnotation(
|
903
910
|
"Delayed name resolution complete.");
|