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
@@ -53,7 +53,6 @@
|
|
53
53
|
#include <optional>
|
54
54
|
#include <string>
|
55
55
|
|
56
|
-
#include "absl/log/check.h"
|
57
56
|
#include "absl/log/log.h"
|
58
57
|
#include "absl/strings/match.h"
|
59
58
|
#include "absl/strings/numbers.h"
|
@@ -71,6 +70,7 @@
|
|
71
70
|
#include "src/core/tsi/transport_security_interface.h"
|
72
71
|
#include "src/core/util/crash.h"
|
73
72
|
#include "src/core/util/env.h"
|
73
|
+
#include "src/core/util/grpc_check.h"
|
74
74
|
#include "src/core/util/match.h"
|
75
75
|
#include "src/core/util/sync.h"
|
76
76
|
#include "src/core/util/useful.h"
|
@@ -324,7 +324,7 @@ static void init_openssl(void) {
|
|
324
324
|
#if OPENSSL_VERSION_NUMBER < 0x10100000
|
325
325
|
if (!CRYPTO_get_locking_callback()) {
|
326
326
|
int num_locks = CRYPTO_num_locks();
|
327
|
-
|
327
|
+
GRPC_CHECK_GT(num_locks, 0);
|
328
328
|
g_openssl_mutexes = static_cast<gpr_mu*>(
|
329
329
|
gpr_malloc(static_cast<size_t>(num_locks) * sizeof(gpr_mu)));
|
330
330
|
for (int i = 0; i < num_locks; i++) {
|
@@ -338,19 +338,19 @@ static void init_openssl(void) {
|
|
338
338
|
#endif
|
339
339
|
g_ssl_ctx_ex_factory_index =
|
340
340
|
SSL_CTX_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
|
341
|
-
|
341
|
+
GRPC_CHECK_NE(g_ssl_ctx_ex_factory_index, -1);
|
342
342
|
|
343
343
|
g_ssl_ctx_ex_crl_provider_index =
|
344
344
|
SSL_CTX_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
|
345
|
-
|
345
|
+
GRPC_CHECK_NE(g_ssl_ctx_ex_crl_provider_index, -1);
|
346
346
|
|
347
347
|
g_ssl_ctx_ex_spiffe_bundle_map_index =
|
348
348
|
SSL_CTX_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
|
349
|
-
|
349
|
+
GRPC_CHECK_NE(g_ssl_ctx_ex_spiffe_bundle_map_index, -1);
|
350
350
|
|
351
351
|
g_ssl_ex_verified_root_cert_index = SSL_get_ex_new_index(
|
352
352
|
0, nullptr, nullptr, nullptr, verified_root_cert_free);
|
353
|
-
|
353
|
+
GRPC_CHECK_NE(g_ssl_ex_verified_root_cert_index, -1);
|
354
354
|
}
|
355
355
|
|
356
356
|
// --- Ssl utils. ---
|
@@ -608,7 +608,7 @@ static tsi_result peer_from_x509(X509* cert, int include_certificate_type,
|
|
608
608
|
: 0;
|
609
609
|
size_t property_count;
|
610
610
|
tsi_result result;
|
611
|
-
|
611
|
+
GRPC_CHECK_GE(subject_alt_name_count, 0);
|
612
612
|
property_count = (include_certificate_type ? size_t{1} : 0) +
|
613
613
|
3 /* subject, common name, certificate */ +
|
614
614
|
static_cast<size_t>(subject_alt_name_count);
|
@@ -663,7 +663,7 @@ static tsi_result peer_from_x509(X509* cert, int include_certificate_type,
|
|
663
663
|
}
|
664
664
|
if (result != TSI_OK) tsi_peer_destruct(peer);
|
665
665
|
|
666
|
-
|
666
|
+
GRPC_CHECK((int)peer->property_count == current_insert_index);
|
667
667
|
return result;
|
668
668
|
}
|
669
669
|
|
@@ -674,7 +674,7 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX* context,
|
|
674
674
|
tsi_result result = TSI_OK;
|
675
675
|
X509* certificate = nullptr;
|
676
676
|
BIO* pem;
|
677
|
-
|
677
|
+
GRPC_CHECK_LE(pem_cert_chain_size, static_cast<size_t>(INT_MAX));
|
678
678
|
pem = BIO_new_mem_buf(pem_cert_chain, static_cast<int>(pem_cert_chain_size));
|
679
679
|
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
|
680
680
|
|
@@ -794,7 +794,7 @@ static tsi_result ssl_ctx_use_pem_private_key(SSL_CTX* context,
|
|
794
794
|
tsi_result result = TSI_OK;
|
795
795
|
EVP_PKEY* private_key = nullptr;
|
796
796
|
BIO* pem;
|
797
|
-
|
797
|
+
GRPC_CHECK_LE(pem_key_size, static_cast<size_t>(INT_MAX));
|
798
798
|
pem = BIO_new_mem_buf(pem_key, static_cast<int>(pem_key_size));
|
799
799
|
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
|
800
800
|
do {
|
@@ -839,7 +839,7 @@ static tsi_result x509_store_load_certs(X509_STORE* cert_store,
|
|
839
839
|
X509* root = nullptr;
|
840
840
|
X509_NAME* root_name = nullptr;
|
841
841
|
BIO* pem;
|
842
|
-
|
842
|
+
GRPC_CHECK_LE(pem_roots_size, static_cast<size_t>(INT_MAX));
|
843
843
|
pem = BIO_new_mem_buf(pem_roots, static_cast<int>(pem_roots_size));
|
844
844
|
if (cert_store == nullptr) return TSI_INVALID_ARGUMENT;
|
845
845
|
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
|
@@ -1240,7 +1240,7 @@ static int CheckChainRevocation(
|
|
1240
1240
|
}
|
1241
1241
|
|
1242
1242
|
static grpc_core::SpiffeBundleMap* GetSpiffeBundleMap(X509_STORE_CTX* ctx) {
|
1243
|
-
|
1243
|
+
GRPC_CHECK(ctx != nullptr);
|
1244
1244
|
ERR_clear_error();
|
1245
1245
|
int ssl_index = SSL_get_ex_data_X509_STORE_CTX_idx();
|
1246
1246
|
if (ssl_index < 0) {
|
@@ -1264,7 +1264,7 @@ static grpc_core::SpiffeBundleMap* GetSpiffeBundleMap(X509_STORE_CTX* ctx) {
|
|
1264
1264
|
}
|
1265
1265
|
|
1266
1266
|
static absl::StatusOr<std::string> GetSpiffeUriFromCert(X509* cert) {
|
1267
|
-
|
1267
|
+
GRPC_CHECK(cert != nullptr);
|
1268
1268
|
GENERAL_NAMES* subject_alt_names = static_cast<GENERAL_NAMES*>(
|
1269
1269
|
X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr));
|
1270
1270
|
int uri_count = 0;
|
@@ -1301,7 +1301,7 @@ static absl::StatusOr<std::string> GetSpiffeUriFromCert(X509* cert) {
|
|
1301
1301
|
}
|
1302
1302
|
|
1303
1303
|
static absl::StatusOr<std::string> SpiffeTrustDomainFromCert(X509* cert) {
|
1304
|
-
|
1304
|
+
GRPC_CHECK(cert != nullptr);
|
1305
1305
|
auto subject_name = GetSpiffeUriFromCert(cert);
|
1306
1306
|
GRPC_RETURN_IF_ERROR(subject_name.status());
|
1307
1307
|
auto spiffe_id = grpc_core::SpiffeId::FromString(*subject_name);
|
@@ -1315,7 +1315,7 @@ static absl::StatusOr<std::string> SpiffeTrustDomainFromCert(X509* cert) {
|
|
1315
1315
|
// https://github.com/grpc/proposal/blob/master/A87-mtls-spiffe-support.md
|
1316
1316
|
absl::Status ConfigureSpiffeRoots(
|
1317
1317
|
X509_STORE_CTX* ctx, grpc_core::SpiffeBundleMap* spiffe_bundle_map) {
|
1318
|
-
|
1318
|
+
GRPC_CHECK(ctx != nullptr);
|
1319
1319
|
if (spiffe_bundle_map == nullptr) {
|
1320
1320
|
return absl::InvalidArgumentError(
|
1321
1321
|
"cannot configure spiffe roots with a nullptr spiffe_bundle_map.");
|
@@ -1338,7 +1338,8 @@ absl::Status ConfigureSpiffeRoots(
|
|
1338
1338
|
return absl::InvalidArgumentError(
|
1339
1339
|
"spiffe: root stack in the SPIFFE Bundle Map is nullptr.");
|
1340
1340
|
}
|
1341
|
-
|
1341
|
+
// the boringSSL library objective-C used did not have this function defined
|
1342
|
+
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(OPENSSL_APPLE)
|
1342
1343
|
X509_STORE_CTX_set0_trusted_stack(ctx, *root_stack);
|
1343
1344
|
#else
|
1344
1345
|
X509_STORE_CTX_trusted_stack(ctx, *root_stack);
|
@@ -1353,7 +1354,7 @@ absl::Status ConfigureSpiffeRoots(
|
|
1353
1354
|
// returns 1 on success, indicating a trusted chain to a root of trust was
|
1354
1355
|
// found, 0 if a trusted chain could not be built.
|
1355
1356
|
static int CustomVerificationFunction(X509_STORE_CTX* ctx, void* arg) {
|
1356
|
-
|
1357
|
+
GRPC_CHECK(ctx != nullptr);
|
1357
1358
|
grpc_core::SpiffeBundleMap* spiffe_bundle_map = GetSpiffeBundleMap(ctx);
|
1358
1359
|
if (spiffe_bundle_map != nullptr) {
|
1359
1360
|
// If a SPIFFE Bundle Map is configured, we'll use
|
@@ -1597,7 +1598,7 @@ static tsi_ssl_handshaker_factory_vtable handshaker_factory_vtable = {nullptr};
|
|
1597
1598
|
// allocating memory for the factory.
|
1598
1599
|
static void tsi_ssl_handshaker_factory_init(
|
1599
1600
|
tsi_ssl_handshaker_factory* factory) {
|
1600
|
-
|
1601
|
+
GRPC_CHECK_NE(factory, nullptr);
|
1601
1602
|
|
1602
1603
|
factory->vtable = &handshaker_factory_vtable;
|
1603
1604
|
gpr_ref_init(&factory->refcount, 1);
|
@@ -1824,7 +1825,7 @@ static tsi_result ssl_handshaker_get_bytes_to_send_to_peer(
|
|
1824
1825
|
if (error != nullptr) *error = "invalid argument";
|
1825
1826
|
return TSI_INVALID_ARGUMENT;
|
1826
1827
|
}
|
1827
|
-
|
1828
|
+
GRPC_CHECK_LE(*bytes_size, static_cast<size_t>(INT_MAX));
|
1828
1829
|
bytes_read_from_ssl =
|
1829
1830
|
BIO_read(impl->network_io, bytes, static_cast<int>(*bytes_size));
|
1830
1831
|
if (bytes_read_from_ssl < 0) {
|
@@ -1902,7 +1903,7 @@ static tsi_result ssl_handshaker_process_bytes_from_peer(
|
|
1902
1903
|
if (error != nullptr) *error = "invalid argument";
|
1903
1904
|
return TSI_INVALID_ARGUMENT;
|
1904
1905
|
}
|
1905
|
-
|
1906
|
+
GRPC_CHECK_LE(*bytes_size, static_cast<size_t>(INT_MAX));
|
1906
1907
|
bytes_written_into_ssl_size =
|
1907
1908
|
BIO_write(impl->network_io, bytes, static_cast<int>(*bytes_size));
|
1908
1909
|
if (bytes_written_into_ssl_size < 0) {
|
@@ -2401,7 +2402,7 @@ static int server_handshaker_factory_npn_advertised_callback(
|
|
2401
2402
|
tsi_ssl_server_handshaker_factory* factory =
|
2402
2403
|
static_cast<tsi_ssl_server_handshaker_factory*>(arg);
|
2403
2404
|
*out = factory->alpn_protocol_list;
|
2404
|
-
|
2405
|
+
GRPC_CHECK(factory->alpn_protocol_list_length <= UINT_MAX);
|
2405
2406
|
*outlen = static_cast<unsigned int>(factory->alpn_protocol_list_length);
|
2406
2407
|
return SSL_TLSEXT_ERR_OK;
|
2407
2408
|
}
|
@@ -2436,7 +2437,7 @@ static int server_handshaker_factory_new_session_callback(
|
|
2436
2437
|
template <typename T>
|
2437
2438
|
static void ssl_keylogging_callback(const SSL* ssl, const char* info) {
|
2438
2439
|
SSL_CTX* ssl_context = SSL_get_SSL_CTX(ssl);
|
2439
|
-
|
2440
|
+
GRPC_CHECK_NE(ssl_context, nullptr);
|
2440
2441
|
void* arg = SSL_CTX_get_ex_data(ssl_context, g_ssl_ctx_ex_factory_index);
|
2441
2442
|
T* factory = static_cast<T*>(arg);
|
2442
2443
|
factory->key_logger->LogSessionKeys(ssl_context, info);
|
@@ -2587,7 +2588,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options(
|
|
2587
2588
|
break;
|
2588
2589
|
}
|
2589
2590
|
#if TSI_OPENSSL_ALPN_SUPPORT
|
2590
|
-
|
2591
|
+
GRPC_CHECK(impl->alpn_protocol_list_length < UINT_MAX);
|
2591
2592
|
if (SSL_CTX_set_alpn_protos(
|
2592
2593
|
ssl_context, impl->alpn_protocol_list,
|
2593
2594
|
static_cast<unsigned int>(impl->alpn_protocol_list_length))) {
|
@@ -2944,8 +2945,8 @@ bool IsRootCertInfoEmpty(const RootCertInfo* root_cert_info) {
|
|
2944
2945
|
const tsi_ssl_handshaker_factory_vtable* tsi_ssl_handshaker_factory_swap_vtable(
|
2945
2946
|
tsi_ssl_handshaker_factory* factory,
|
2946
2947
|
tsi_ssl_handshaker_factory_vtable* new_vtable) {
|
2947
|
-
|
2948
|
-
|
2948
|
+
GRPC_CHECK_NE(factory, nullptr);
|
2949
|
+
GRPC_CHECK_NE(factory->vtable, nullptr);
|
2949
2950
|
|
2950
2951
|
const tsi_ssl_handshaker_factory_vtable* orig_vtable = factory->vtable;
|
2951
2952
|
factory->vtable = new_vtable;
|
@@ -30,11 +30,11 @@
|
|
30
30
|
#include <openssl/x509.h>
|
31
31
|
#include <openssl/x509v3.h>
|
32
32
|
|
33
|
-
#include "absl/log/check.h"
|
34
33
|
#include "absl/log/log.h"
|
35
34
|
#include "absl/status/status.h"
|
36
35
|
#include "absl/status/statusor.h"
|
37
36
|
#include "src/core/tsi/transport_security_interface.h"
|
37
|
+
#include "src/core/util/grpc_check.h"
|
38
38
|
|
39
39
|
namespace grpc_core {
|
40
40
|
|
@@ -74,7 +74,7 @@ void LogSslErrorStack(void) {
|
|
74
74
|
|
75
75
|
tsi_result DoSslWrite(SSL* ssl, unsigned char* unprotected_bytes,
|
76
76
|
size_t unprotected_bytes_size) {
|
77
|
-
|
77
|
+
GRPC_CHECK_LE(unprotected_bytes_size, static_cast<size_t>(INT_MAX));
|
78
78
|
ERR_clear_error();
|
79
79
|
int ssl_write_result = SSL_write(ssl, unprotected_bytes,
|
80
80
|
static_cast<int>(unprotected_bytes_size));
|
@@ -95,7 +95,7 @@ tsi_result DoSslWrite(SSL* ssl, unsigned char* unprotected_bytes,
|
|
95
95
|
|
96
96
|
tsi_result DoSslRead(SSL* ssl, unsigned char* unprotected_bytes,
|
97
97
|
size_t* unprotected_bytes_size) {
|
98
|
-
|
98
|
+
GRPC_CHECK_LE(*unprotected_bytes_size, static_cast<size_t>(INT_MAX));
|
99
99
|
ERR_clear_error();
|
100
100
|
int read_from_ssl = SSL_read(ssl, unprotected_bytes,
|
101
101
|
static_cast<int>(*unprotected_bytes_size));
|
@@ -139,7 +139,7 @@ tsi_result SslProtectorProtect(const unsigned char* unprotected_bytes,
|
|
139
139
|
int pending_in_ssl = static_cast<int>(BIO_pending(network_io));
|
140
140
|
if (pending_in_ssl > 0) {
|
141
141
|
*unprotected_bytes_size = 0;
|
142
|
-
|
142
|
+
GRPC_CHECK_LE(*protected_output_frames_size, static_cast<size_t>(INT_MAX));
|
143
143
|
read_from_ssl = BIO_read(network_io, protected_output_frames,
|
144
144
|
static_cast<int>(*protected_output_frames_size));
|
145
145
|
if (read_from_ssl < 0) {
|
@@ -165,7 +165,7 @@ tsi_result SslProtectorProtect(const unsigned char* unprotected_bytes,
|
|
165
165
|
result = DoSslWrite(ssl, buffer, buffer_size);
|
166
166
|
if (result != TSI_OK) return result;
|
167
167
|
|
168
|
-
|
168
|
+
GRPC_CHECK_LE(*protected_output_frames_size, static_cast<size_t>(INT_MAX));
|
169
169
|
read_from_ssl = BIO_read(network_io, protected_output_frames,
|
170
170
|
static_cast<int>(*protected_output_frames_size));
|
171
171
|
if (read_from_ssl < 0) {
|
@@ -195,11 +195,11 @@ tsi_result SslProtectorProtectFlush(size_t& buffer_offset,
|
|
195
195
|
}
|
196
196
|
|
197
197
|
pending = static_cast<int>(BIO_pending(network_io));
|
198
|
-
|
198
|
+
GRPC_CHECK_GE(pending, 0);
|
199
199
|
*still_pending_size = static_cast<size_t>(pending);
|
200
200
|
if (*still_pending_size == 0) return TSI_OK;
|
201
201
|
|
202
|
-
|
202
|
+
GRPC_CHECK_LE(*protected_output_frames_size, static_cast<size_t>(INT_MAX));
|
203
203
|
read_from_ssl = BIO_read(network_io, protected_output_frames,
|
204
204
|
static_cast<int>(*protected_output_frames_size));
|
205
205
|
if (read_from_ssl <= 0) {
|
@@ -208,7 +208,7 @@ tsi_result SslProtectorProtectFlush(size_t& buffer_offset,
|
|
208
208
|
}
|
209
209
|
*protected_output_frames_size = static_cast<size_t>(read_from_ssl);
|
210
210
|
pending = static_cast<int>(BIO_pending(network_io));
|
211
|
-
|
211
|
+
GRPC_CHECK_GE(pending, 0);
|
212
212
|
*still_pending_size = static_cast<size_t>(pending);
|
213
213
|
return TSI_OK;
|
214
214
|
}
|
@@ -236,7 +236,7 @@ tsi_result SslProtectorUnprotect(const unsigned char* protected_frames_bytes,
|
|
236
236
|
*unprotected_bytes_size = output_bytes_size - output_bytes_offset;
|
237
237
|
|
238
238
|
// Then, try to write some data to ssl.
|
239
|
-
|
239
|
+
GRPC_CHECK_LE(*protected_frames_bytes_size, static_cast<size_t>(INT_MAX));
|
240
240
|
written_into_ssl = BIO_write(network_io, protected_frames_bytes,
|
241
241
|
static_cast<int>(*protected_frames_bytes_size));
|
242
242
|
if (written_into_ssl < 0) {
|
@@ -21,8 +21,8 @@
|
|
21
21
|
#include <iterator>
|
22
22
|
#include <utility>
|
23
23
|
|
24
|
-
#include "absl/log/check.h"
|
25
24
|
#include "src/core/lib/resource_quota/arena.h"
|
25
|
+
#include "src/core/util/grpc_check.h"
|
26
26
|
#include "src/core/util/manual_constructor.h"
|
27
27
|
|
28
28
|
namespace grpc_core {
|
@@ -86,9 +86,9 @@ class ChunkedVector {
|
|
86
86
|
|
87
87
|
// Remove the last element and return it.
|
88
88
|
T PopBack() {
|
89
|
-
|
89
|
+
GRPC_CHECK_NE(append_, nullptr);
|
90
90
|
if (append_->count == 0) {
|
91
|
-
|
91
|
+
GRPC_CHECK(first_ != append_);
|
92
92
|
Chunk* chunk = first_;
|
93
93
|
while (chunk->next != append_) {
|
94
94
|
chunk = chunk->next;
|
@@ -234,7 +234,7 @@ class ChunkedVector {
|
|
234
234
|
private:
|
235
235
|
ManualConstructor<T>* AppendSlot() {
|
236
236
|
if (append_ == nullptr) {
|
237
|
-
|
237
|
+
GRPC_CHECK_EQ(first_, nullptr);
|
238
238
|
first_ = arena_->New<Chunk>();
|
239
239
|
append_ = first_;
|
240
240
|
} else if (append_->count == kChunkSize) {
|
data/src/core/util/event_log.cc
CHANGED
@@ -19,16 +19,16 @@
|
|
19
19
|
#include <algorithm>
|
20
20
|
#include <atomic>
|
21
21
|
|
22
|
-
#include "absl/log/check.h"
|
23
22
|
#include "absl/strings/str_cat.h"
|
24
23
|
#include "absl/strings/str_join.h"
|
24
|
+
#include "src/core/util/grpc_check.h"
|
25
25
|
|
26
26
|
namespace grpc_core {
|
27
27
|
|
28
28
|
std::atomic<EventLog*> EventLog::g_instance_{nullptr};
|
29
29
|
|
30
30
|
EventLog::~EventLog() {
|
31
|
-
|
31
|
+
GRPC_CHECK_NE(g_instance_.load(std::memory_order_acquire), this);
|
32
32
|
}
|
33
33
|
|
34
34
|
void EventLog::BeginCollection() {
|
@@ -27,7 +27,6 @@
|
|
27
27
|
#include <memory>
|
28
28
|
#include <utility>
|
29
29
|
|
30
|
-
#include "absl/log/check.h"
|
31
30
|
#include "absl/log/log.h"
|
32
31
|
#include "absl/status/status.h"
|
33
32
|
#include "absl/status/statusor.h"
|
@@ -35,6 +34,7 @@
|
|
35
34
|
#include "absl/strings/string_view.h"
|
36
35
|
#include "src/core/credentials/transport/transport_credentials.h"
|
37
36
|
#include "src/core/lib/debug/trace.h"
|
37
|
+
#include "src/core/util/grpc_check.h"
|
38
38
|
#include "src/core/util/ref_counted_ptr.h"
|
39
39
|
#include "src/core/util/status_helper.h"
|
40
40
|
#include "src/core/util/time.h"
|
@@ -71,7 +71,7 @@ GcpMetadataQuery::GcpMetadataQuery(
|
|
71
71
|
auto uri =
|
72
72
|
URI::Create("http", /*user_info=*/"", std::move(metadata_server_name),
|
73
73
|
attribute_, {} /* query params */, "" /* fragment */);
|
74
|
-
|
74
|
+
GRPC_CHECK(uri.ok()); // params are hardcoded
|
75
75
|
grpc_http_request request;
|
76
76
|
memset(&request, 0, sizeof(grpc_http_request));
|
77
77
|
grpc_http_header header = {const_cast<char*>("Metadata-Flavor"),
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// Copyright 2025 The gRPC Authors
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#ifdef GRPC_POSTMORTEM_CHECKS
|
16
|
+
#include "src/core/util/postmortem_emit.h"
|
17
|
+
|
18
|
+
bool PostMortemEmitAndReturnTrue() {
|
19
|
+
grpc_core::PostMortemEmit();
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
#endif
|
@@ -0,0 +1,103 @@
|
|
1
|
+
// Copyright 2025 The gRPC Authors
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#ifndef GRPC_SRC_CORE_UTIL_GRPC_CHECK_H
|
16
|
+
#define GRPC_SRC_CORE_UTIL_GRPC_CHECK_H
|
17
|
+
|
18
|
+
#ifdef GRPC_POSTMORTEM_CHECKS
|
19
|
+
#include <limits.h>
|
20
|
+
|
21
|
+
#include "absl/log/log.h"
|
22
|
+
#include "src/core/util/postmortem_emit.h"
|
23
|
+
|
24
|
+
bool PostMortemEmitAndReturnTrue();
|
25
|
+
|
26
|
+
#define GRPC_CHECK(a) \
|
27
|
+
while (!(a) && PostMortemEmitAndReturnTrue()) \
|
28
|
+
LOG(FATAL) << "Failed GRPC_CHECK(" #a "). "
|
29
|
+
|
30
|
+
#define GRPC_CHECK_EQ(a, b) \
|
31
|
+
while (!((a) == (b)) && PostMortemEmitAndReturnTrue()) \
|
32
|
+
LOG(FATAL) << "Failed GRPC_CHECK_EQ(" #a ", " #b "). "
|
33
|
+
|
34
|
+
#define GRPC_CHECK_NE(a, b) \
|
35
|
+
while ((a) == (b) && PostMortemEmitAndReturnTrue()) \
|
36
|
+
LOG(FATAL) << "Failed GRPC_CHECK_NE(" #a ", " #b "). "
|
37
|
+
|
38
|
+
#define GRPC_CHECK_GT(a, b) \
|
39
|
+
while ((a) <= (b) && PostMortemEmitAndReturnTrue()) \
|
40
|
+
LOG(FATAL) << "Failed GRPC_CHECK_GT(" #a ", " #b "). "
|
41
|
+
|
42
|
+
#define GRPC_CHECK_LT(a, b) \
|
43
|
+
while ((a) >= (b) && PostMortemEmitAndReturnTrue()) \
|
44
|
+
LOG(FATAL) << "Failed GRPC_CHECK_LT(" #a ", " #b "). "
|
45
|
+
|
46
|
+
#define GRPC_CHECK_GE(a, b) \
|
47
|
+
while ((a) < (b) && PostMortemEmitAndReturnTrue()) \
|
48
|
+
LOG(FATAL) << "Failed GRPC_CHECK_GE(" #a ", " #b "). "
|
49
|
+
|
50
|
+
#define GRPC_CHECK_LE(a, b) \
|
51
|
+
while ((a) > (b) && PostMortemEmitAndReturnTrue()) \
|
52
|
+
LOG(FATAL) << "Failed GRPC_CHECK_LE(" #a " vs " #b ")."
|
53
|
+
|
54
|
+
#define GRPC_CHECK_OK(a) \
|
55
|
+
while (!(a).ok() && PostMortemEmitAndReturnTrue()) \
|
56
|
+
LOG(FATAL) << "Failed GRPC_CHECK_OK(" #a "). "
|
57
|
+
|
58
|
+
#ifndef NDEBUG
|
59
|
+
#define GRPC_DCHECK(a) GRPC_CHECK(a)
|
60
|
+
#define GRPC_DCHECK_EQ(a, b) GRPC_CHECK_EQ(a, b)
|
61
|
+
#define GRPC_DCHECK_GE(a, b) GRPC_CHECK_GE(a, b)
|
62
|
+
#define GRPC_DCHECK_LE(a, b) GRPC_CHECK_LE(a, b)
|
63
|
+
#define GRPC_DCHECK_GT(a, b) GRPC_CHECK_GT(a, b)
|
64
|
+
#define GRPC_DCHECK_LT(a, b) GRPC_CHECK_LT(a, b)
|
65
|
+
#define GRPC_DCHECK_NE(a, b) GRPC_CHECK_NE(a, b)
|
66
|
+
#else // NDEBUG
|
67
|
+
#define GRPC_DCHECK(a) \
|
68
|
+
while (false) LOG(INFO)
|
69
|
+
#define GRPC_DCHECK_EQ(a, b) \
|
70
|
+
while (false) LOG(INFO)
|
71
|
+
#define GRPC_DCHECK_GE(a, b) \
|
72
|
+
while (false) LOG(INFO)
|
73
|
+
#define GRPC_DCHECK_LE(a, b) \
|
74
|
+
while (false) LOG(INFO)
|
75
|
+
#define GRPC_DCHECK_GT(a, b) \
|
76
|
+
while (false) LOG(INFO)
|
77
|
+
#define GRPC_DCHECK_LT(a, b) \
|
78
|
+
while (false) LOG(INFO)
|
79
|
+
#define GRPC_DCHECK_NE(a, b) \
|
80
|
+
while (false) LOG(INFO)
|
81
|
+
#endif
|
82
|
+
|
83
|
+
#else // GRPC_POSTMORTEM_CHECKS
|
84
|
+
#include "absl/log/check.h"
|
85
|
+
|
86
|
+
#define GRPC_CHECK(a) CHECK(a)
|
87
|
+
#define GRPC_CHECK_EQ(a, b) CHECK_EQ(a, b)
|
88
|
+
#define GRPC_CHECK_NE(a, b) CHECK_NE(a, b)
|
89
|
+
#define GRPC_CHECK_GT(a, b) CHECK_GT(a, b)
|
90
|
+
#define GRPC_CHECK_LT(a, b) CHECK_LT(a, b)
|
91
|
+
#define GRPC_CHECK_GE(a, b) CHECK_GE(a, b)
|
92
|
+
#define GRPC_CHECK_LE(a, b) CHECK_LE(a, b)
|
93
|
+
#define GRPC_CHECK_OK(a) CHECK_OK(a)
|
94
|
+
#define GRPC_DCHECK(a) DCHECK(a)
|
95
|
+
#define GRPC_DCHECK_EQ(a, b) DCHECK_EQ(a, b)
|
96
|
+
#define GRPC_DCHECK_GE(a, b) DCHECK_GE(a, b)
|
97
|
+
#define GRPC_DCHECK_LE(a, b) DCHECK_LE(a, b)
|
98
|
+
#define GRPC_DCHECK_GT(a, b) DCHECK_GT(a, b)
|
99
|
+
#define GRPC_DCHECK_LT(a, b) DCHECK_LT(a, b)
|
100
|
+
#define GRPC_DCHECK_NE(a, b) DCHECK_NE(a, b)
|
101
|
+
#endif // GRPC_POSTMORTEM_CHECKS
|
102
|
+
|
103
|
+
#endif // GRPC_SRC_CORE_UTIL_GRPC_CHECK_H
|
@@ -28,7 +28,6 @@
|
|
28
28
|
#include <utility>
|
29
29
|
|
30
30
|
#include "absl/functional/bind_front.h"
|
31
|
-
#include "absl/log/check.h"
|
32
31
|
#include "absl/status/status.h"
|
33
32
|
#include "absl/strings/str_format.h"
|
34
33
|
#include "src/core/config/core_configuration.h"
|
@@ -49,6 +48,7 @@
|
|
49
48
|
#include "src/core/lib/resource_quota/api.h"
|
50
49
|
#include "src/core/lib/slice/slice.h"
|
51
50
|
#include "src/core/lib/transport/error_utils.h"
|
51
|
+
#include "src/core/util/grpc_check.h"
|
52
52
|
#include "src/core/util/http_client/format_request.h"
|
53
53
|
#include "src/core/util/http_client/parser.h"
|
54
54
|
#include "src/core/util/status_helper.h"
|
@@ -201,7 +201,7 @@ HttpRequest::HttpRequest(
|
|
201
201
|
ContinueDoneWriteAfterScheduleOnExecCtx, this,
|
202
202
|
grpc_schedule_on_exec_ctx);
|
203
203
|
if (!grpc_event_engine::experimental::UsePollsetAlternative()) {
|
204
|
-
|
204
|
+
GRPC_CHECK(pollent);
|
205
205
|
grpc_polling_entity_add_to_pollset_set(pollent, pollset_set_);
|
206
206
|
}
|
207
207
|
}
|
@@ -259,7 +259,7 @@ void HttpRequest::Start() {
|
|
259
259
|
void HttpRequest::Orphan() {
|
260
260
|
{
|
261
261
|
MutexLock lock(&mu_);
|
262
|
-
|
262
|
+
GRPC_CHECK(!cancelled_);
|
263
263
|
cancelled_ = true;
|
264
264
|
// cancel potentially pending DNS resolution.
|
265
265
|
if (use_event_engine_dns_resolver_) {
|
@@ -24,9 +24,9 @@
|
|
24
24
|
|
25
25
|
#include <algorithm>
|
26
26
|
|
27
|
-
#include "absl/log/check.h"
|
28
27
|
#include "absl/log/log.h"
|
29
28
|
#include "absl/status/status.h"
|
29
|
+
#include "src/core/util/grpc_check.h"
|
30
30
|
|
31
31
|
static char* buf2str(void* buffer, size_t length) {
|
32
32
|
char* out = static_cast<char*>(gpr_malloc(length + 1));
|
@@ -175,7 +175,7 @@ static grpc_error_handle add_header(grpc_http_parser* parser) {
|
|
175
175
|
grpc_http_header hdr = {nullptr, nullptr};
|
176
176
|
grpc_error_handle error;
|
177
177
|
|
178
|
-
|
178
|
+
GRPC_CHECK(cur != end);
|
179
179
|
|
180
180
|
if (*cur == ' ' || *cur == '\t') {
|
181
181
|
error = GRPC_ERROR_CREATE("Continued header lines not supported yet");
|
@@ -189,14 +189,14 @@ static grpc_error_handle add_header(grpc_http_parser* parser) {
|
|
189
189
|
error = GRPC_ERROR_CREATE("Didn't find ':' in header string");
|
190
190
|
goto done;
|
191
191
|
}
|
192
|
-
|
192
|
+
GRPC_CHECK(cur >= beg);
|
193
193
|
hdr.key = buf2str(beg, static_cast<size_t>(cur - beg));
|
194
194
|
cur++; // skip :
|
195
195
|
|
196
196
|
while (cur != end && (*cur == ' ' || *cur == '\t')) {
|
197
197
|
cur++;
|
198
198
|
}
|
199
|
-
|
199
|
+
GRPC_CHECK((size_t)(end - cur) >= parser->cur_line_end_length);
|
200
200
|
size = static_cast<size_t>(end - cur) - parser->cur_line_end_length;
|
201
201
|
if ((size != 0) && (cur[size - 1] == '\r')) {
|
202
202
|
size--;
|
data/src/core/util/latent_see.h
CHANGED
@@ -229,11 +229,11 @@ class Flow {
|
|
229
229
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Flow() : id_(0) {}
|
230
230
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit Flow(const Metadata* metadata) {
|
231
231
|
Appender appender;
|
232
|
+
metadata_ = metadata;
|
232
233
|
if (GPR_LIKELY(!appender.Enabled())) {
|
233
234
|
id_ = 0;
|
234
235
|
return;
|
235
236
|
}
|
236
|
-
metadata_ = metadata;
|
237
237
|
AppendBegin(appender);
|
238
238
|
}
|
239
239
|
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~Flow() {
|
@@ -248,11 +248,11 @@ class Flow {
|
|
248
248
|
Flow(Flow&& other) noexcept
|
249
249
|
: metadata_(other.metadata_), id_(std::exchange(other.id_, 0)) {}
|
250
250
|
Flow& operator=(Flow&& other) noexcept {
|
251
|
+
metadata_ = other.metadata_;
|
251
252
|
if (id_ != 0) {
|
252
253
|
Appender appender;
|
253
254
|
if (GPR_LIKELY(!appender.Enabled())) AppendEnd(appender);
|
254
255
|
}
|
255
|
-
metadata_ = other.metadata_;
|
256
256
|
id_ = std::exchange(other.id_, 0);
|
257
257
|
return *this;
|
258
258
|
}
|
@@ -273,7 +273,10 @@ class Flow {
|
|
273
273
|
metadata_ = metadata;
|
274
274
|
AppendBegin(appender);
|
275
275
|
}
|
276
|
-
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION void Begin() {
|
276
|
+
GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION void Begin() {
|
277
|
+
DCHECK(metadata_ != nullptr);
|
278
|
+
Begin(metadata_);
|
279
|
+
}
|
277
280
|
|
278
281
|
private:
|
279
282
|
void AppendBegin(Appender& appender) {
|
@@ -285,7 +288,7 @@ class Flow {
|
|
285
288
|
appender.Append(metadata_, -id_, -absl::GetCurrentTimeNanos());
|
286
289
|
id_ = 0;
|
287
290
|
}
|
288
|
-
const Metadata* metadata_;
|
291
|
+
const Metadata* metadata_ = nullptr;
|
289
292
|
static inline std::atomic<int64_t> next_id_{1};
|
290
293
|
int64_t id_;
|
291
294
|
};
|
data/src/core/util/lru_cache.h
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
#include "absl/container/flat_hash_map.h"
|
26
26
|
#include "absl/functional/any_invocable.h"
|
27
|
-
#include "
|
27
|
+
#include "src/core/util/grpc_check.h"
|
28
28
|
|
29
29
|
namespace grpc_core {
|
30
30
|
|
@@ -35,7 +35,7 @@ template <typename Key, typename Value>
|
|
35
35
|
class LruCache {
|
36
36
|
public:
|
37
37
|
explicit LruCache(size_t max_size) : max_size_(max_size) {
|
38
|
-
|
38
|
+
GRPC_CHECK_GT(max_size, 0UL);
|
39
39
|
}
|
40
40
|
|
41
41
|
// Returns the value for key, or nullopt if not present.
|
@@ -110,9 +110,9 @@ void LruCache<Key, Value>::SetMaxSize(size_t max_size) {
|
|
110
110
|
template <typename Key, typename Value>
|
111
111
|
void LruCache<Key, Value>::RemoveOldestEntry() {
|
112
112
|
auto lru_it = lru_list_.begin();
|
113
|
-
|
113
|
+
GRPC_CHECK(lru_it != lru_list_.end());
|
114
114
|
auto cache_it = cache_.find(*lru_it);
|
115
|
-
|
115
|
+
GRPC_CHECK(cache_it != cache_.end());
|
116
116
|
cache_.erase(cache_it);
|
117
117
|
lru_list_.pop_front();
|
118
118
|
}
|