grpc 1.50.0.pre1 → 1.51.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +131 -42
- data/include/grpc/event_engine/event_engine.h +10 -3
- data/include/grpc/event_engine/slice_buffer.h +17 -0
- data/include/grpc/grpc.h +0 -10
- data/include/grpc/impl/codegen/grpc_types.h +1 -5
- data/include/grpc/impl/codegen/port_platform.h +0 -3
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +19 -13
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +1 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -3
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +7 -5
- data/src/core/ext/filters/client_channel/client_channel.cc +120 -140
- data/src/core/ext/filters/client_channel/client_channel.h +3 -4
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +0 -2
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel_service_config.cc +153 -0
- data/src/core/ext/filters/client_channel/{resolver_result_parsing.h → client_channel_service_config.h} +26 -23
- data/src/core/ext/filters/client_channel/connector.h +1 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +20 -47
- data/src/core/ext/filters/client_channel/dynamic_filters.h +7 -8
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +3 -4
- data/src/core/ext/filters/client_channel/http_proxy.cc +0 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +35 -44
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +1 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +3 -4
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +41 -29
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +9 -11
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +15 -12
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +8 -10
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +26 -27
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +7 -9
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +44 -26
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +17 -27
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/{xds.h → xds_attributes.h} +15 -17
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +13 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +48 -47
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +40 -126
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +364 -0
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +9 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +23 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +1 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +22 -23
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +50 -52
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +2 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -3
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +34 -26
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +3 -4
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +4 -7
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +63 -46
- data/src/core/ext/filters/client_channel/retry_filter.cc +80 -102
- data/src/core/ext/filters/client_channel/retry_service_config.cc +192 -234
- data/src/core/ext/filters/client_channel/retry_service_config.h +20 -23
- data/src/core/ext/filters/client_channel/retry_throttle.cc +8 -8
- data/src/core/ext/filters/client_channel/retry_throttle.h +8 -7
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +2 -2
- data/src/core/ext/filters/client_channel/subchannel.cc +21 -25
- data/src/core/ext/filters/client_channel/subchannel.h +2 -2
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +11 -12
- data/src/core/ext/filters/deadline/deadline_filter.cc +13 -14
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +0 -4
- data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +118 -0
- data/src/core/ext/filters/fault_injection/{service_config_parser.h → fault_injection_service_config_parser.h} +20 -12
- data/src/core/ext/filters/http/client/http_client_filter.cc +16 -16
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +13 -13
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +34 -34
- data/src/core/ext/filters/http/server/http_server_filter.cc +26 -25
- data/src/core/ext/filters/message_size/message_size_filter.cc +86 -117
- data/src/core/ext/filters/message_size/message_size_filter.h +22 -15
- data/src/core/ext/filters/rbac/rbac_filter.cc +12 -12
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +728 -530
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +4 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +1 -1
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +17 -21
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +57 -72
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +212 -253
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +42 -11
- data/src/core/ext/transport/chttp2/transport/flow_control.h +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +16 -15
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +13 -13
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +15 -17
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +31 -39
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +24 -8
- data/src/core/ext/transport/chttp2/transport/parsing.cc +51 -52
- data/src/core/ext/transport/chttp2/transport/varint.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/varint.h +11 -8
- data/src/core/ext/transport/chttp2/transport/writing.cc +16 -16
- data/src/core/ext/transport/inproc/inproc_transport.cc +97 -115
- data/src/core/ext/xds/certificate_provider_store.cc +4 -4
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +4 -7
- data/src/core/ext/xds/xds_api.cc +15 -68
- data/src/core/ext/xds/xds_api.h +3 -7
- data/src/core/ext/xds/xds_bootstrap.h +0 -1
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +3 -12
- data/src/core/ext/xds/xds_bootstrap_grpc.h +16 -1
- data/src/core/ext/xds/xds_certificate_provider.cc +22 -25
- data/src/core/ext/xds/xds_channel_stack_modifier.cc +0 -1
- data/src/core/ext/xds/xds_client.cc +122 -90
- data/src/core/ext/xds/xds_client.h +7 -2
- data/src/core/ext/xds/xds_client_grpc.cc +5 -24
- data/src/core/ext/xds/xds_cluster.cc +291 -183
- data/src/core/ext/xds/xds_cluster.h +11 -15
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +32 -29
- data/src/core/ext/xds/xds_cluster_specifier_plugin.h +35 -16
- data/src/core/ext/xds/xds_common_types.cc +208 -141
- data/src/core/ext/xds/xds_common_types.h +19 -13
- data/src/core/ext/xds/xds_endpoint.cc +214 -129
- data/src/core/ext/xds/xds_endpoint.h +4 -7
- data/src/core/ext/xds/xds_http_fault_filter.cc +56 -43
- data/src/core/ext/xds/xds_http_fault_filter.h +13 -21
- data/src/core/ext/xds/xds_http_filters.cc +60 -73
- data/src/core/ext/xds/xds_http_filters.h +67 -19
- data/src/core/ext/xds/xds_http_rbac_filter.cc +152 -207
- data/src/core/ext/xds/xds_http_rbac_filter.h +12 -15
- data/src/core/ext/xds/xds_lb_policy_registry.cc +122 -169
- data/src/core/ext/xds/xds_lb_policy_registry.h +10 -11
- data/src/core/ext/xds/xds_listener.cc +459 -417
- data/src/core/ext/xds/xds_listener.h +43 -47
- data/src/core/ext/xds/xds_resource_type.h +3 -11
- data/src/core/ext/xds/xds_resource_type_impl.h +8 -13
- data/src/core/ext/xds/xds_route_config.cc +94 -80
- data/src/core/ext/xds/xds_route_config.h +10 -10
- data/src/core/ext/xds/xds_routing.cc +2 -1
- data/src/core/ext/xds/xds_routing.h +2 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +109 -94
- data/src/core/ext/xds/xds_transport_grpc.cc +4 -5
- data/src/core/lib/address_utils/parse_address.cc +11 -10
- data/src/core/lib/channel/channel_args.h +16 -1
- data/src/core/lib/channel/channel_stack.cc +23 -20
- data/src/core/lib/channel/channel_stack.h +17 -4
- data/src/core/lib/channel/channel_stack_builder.cc +4 -7
- data/src/core/lib/channel/channel_stack_builder.h +14 -6
- data/src/core/lib/channel/channel_stack_builder_impl.cc +25 -7
- data/src/core/lib/channel/channel_stack_builder_impl.h +2 -0
- data/src/core/lib/channel/channel_trace.cc +4 -5
- data/src/core/lib/channel/channelz.cc +1 -1
- data/src/core/lib/channel/connected_channel.cc +695 -35
- data/src/core/lib/channel/connected_channel.h +0 -4
- data/src/core/lib/channel/promise_based_filter.cc +1004 -140
- data/src/core/lib/channel/promise_based_filter.h +364 -87
- data/src/core/lib/compression/message_compress.cc +5 -5
- data/src/core/lib/debug/event_log.cc +88 -0
- data/src/core/lib/debug/event_log.h +81 -0
- data/src/core/lib/debug/histogram_view.cc +69 -0
- data/src/core/lib/{slice/slice_refcount.cc → debug/histogram_view.h} +15 -13
- data/src/core/lib/debug/stats.cc +22 -119
- data/src/core/lib/debug/stats.h +29 -35
- data/src/core/lib/debug/stats_data.cc +224 -73
- data/src/core/lib/debug/stats_data.h +263 -122
- data/src/core/lib/event_engine/common_closures.h +71 -0
- data/src/core/lib/event_engine/default_event_engine.cc +38 -15
- data/src/core/lib/event_engine/default_event_engine.h +15 -3
- data/src/core/lib/event_engine/default_event_engine_factory.cc +2 -4
- data/src/core/lib/event_engine/memory_allocator.cc +1 -1
- data/src/core/lib/event_engine/poller.h +10 -4
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +618 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +129 -0
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +901 -0
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +97 -0
- data/src/core/lib/event_engine/posix_engine/event_poller.h +111 -0
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +74 -0
- data/src/core/lib/event_engine/{executor/threaded_executor.cc → posix_engine/event_poller_posix_default.h} +13 -16
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +77 -0
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +179 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +267 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +73 -0
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +1270 -0
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +682 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +453 -18
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +148 -24
- data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +80 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1081 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +361 -0
- data/src/core/lib/event_engine/posix_engine/timer.h +9 -8
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +57 -194
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +21 -49
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +301 -0
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +179 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +126 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +45 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +151 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +45 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +76 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +67 -0
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +37 -0
- data/src/core/lib/event_engine/slice.cc +7 -6
- data/src/core/lib/event_engine/slice_buffer.cc +2 -2
- data/src/core/lib/event_engine/thread_pool.cc +106 -25
- data/src/core/lib/event_engine/thread_pool.h +32 -9
- data/src/core/lib/event_engine/windows/win_socket.cc +7 -7
- data/src/core/lib/event_engine/windows/windows_engine.cc +18 -12
- data/src/core/lib/event_engine/windows/windows_engine.h +8 -4
- data/src/core/lib/experiments/config.cc +1 -1
- data/src/core/lib/experiments/experiments.cc +13 -2
- data/src/core/lib/experiments/experiments.h +8 -1
- data/src/core/lib/gpr/cpu_linux.cc +6 -2
- data/src/core/lib/gpr/log_linux.cc +3 -4
- data/src/core/lib/gpr/string.h +1 -1
- data/src/core/lib/gpr/tmpfile_posix.cc +3 -2
- data/src/core/lib/gprpp/load_file.cc +75 -0
- data/src/core/lib/gprpp/load_file.h +33 -0
- data/src/core/lib/gprpp/per_cpu.h +46 -0
- data/src/core/lib/gprpp/stat_posix.cc +5 -4
- data/src/core/lib/gprpp/stat_windows.cc +3 -2
- data/src/core/lib/gprpp/status_helper.h +1 -3
- data/src/core/lib/gprpp/strerror.cc +41 -0
- data/src/core/{ext/xds/xds_resource_type.cc → lib/gprpp/strerror.h} +9 -13
- data/src/core/lib/gprpp/thd_windows.cc +1 -2
- data/src/core/lib/gprpp/time.cc +3 -4
- data/src/core/lib/gprpp/time.h +13 -2
- data/src/core/lib/gprpp/validation_errors.h +18 -1
- data/src/core/lib/http/httpcli.cc +40 -44
- data/src/core/lib/http/httpcli.h +6 -5
- data/src/core/lib/http/httpcli_security_connector.cc +4 -6
- data/src/core/lib/http/parser.cc +54 -65
- data/src/core/lib/iomgr/buffer_list.cc +105 -116
- data/src/core/lib/iomgr/buffer_list.h +60 -44
- data/src/core/lib/iomgr/call_combiner.cc +11 -10
- data/src/core/lib/iomgr/call_combiner.h +3 -4
- data/src/core/lib/iomgr/cfstream_handle.cc +13 -16
- data/src/core/lib/iomgr/closure.h +49 -5
- data/src/core/lib/iomgr/combiner.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/endpoint_cfstream.cc +26 -25
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +27 -42
- data/src/core/lib/iomgr/error.h +22 -152
- data/src/core/lib/iomgr/ev_apple.cc +4 -4
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +26 -25
- data/src/core/lib/iomgr/ev_poll_posix.cc +27 -31
- data/src/core/lib/iomgr/exec_ctx.cc +3 -4
- data/src/core/lib/iomgr/exec_ctx.h +2 -3
- data/src/core/lib/iomgr/executor.cc +1 -2
- data/src/core/lib/iomgr/internal_errqueue.cc +3 -1
- data/src/core/lib/iomgr/iocp_windows.cc +1 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +2 -1
- data/src/core/lib/iomgr/load_file.cc +5 -9
- data/src/core/lib/iomgr/lockfree_event.cc +10 -10
- data/src/core/lib/iomgr/pollset_windows.cc +4 -4
- data/src/core/lib/iomgr/python_util.h +2 -2
- data/src/core/lib/iomgr/resolve_address.cc +8 -3
- data/src/core/lib/iomgr/resolve_address.h +3 -4
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +14 -25
- data/src/core/lib/iomgr/resolve_address_posix.h +1 -2
- data/src/core/lib/iomgr/resolve_address_windows.cc +14 -17
- data/src/core/lib/iomgr/resolve_address_windows.h +1 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +30 -29
- data/src/core/lib/iomgr/socket_utils_posix.cc +1 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
- data/src/core/lib/iomgr/socket_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -10
- data/src/core/lib/iomgr/tcp_client_posix.cc +31 -35
- data/src/core/lib/iomgr/tcp_client_windows.cc +8 -12
- data/src/core/lib/iomgr/tcp_posix.cc +92 -108
- data/src/core/lib/iomgr/tcp_server_posix.cc +34 -34
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +18 -21
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +12 -13
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +26 -29
- data/src/core/lib/iomgr/tcp_windows.cc +27 -34
- data/src/core/lib/iomgr/timer.h +8 -8
- data/src/core/lib/iomgr/timer_generic.cc +9 -15
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +4 -3
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +10 -8
- data/src/core/lib/json/json_channel_args.h +42 -0
- data/src/core/lib/json/json_object_loader.cc +7 -2
- data/src/core/lib/json/json_object_loader.h +22 -0
- data/src/core/lib/json/json_util.cc +5 -5
- data/src/core/lib/json/json_util.h +4 -4
- data/src/core/lib/load_balancing/lb_policy.cc +1 -1
- data/src/core/lib/load_balancing/lb_policy.h +4 -0
- data/src/core/lib/load_balancing/subchannel_interface.h +0 -7
- data/src/core/lib/matchers/matchers.cc +3 -4
- data/src/core/lib/promise/activity.cc +16 -2
- data/src/core/lib/promise/activity.h +38 -15
- data/src/core/lib/promise/arena_promise.h +80 -51
- data/src/core/lib/promise/context.h +13 -6
- data/src/core/lib/promise/detail/basic_seq.h +9 -28
- data/src/core/lib/promise/detail/promise_factory.h +58 -10
- data/src/core/lib/promise/detail/status.h +28 -0
- data/src/core/lib/promise/detail/switch.h +1455 -0
- data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +3 -1
- data/src/core/lib/promise/for_each.h +129 -0
- data/src/core/lib/promise/loop.h +7 -5
- data/src/core/lib/promise/map_pipe.h +87 -0
- data/src/core/lib/promise/pipe.cc +19 -0
- data/src/core/lib/promise/pipe.h +505 -0
- data/src/core/lib/promise/poll.h +13 -0
- data/src/core/lib/promise/seq.h +3 -5
- data/src/core/lib/promise/sleep.cc +5 -4
- data/src/core/lib/promise/sleep.h +1 -2
- data/src/core/lib/promise/try_concurrently.h +341 -0
- data/src/core/lib/promise/try_seq.h +10 -13
- data/src/core/lib/resolver/server_address.cc +1 -0
- data/src/core/lib/resolver/server_address.h +1 -3
- data/src/core/lib/resource_quota/api.cc +0 -1
- data/src/core/lib/resource_quota/arena.cc +19 -0
- data/src/core/lib/resource_quota/arena.h +89 -0
- data/src/core/lib/resource_quota/memory_quota.cc +1 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +1 -3
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +4 -2
- data/src/core/lib/security/authorization/matchers.cc +25 -22
- data/src/core/lib/security/authorization/rbac_policy.cc +2 -3
- data/src/core/lib/security/context/security_context.h +10 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +3 -4
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +77 -55
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +4 -3
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -51
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +17 -21
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +21 -25
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +27 -24
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +5 -5
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +24 -30
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -5
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +19 -27
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +4 -11
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +29 -41
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +1 -1
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +6 -11
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +8 -15
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +2 -2
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +2 -6
- data/src/core/lib/security/security_connector/load_system_roots_supported.cc +1 -4
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +7 -11
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +9 -14
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -7
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +21 -27
- data/src/core/lib/security/transport/client_auth_filter.cc +1 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +26 -28
- data/src/core/lib/security/transport/security_handshaker.cc +53 -53
- data/src/core/lib/security/transport/server_auth_filter.cc +21 -21
- data/src/core/lib/security/transport/tsi_error.cc +6 -3
- data/src/core/lib/security/util/json_util.cc +4 -5
- data/src/core/lib/service_config/service_config.h +1 -1
- data/src/core/lib/service_config/service_config_impl.cc +111 -158
- data/src/core/lib/service_config/service_config_impl.h +14 -17
- data/src/core/lib/service_config/service_config_parser.cc +14 -31
- data/src/core/lib/service_config/service_config_parser.h +14 -10
- data/src/core/lib/slice/b64.cc +2 -2
- data/src/core/lib/slice/slice.cc +7 -1
- data/src/core/lib/slice/slice.h +19 -6
- data/src/core/lib/slice/slice_buffer.cc +13 -14
- data/src/core/lib/slice/slice_internal.h +13 -21
- data/src/core/lib/slice/slice_refcount.h +34 -19
- data/src/core/lib/surface/byte_buffer.cc +3 -4
- data/src/core/lib/surface/byte_buffer_reader.cc +4 -4
- data/src/core/lib/surface/call.cc +1366 -239
- data/src/core/lib/surface/call.h +44 -0
- data/src/core/lib/surface/call_details.cc +3 -3
- data/src/core/lib/surface/call_trace.cc +113 -0
- data/src/core/lib/surface/call_trace.h +30 -0
- data/src/core/lib/surface/channel.cc +44 -49
- data/src/core/lib/surface/channel.h +9 -1
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/channel_stack_type.cc +4 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.cc +38 -52
- data/src/core/lib/surface/init.cc +8 -39
- data/src/core/lib/surface/init_internally.h +8 -0
- data/src/core/lib/surface/lame_client.cc +10 -8
- data/src/core/lib/surface/server.cc +48 -70
- data/src/core/lib/surface/server.h +3 -4
- data/src/core/lib/surface/validate_metadata.cc +11 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/connectivity_state.cc +2 -2
- data/src/core/lib/transport/error_utils.cc +34 -28
- data/src/core/lib/transport/error_utils.h +3 -3
- data/src/core/lib/transport/handshaker.cc +14 -14
- data/src/core/lib/transport/handshaker.h +1 -1
- data/src/core/lib/transport/handshaker_factory.h +26 -0
- data/src/core/lib/transport/handshaker_registry.cc +8 -2
- data/src/core/lib/transport/handshaker_registry.h +3 -4
- data/src/core/lib/transport/http_connect_handshaker.cc +23 -24
- data/src/core/lib/transport/metadata_batch.h +17 -1
- data/src/core/lib/transport/parsed_metadata.cc +2 -6
- data/src/core/lib/transport/tcp_connect_handshaker.cc +15 -20
- data/src/core/lib/transport/transport.cc +63 -17
- data/src/core/lib/transport/transport.h +64 -68
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/lib/transport/transport_op_string.cc +7 -6
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -10
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -14
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +10 -10
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +8 -8
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +2 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +7 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +7 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +5 -5
- data/src/core/tsi/fake_transport_security.cc +3 -3
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +7 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +6 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +0 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +0 -43
- data/src/ruby/spec/generic/active_call_spec.rb +12 -3
- data/third_party/abseil-cpp/absl/cleanup/cleanup.h +140 -0
- data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +100 -0
- data/third_party/zlib/compress.c +3 -3
- data/third_party/zlib/crc32.c +21 -12
- data/third_party/zlib/deflate.c +112 -106
- data/third_party/zlib/deflate.h +2 -2
- data/third_party/zlib/gzlib.c +1 -1
- data/third_party/zlib/gzread.c +3 -5
- data/third_party/zlib/gzwrite.c +1 -1
- data/third_party/zlib/infback.c +10 -7
- data/third_party/zlib/inflate.c +5 -2
- data/third_party/zlib/inftrees.c +2 -2
- data/third_party/zlib/inftrees.h +1 -1
- data/third_party/zlib/trees.c +61 -62
- data/third_party/zlib/uncompr.c +2 -2
- data/third_party/zlib/zconf.h +16 -3
- data/third_party/zlib/zlib.h +10 -10
- data/third_party/zlib/zutil.c +9 -7
- data/third_party/zlib/zutil.h +1 -0
- metadata +57 -20
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +0 -188
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +0 -187
- data/src/core/lib/event_engine/executor/threaded_executor.h +0 -44
- data/src/core/lib/gpr/murmur_hash.cc +0 -82
- data/src/core/lib/gpr/murmur_hash.h +0 -29
- data/src/core/lib/gpr/tls.h +0 -156
- data/src/core/lib/promise/call_push_pull.h +0 -148
- data/src/core/lib/slice/slice_api.cc +0 -39
- data/src/core/lib/slice/slice_buffer_api.cc +0 -35
- data/src/core/lib/slice/slice_refcount_base.h +0 -60
@@ -27,7 +27,6 @@
|
|
27
27
|
#include <set>
|
28
28
|
#include <vector>
|
29
29
|
|
30
|
-
#include "absl/memory/memory.h"
|
31
30
|
#include "absl/status/status.h"
|
32
31
|
#include "absl/status/statusor.h"
|
33
32
|
#include "absl/strings/cord.h"
|
@@ -38,6 +37,7 @@
|
|
38
37
|
#include "absl/types/optional.h"
|
39
38
|
#include "absl/types/variant.h"
|
40
39
|
|
40
|
+
#include <grpc/event_engine/event_engine.h>
|
41
41
|
#include <grpc/impl/codegen/gpr_types.h>
|
42
42
|
#include <grpc/slice.h>
|
43
43
|
#include <grpc/status.h>
|
@@ -47,12 +47,12 @@
|
|
47
47
|
#include "src/core/ext/filters/client_channel/backend_metric.h"
|
48
48
|
#include "src/core/ext/filters/client_channel/backup_poller.h"
|
49
49
|
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
50
|
+
#include "src/core/ext/filters/client_channel/client_channel_service_config.h"
|
50
51
|
#include "src/core/ext/filters/client_channel/config_selector.h"
|
51
52
|
#include "src/core/ext/filters/client_channel/dynamic_filters.h"
|
52
53
|
#include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
|
53
54
|
#include "src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h"
|
54
55
|
#include "src/core/ext/filters/client_channel/local_subchannel_pool.h"
|
55
|
-
#include "src/core/ext/filters/client_channel/resolver_result_parsing.h"
|
56
56
|
#include "src/core/ext/filters/client_channel/retry_filter.h"
|
57
57
|
#include "src/core/ext/filters/client_channel/subchannel.h"
|
58
58
|
#include "src/core/ext/filters/client_channel/subchannel_interface_internal.h"
|
@@ -65,6 +65,7 @@
|
|
65
65
|
#include "src/core/lib/debug/trace.h"
|
66
66
|
#include "src/core/lib/gpr/useful.h"
|
67
67
|
#include "src/core/lib/gprpp/debug_location.h"
|
68
|
+
#include "src/core/lib/gprpp/status_helper.h"
|
68
69
|
#include "src/core/lib/gprpp/sync.h"
|
69
70
|
#include "src/core/lib/gprpp/work_serializer.h"
|
70
71
|
#include "src/core/lib/handshaker/proxy_mapper_registry.h"
|
@@ -79,7 +80,6 @@
|
|
79
80
|
#include "src/core/lib/service_config/service_config_call_data.h"
|
80
81
|
#include "src/core/lib/service_config/service_config_impl.h"
|
81
82
|
#include "src/core/lib/slice/slice_internal.h"
|
82
|
-
#include "src/core/lib/slice/slice_refcount.h"
|
83
83
|
#include "src/core/lib/surface/channel.h"
|
84
84
|
#include "src/core/lib/transport/connectivity_state.h"
|
85
85
|
#include "src/core/lib/transport/error_utils.h"
|
@@ -234,7 +234,7 @@ class ClientChannel::CallData {
|
|
234
234
|
grpc_transport_stream_op_batch* pending_batches_[MAX_PENDING_BATCHES] = {};
|
235
235
|
|
236
236
|
// Set when we get a cancel_stream op.
|
237
|
-
grpc_error_handle cancel_error_
|
237
|
+
grpc_error_handle cancel_error_;
|
238
238
|
};
|
239
239
|
|
240
240
|
//
|
@@ -274,7 +274,7 @@ class DynamicTerminationFilter {
|
|
274
274
|
GPR_ASSERT(args->is_last);
|
275
275
|
GPR_ASSERT(elem->filter == &kFilterVtable);
|
276
276
|
new (elem->channel_data) DynamicTerminationFilter(args->channel_args);
|
277
|
-
return
|
277
|
+
return absl::OkStatus();
|
278
278
|
}
|
279
279
|
|
280
280
|
static void Destroy(grpc_channel_element* elem) {
|
@@ -301,7 +301,7 @@ class DynamicTerminationFilter::CallData {
|
|
301
301
|
static grpc_error_handle Init(grpc_call_element* elem,
|
302
302
|
const grpc_call_element_args* args) {
|
303
303
|
new (elem->call_data) CallData(*args);
|
304
|
-
return
|
304
|
+
return absl::OkStatus();
|
305
305
|
}
|
306
306
|
|
307
307
|
static void Destroy(grpc_call_element* elem,
|
@@ -317,7 +317,7 @@ class DynamicTerminationFilter::CallData {
|
|
317
317
|
subchannel_call->SetAfterCallStackDestroy(then_schedule_closure);
|
318
318
|
} else {
|
319
319
|
// TODO(yashkt) : This can potentially be a Closure::Run
|
320
|
-
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure,
|
320
|
+
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, absl::OkStatus());
|
321
321
|
}
|
322
322
|
}
|
323
323
|
|
@@ -352,14 +352,14 @@ class DynamicTerminationFilter::CallData {
|
|
352
352
|
|
353
353
|
private:
|
354
354
|
explicit CallData(const grpc_call_element_args& args)
|
355
|
-
: path_(
|
355
|
+
: path_(CSliceRef(args.path)),
|
356
356
|
deadline_(args.deadline),
|
357
357
|
arena_(args.arena),
|
358
358
|
owning_call_(args.call_stack),
|
359
359
|
call_combiner_(args.call_combiner),
|
360
360
|
call_context_(args.context) {}
|
361
361
|
|
362
|
-
~CallData() {
|
362
|
+
~CallData() { CSliceUnref(path_); }
|
363
363
|
|
364
364
|
grpc_slice path_; // Request path.
|
365
365
|
Timestamp deadline_;
|
@@ -520,8 +520,6 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
|
|
520
520
|
data_watchers_.push_back(std::move(internal_watcher));
|
521
521
|
}
|
522
522
|
|
523
|
-
ChannelArgs channel_args() override { return subchannel_->channel_args(); }
|
524
|
-
|
525
523
|
void ThrottleKeepaliveTime(int new_keepalive_time) {
|
526
524
|
subchannel_->ThrottleKeepaliveTime(new_keepalive_time);
|
527
525
|
}
|
@@ -733,7 +731,7 @@ void ClientChannel::ExternalConnectivityWatcher::Notify(
|
|
733
731
|
chand_, on_complete_, /*cancel=*/false);
|
734
732
|
// Report new state to the user.
|
735
733
|
*state_ = state;
|
736
|
-
ExecCtx::Run(DEBUG_LOCATION, on_complete_,
|
734
|
+
ExecCtx::Run(DEBUG_LOCATION, on_complete_, absl::OkStatus());
|
737
735
|
// Hop back into the work_serializer to clean up.
|
738
736
|
// Not needed in state SHUTDOWN, because the tracker will
|
739
737
|
// automatically remove all watchers in that case.
|
@@ -756,7 +754,7 @@ void ClientChannel::ExternalConnectivityWatcher::Cancel() {
|
|
756
754
|
std::memory_order_relaxed)) {
|
757
755
|
return; // Already done.
|
758
756
|
}
|
759
|
-
ExecCtx::Run(DEBUG_LOCATION, on_complete_,
|
757
|
+
ExecCtx::Run(DEBUG_LOCATION, on_complete_, absl::CancelledError());
|
760
758
|
// Hop back into the work_serializer to clean up.
|
761
759
|
// Note: The callback takes a ref in case the ref inside the state tracker
|
762
760
|
// gets removed before the callback runs via a SHUTDOWN notification.
|
@@ -770,7 +768,7 @@ void ClientChannel::ExternalConnectivityWatcher::Cancel() {
|
|
770
768
|
}
|
771
769
|
|
772
770
|
void ClientChannel::ExternalConnectivityWatcher::AddWatcherLocked() {
|
773
|
-
Closure::Run(DEBUG_LOCATION, watcher_timer_init_,
|
771
|
+
Closure::Run(DEBUG_LOCATION, watcher_timer_init_, absl::OkStatus());
|
774
772
|
// Add new watcher. Pass the ref of the object from creation to OrphanablePtr.
|
775
773
|
chand_->state_tracker_.AddWatcher(
|
776
774
|
initial_state_, OrphanablePtr<ConnectivityStateWatcherInterface>(this));
|
@@ -891,7 +889,7 @@ class ClientChannel::ClientChannelControlHelper
|
|
891
889
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
|
892
890
|
if (chand_->resolver_ == nullptr) return; // Shutting down.
|
893
891
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
|
894
|
-
const char* extra =
|
892
|
+
const char* extra = chand_->disconnect_error_.ok()
|
895
893
|
? ""
|
896
894
|
: " (ignoring -- channel shutting down)";
|
897
895
|
gpr_log(GPR_INFO, "chand=%p: update: state=%s status=(%s) picker=%p%s",
|
@@ -899,7 +897,7 @@ class ClientChannel::ClientChannelControlHelper
|
|
899
897
|
picker.get(), extra);
|
900
898
|
}
|
901
899
|
// Do update only if not shutting down.
|
902
|
-
if (
|
900
|
+
if (chand_->disconnect_error_.ok()) {
|
903
901
|
chand_->UpdateStateAndPickerLocked(state, status, "helper",
|
904
902
|
std::move(picker));
|
905
903
|
}
|
@@ -918,6 +916,10 @@ class ClientChannel::ClientChannelControlHelper
|
|
918
916
|
return chand_->default_authority_;
|
919
917
|
}
|
920
918
|
|
919
|
+
grpc_event_engine::experimental::EventEngine* GetEventEngine() override {
|
920
|
+
return chand_->owning_stack_->EventEngine();
|
921
|
+
}
|
922
|
+
|
921
923
|
void AddTraceEvent(TraceSeverity severity, absl::string_view message) override
|
922
924
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
|
923
925
|
if (chand_->resolver_ == nullptr) return; // Shutting down.
|
@@ -954,7 +956,7 @@ grpc_error_handle ClientChannel::Init(grpc_channel_element* elem,
|
|
954
956
|
grpc_channel_element_args* args) {
|
955
957
|
GPR_ASSERT(args->is_last);
|
956
958
|
GPR_ASSERT(elem->filter == &kFilterVtable);
|
957
|
-
grpc_error_handle error
|
959
|
+
grpc_error_handle error;
|
958
960
|
new (elem->channel_data) ClientChannel(args, &error);
|
959
961
|
return error;
|
960
962
|
}
|
@@ -997,7 +999,7 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
|
997
999
|
grpc_client_channel_start_backup_polling(interested_parties_);
|
998
1000
|
// Check client channel factory.
|
999
1001
|
if (client_channel_factory_ == nullptr) {
|
1000
|
-
*error =
|
1002
|
+
*error = GRPC_ERROR_CREATE(
|
1001
1003
|
"Missing client channel factory in args for client channel filter");
|
1002
1004
|
return;
|
1003
1005
|
}
|
@@ -1006,7 +1008,7 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
|
1006
1008
|
absl::optional<absl::string_view> service_config_json =
|
1007
1009
|
channel_args_.GetString(GRPC_ARG_SERVICE_CONFIG);
|
1008
1010
|
if (!service_config_json.has_value()) service_config_json = "{}";
|
1009
|
-
*error =
|
1011
|
+
*error = absl::OkStatus();
|
1010
1012
|
auto service_config =
|
1011
1013
|
ServiceConfigImpl::Create(channel_args_, *service_config_json);
|
1012
1014
|
if (!service_config.ok()) {
|
@@ -1018,7 +1020,7 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
|
1018
1020
|
absl::optional<std::string> server_uri =
|
1019
1021
|
channel_args_.GetOwnedString(GRPC_ARG_SERVER_URI);
|
1020
1022
|
if (!server_uri.has_value()) {
|
1021
|
-
*error =
|
1023
|
+
*error = GRPC_ERROR_CREATE(
|
1022
1024
|
"target URI channel arg missing or wrong type in client channel "
|
1023
1025
|
"filter");
|
1024
1026
|
return;
|
@@ -1031,7 +1033,7 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
|
1031
1033
|
// resolver creation will succeed later.
|
1032
1034
|
if (!CoreConfiguration::Get().resolver_registry().IsValidTarget(
|
1033
1035
|
uri_to_resolve_)) {
|
1034
|
-
*error =
|
1036
|
+
*error = GRPC_ERROR_CREATE(
|
1035
1037
|
absl::StrCat("the target uri is not valid: ", uri_to_resolve_));
|
1036
1038
|
return;
|
1037
1039
|
}
|
@@ -1056,7 +1058,7 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
|
1056
1058
|
default_authority_ = std::move(*default_authority);
|
1057
1059
|
}
|
1058
1060
|
// Success.
|
1059
|
-
*error =
|
1061
|
+
*error = absl::OkStatus();
|
1060
1062
|
}
|
1061
1063
|
|
1062
1064
|
ClientChannel::~ClientChannel() {
|
@@ -1067,7 +1069,6 @@ ClientChannel::~ClientChannel() {
|
|
1067
1069
|
// Stop backup polling.
|
1068
1070
|
grpc_client_channel_stop_backup_polling(interested_parties_);
|
1069
1071
|
grpc_pollset_set_destroy(interested_parties_);
|
1070
|
-
GRPC_ERROR_UNREF(disconnect_error_);
|
1071
1072
|
}
|
1072
1073
|
|
1073
1074
|
OrphanablePtr<ClientChannel::LoadBalancedCall>
|
@@ -1321,17 +1322,16 @@ void ClientChannel::OnResolverErrorLocked(absl::Status status) {
|
|
1321
1322
|
call = call->next) {
|
1322
1323
|
grpc_call_element* elem = call->elem;
|
1323
1324
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
1324
|
-
grpc_error_handle error
|
1325
|
+
grpc_error_handle error;
|
1325
1326
|
if (calld->CheckResolutionLocked(elem, &error)) {
|
1326
1327
|
calld->AsyncResolutionDone(elem, error);
|
1327
1328
|
}
|
1328
1329
|
}
|
1329
1330
|
}
|
1330
|
-
GRPC_ERROR_UNREF(error);
|
1331
1331
|
// Update connectivity state.
|
1332
1332
|
UpdateStateAndPickerLocked(
|
1333
1333
|
GRPC_CHANNEL_TRANSIENT_FAILURE, status, "resolver failure",
|
1334
|
-
|
1334
|
+
std::make_unique<LoadBalancingPolicy::TransientFailurePicker>(status));
|
1335
1335
|
}
|
1336
1336
|
}
|
1337
1337
|
|
@@ -1371,7 +1371,7 @@ OrphanablePtr<LoadBalancingPolicy> ClientChannel::CreateLbPolicyLocked(
|
|
1371
1371
|
LoadBalancingPolicy::Args lb_policy_args;
|
1372
1372
|
lb_policy_args.work_serializer = work_serializer_;
|
1373
1373
|
lb_policy_args.channel_control_helper =
|
1374
|
-
|
1374
|
+
std::make_unique<ClientChannelControlHelper>(this);
|
1375
1375
|
lb_policy_args.args = args;
|
1376
1376
|
OrphanablePtr<LoadBalancingPolicy> lb_policy =
|
1377
1377
|
MakeOrphanable<ChildPolicyHandler>(std::move(lb_policy_args),
|
@@ -1460,7 +1460,7 @@ void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
|
|
1460
1460
|
filters.push_back(&DynamicTerminationFilter::kFilterVtable);
|
1461
1461
|
}
|
1462
1462
|
RefCountedPtr<DynamicFilters> dynamic_filters =
|
1463
|
-
DynamicFilters::Create(new_args
|
1463
|
+
DynamicFilters::Create(new_args, std::move(filters));
|
1464
1464
|
GPR_ASSERT(dynamic_filters != nullptr);
|
1465
1465
|
// Grab data plane lock to update service config.
|
1466
1466
|
//
|
@@ -1489,7 +1489,7 @@ void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
|
|
1489
1489
|
ExecCtx::Get()->InvalidateNow();
|
1490
1490
|
grpc_call_element* elem = call->elem;
|
1491
1491
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
1492
|
-
grpc_error_handle error
|
1492
|
+
grpc_error_handle error;
|
1493
1493
|
if (calld->CheckResolutionLocked(elem, &error)) {
|
1494
1494
|
calld->AsyncResolutionDone(elem, error);
|
1495
1495
|
}
|
@@ -1505,13 +1505,13 @@ void ClientChannel::CreateResolverLocked() {
|
|
1505
1505
|
}
|
1506
1506
|
resolver_ = CoreConfiguration::Get().resolver_registry().CreateResolver(
|
1507
1507
|
uri_to_resolve_.c_str(), channel_args_, interested_parties_,
|
1508
|
-
work_serializer_,
|
1508
|
+
work_serializer_, std::make_unique<ResolverResultHandler>(this));
|
1509
1509
|
// Since the validity of the args was checked when the channel was created,
|
1510
1510
|
// CreateResolver() must return a non-null result.
|
1511
1511
|
GPR_ASSERT(resolver_ != nullptr);
|
1512
1512
|
UpdateStateAndPickerLocked(
|
1513
1513
|
GRPC_CHANNEL_CONNECTING, absl::Status(), "started resolving",
|
1514
|
-
|
1514
|
+
std::make_unique<LoadBalancingPolicy::QueuePicker>(nullptr));
|
1515
1515
|
resolver_->StartLocked();
|
1516
1516
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
|
1517
1517
|
gpr_log(GPR_INFO, "chand=%p: created resolver=%p", this, resolver_.get());
|
@@ -1587,7 +1587,7 @@ void ClientChannel::UpdateStateAndPickerLocked(
|
|
1587
1587
|
// on the stale value, which results in the timer firing too early. To
|
1588
1588
|
// avoid this, we invalidate the cached value for each call we process.
|
1589
1589
|
ExecCtx::Get()->InvalidateNow();
|
1590
|
-
grpc_error_handle error
|
1590
|
+
grpc_error_handle error;
|
1591
1591
|
if (call->lb_call->PickSubchannelLocked(&error)) {
|
1592
1592
|
call->lb_call->AsyncPickDone(error);
|
1593
1593
|
}
|
@@ -1631,7 +1631,7 @@ T HandlePickResult(
|
|
1631
1631
|
|
1632
1632
|
grpc_error_handle ClientChannel::DoPingLocked(grpc_transport_op* op) {
|
1633
1633
|
if (state_tracker_.state() != GRPC_CHANNEL_READY) {
|
1634
|
-
return
|
1634
|
+
return GRPC_ERROR_CREATE("channel not connected");
|
1635
1635
|
}
|
1636
1636
|
LoadBalancingPolicy::PickResult result;
|
1637
1637
|
{
|
@@ -1648,16 +1648,15 @@ grpc_error_handle ClientChannel::DoPingLocked(grpc_transport_op* op) {
|
|
1648
1648
|
RefCountedPtr<ConnectedSubchannel> connected_subchannel =
|
1649
1649
|
subchannel->connected_subchannel();
|
1650
1650
|
if (connected_subchannel == nullptr) {
|
1651
|
-
return
|
1652
|
-
"LB pick for ping not connected");
|
1651
|
+
return GRPC_ERROR_CREATE("LB pick for ping not connected");
|
1653
1652
|
}
|
1654
1653
|
connected_subchannel->Ping(op->send_ping.on_initiate,
|
1655
1654
|
op->send_ping.on_ack);
|
1656
|
-
return
|
1655
|
+
return absl::OkStatus();
|
1657
1656
|
},
|
1658
1657
|
// Queue pick.
|
1659
1658
|
[](LoadBalancingPolicy::PickResult::Queue* /*queue_pick*/) {
|
1660
|
-
return
|
1659
|
+
return GRPC_ERROR_CREATE("LB picker queued call");
|
1661
1660
|
},
|
1662
1661
|
// Fail pick.
|
1663
1662
|
[](LoadBalancingPolicy::PickResult::Fail* fail_pick) {
|
@@ -1681,9 +1680,8 @@ void ClientChannel::StartTransportOpLocked(grpc_transport_op* op) {
|
|
1681
1680
|
// Ping.
|
1682
1681
|
if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
|
1683
1682
|
grpc_error_handle error = DoPingLocked(op);
|
1684
|
-
if (!
|
1685
|
-
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
|
1686
|
-
GRPC_ERROR_REF(error));
|
1683
|
+
if (!error.ok()) {
|
1684
|
+
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate, error);
|
1687
1685
|
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_ack, error);
|
1688
1686
|
}
|
1689
1687
|
op->bind_pollset = nullptr;
|
@@ -1697,34 +1695,34 @@ void ClientChannel::StartTransportOpLocked(grpc_transport_op* op) {
|
|
1697
1695
|
}
|
1698
1696
|
}
|
1699
1697
|
// Disconnect or enter IDLE.
|
1700
|
-
if (!
|
1698
|
+
if (!op->disconnect_with_error.ok()) {
|
1701
1699
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
|
1702
1700
|
gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", this,
|
1703
|
-
|
1701
|
+
StatusToString(op->disconnect_with_error).c_str());
|
1704
1702
|
}
|
1705
1703
|
DestroyResolverAndLbPolicyLocked();
|
1706
1704
|
intptr_t value;
|
1707
1705
|
if (grpc_error_get_int(op->disconnect_with_error,
|
1708
|
-
|
1706
|
+
StatusIntProperty::ChannelConnectivityState,
|
1707
|
+
&value) &&
|
1709
1708
|
static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
|
1710
|
-
if (
|
1709
|
+
if (disconnect_error_.ok()) {
|
1711
1710
|
// Enter IDLE state.
|
1712
1711
|
UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, absl::Status(),
|
1713
1712
|
"channel entering IDLE", nullptr);
|
1714
1713
|
}
|
1715
|
-
GRPC_ERROR_UNREF(op->disconnect_with_error);
|
1716
1714
|
} else {
|
1717
1715
|
// Disconnect.
|
1718
|
-
GPR_ASSERT(
|
1716
|
+
GPR_ASSERT(disconnect_error_.ok());
|
1719
1717
|
disconnect_error_ = op->disconnect_with_error;
|
1720
1718
|
UpdateStateAndPickerLocked(
|
1721
1719
|
GRPC_CHANNEL_SHUTDOWN, absl::Status(), "shutdown from API",
|
1722
|
-
|
1720
|
+
std::make_unique<LoadBalancingPolicy::TransientFailurePicker>(
|
1723
1721
|
grpc_error_to_absl_status(op->disconnect_with_error)));
|
1724
1722
|
}
|
1725
1723
|
}
|
1726
1724
|
GRPC_CHANNEL_STACK_UNREF(owning_stack_, "start_transport_op");
|
1727
|
-
ExecCtx::Run(DEBUG_LOCATION, op->on_consumed,
|
1725
|
+
ExecCtx::Run(DEBUG_LOCATION, op->on_consumed, absl::OkStatus());
|
1728
1726
|
}
|
1729
1727
|
|
1730
1728
|
void ClientChannel::StartTransportOp(grpc_channel_element* elem,
|
@@ -1828,7 +1826,7 @@ ClientChannel::CallData::CallData(grpc_call_element* elem,
|
|
1828
1826
|
GPR_LIKELY(chand.deadline_checking_enabled_)
|
1829
1827
|
? args.deadline
|
1830
1828
|
: Timestamp::InfFuture()),
|
1831
|
-
path_(
|
1829
|
+
path_(CSliceRef(args.path)),
|
1832
1830
|
call_start_time_(args.start_time),
|
1833
1831
|
deadline_(args.deadline),
|
1834
1832
|
arena_(args.arena),
|
@@ -1841,8 +1839,7 @@ ClientChannel::CallData::CallData(grpc_call_element* elem,
|
|
1841
1839
|
}
|
1842
1840
|
|
1843
1841
|
ClientChannel::CallData::~CallData() {
|
1844
|
-
|
1845
|
-
GRPC_ERROR_UNREF(cancel_error_);
|
1842
|
+
CSliceUnref(path_);
|
1846
1843
|
// Make sure there are no remaining pending batches.
|
1847
1844
|
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
|
1848
1845
|
GPR_ASSERT(pending_batches_[i] == nullptr);
|
@@ -1853,7 +1850,7 @@ grpc_error_handle ClientChannel::CallData::Init(
|
|
1853
1850
|
grpc_call_element* elem, const grpc_call_element_args* args) {
|
1854
1851
|
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
1855
1852
|
new (elem->call_data) CallData(elem, *chand, *args);
|
1856
|
-
return
|
1853
|
+
return absl::OkStatus();
|
1857
1854
|
}
|
1858
1855
|
|
1859
1856
|
void ClientChannel::CallData::Destroy(
|
@@ -1867,7 +1864,7 @@ void ClientChannel::CallData::Destroy(
|
|
1867
1864
|
dynamic_call->SetAfterCallStackDestroy(then_schedule_closure);
|
1868
1865
|
} else {
|
1869
1866
|
// TODO(yashkt) : This can potentially be a Closure::Run
|
1870
|
-
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure,
|
1867
|
+
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, absl::OkStatus());
|
1871
1868
|
}
|
1872
1869
|
}
|
1873
1870
|
|
@@ -1909,15 +1906,14 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
|
|
1909
1906
|
// We do not yet have a dynamic call.
|
1910
1907
|
//
|
1911
1908
|
// If we've previously been cancelled, immediately fail any new batches.
|
1912
|
-
if (GPR_UNLIKELY(!
|
1909
|
+
if (GPR_UNLIKELY(!calld->cancel_error_.ok())) {
|
1913
1910
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
1914
1911
|
gpr_log(GPR_INFO, "chand=%p calld=%p: failing batch with error: %s",
|
1915
|
-
chand, calld,
|
1916
|
-
grpc_error_std_string(calld->cancel_error_).c_str());
|
1912
|
+
chand, calld, StatusToString(calld->cancel_error_).c_str());
|
1917
1913
|
}
|
1918
1914
|
// Note: This will release the call combiner.
|
1919
1915
|
grpc_transport_stream_op_batch_finish_with_failure(
|
1920
|
-
batch,
|
1916
|
+
batch, calld->cancel_error_, calld->call_combiner_);
|
1921
1917
|
return;
|
1922
1918
|
}
|
1923
1919
|
// Handle cancellation.
|
@@ -1927,19 +1923,16 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
|
|
1927
1923
|
// cancelled before any batches are passed down (e.g., if the deadline
|
1928
1924
|
// is in the past when the call starts), we can return the right
|
1929
1925
|
// error to the caller when the first batch does get passed down.
|
1930
|
-
|
1931
|
-
calld->cancel_error_ =
|
1932
|
-
GRPC_ERROR_REF(batch->payload->cancel_stream.cancel_error);
|
1926
|
+
calld->cancel_error_ = batch->payload->cancel_stream.cancel_error;
|
1933
1927
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
1934
1928
|
gpr_log(GPR_INFO, "chand=%p calld=%p: recording cancel_error=%s", chand,
|
1935
|
-
calld,
|
1929
|
+
calld, StatusToString(calld->cancel_error_).c_str());
|
1936
1930
|
}
|
1937
1931
|
// Fail all pending batches.
|
1938
|
-
calld->PendingBatchesFail(elem,
|
1939
|
-
NoYieldCallCombiner);
|
1932
|
+
calld->PendingBatchesFail(elem, calld->cancel_error_, NoYieldCallCombiner);
|
1940
1933
|
// Note: This will release the call combiner.
|
1941
1934
|
grpc_transport_stream_op_batch_finish_with_failure(
|
1942
|
-
batch,
|
1935
|
+
batch, calld->cancel_error_, calld->call_combiner_);
|
1943
1936
|
return;
|
1944
1937
|
}
|
1945
1938
|
// Add the batch to the pending list.
|
@@ -1954,7 +1947,7 @@ void ClientChannel::CallData::StartTransportStreamOpBatch(
|
|
1954
1947
|
"config",
|
1955
1948
|
chand, calld);
|
1956
1949
|
}
|
1957
|
-
CheckResolution(elem,
|
1950
|
+
CheckResolution(elem, absl::OkStatus());
|
1958
1951
|
} else {
|
1959
1952
|
// For all other batches, release the call combiner.
|
1960
1953
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
@@ -2013,24 +2006,23 @@ void ClientChannel::CallData::FailPendingBatchInCallCombiner(
|
|
2013
2006
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
2014
2007
|
CallData* calld = static_cast<CallData*>(batch->handler_private.extra_arg);
|
2015
2008
|
// Note: This will release the call combiner.
|
2016
|
-
grpc_transport_stream_op_batch_finish_with_failure(
|
2017
|
-
|
2009
|
+
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
|
2010
|
+
calld->call_combiner_);
|
2018
2011
|
}
|
2019
2012
|
|
2020
2013
|
// This is called via the call combiner, so access to calld is synchronized.
|
2021
2014
|
void ClientChannel::CallData::PendingBatchesFail(
|
2022
2015
|
grpc_call_element* elem, grpc_error_handle error,
|
2023
2016
|
YieldCallCombinerPredicate yield_call_combiner_predicate) {
|
2024
|
-
GPR_ASSERT(!
|
2017
|
+
GPR_ASSERT(!error.ok());
|
2025
2018
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
2026
2019
|
size_t num_batches = 0;
|
2027
2020
|
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
|
2028
2021
|
if (pending_batches_[i] != nullptr) ++num_batches;
|
2029
2022
|
}
|
2030
|
-
gpr_log(
|
2031
|
-
|
2032
|
-
|
2033
|
-
grpc_error_std_string(error).c_str());
|
2023
|
+
gpr_log(
|
2024
|
+
GPR_INFO, "chand=%p calld=%p: failing %" PRIuPTR " pending batches: %s",
|
2025
|
+
elem->channel_data, this, num_batches, StatusToString(error).c_str());
|
2034
2026
|
}
|
2035
2027
|
CallCombinerClosureList closures;
|
2036
2028
|
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
|
@@ -2040,7 +2032,7 @@ void ClientChannel::CallData::PendingBatchesFail(
|
|
2040
2032
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure,
|
2041
2033
|
FailPendingBatchInCallCombiner, batch,
|
2042
2034
|
grpc_schedule_on_exec_ctx);
|
2043
|
-
closures.Add(&batch->handler_private.closure,
|
2035
|
+
closures.Add(&batch->handler_private.closure, error,
|
2044
2036
|
"PendingBatchesFail");
|
2045
2037
|
batch = nullptr;
|
2046
2038
|
}
|
@@ -2050,7 +2042,6 @@ void ClientChannel::CallData::PendingBatchesFail(
|
|
2050
2042
|
} else {
|
2051
2043
|
closures.RunClosuresWithoutYielding(call_combiner_);
|
2052
2044
|
}
|
2053
|
-
GRPC_ERROR_UNREF(error);
|
2054
2045
|
}
|
2055
2046
|
|
2056
2047
|
// This is called via the call combiner, so access to calld is synchronized.
|
@@ -2086,7 +2077,7 @@ void ClientChannel::CallData::PendingBatchesResume(grpc_call_element* elem) {
|
|
2086
2077
|
batch->handler_private.extra_arg = elem;
|
2087
2078
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure,
|
2088
2079
|
ResumePendingBatchInCallCombiner, batch, nullptr);
|
2089
|
-
closures.Add(&batch->handler_private.closure,
|
2080
|
+
closures.Add(&batch->handler_private.closure, absl::OkStatus(),
|
2090
2081
|
"resuming pending batch from client channel call");
|
2091
2082
|
batch = nullptr;
|
2092
2083
|
}
|
@@ -2122,15 +2113,14 @@ class ClientChannel::CallData::ResolverQueuedCallCanceller {
|
|
2122
2113
|
gpr_log(GPR_INFO,
|
2123
2114
|
"chand=%p calld=%p: cancelling resolver queued pick: "
|
2124
2115
|
"error=%s self=%p calld->resolver_pick_canceller=%p",
|
2125
|
-
chand, calld,
|
2116
|
+
chand, calld, StatusToString(error).c_str(), self,
|
2126
2117
|
calld->resolver_call_canceller_);
|
2127
2118
|
}
|
2128
|
-
if (calld->resolver_call_canceller_ == self &&
|
2129
|
-
!GRPC_ERROR_IS_NONE(error)) {
|
2119
|
+
if (calld->resolver_call_canceller_ == self && !error.ok()) {
|
2130
2120
|
// Remove pick from list of queued picks.
|
2131
2121
|
calld->MaybeRemoveCallFromResolverQueuedCallsLocked(self->elem_);
|
2132
2122
|
// Fail pending batches on the call.
|
2133
|
-
calld->PendingBatchesFail(self->elem_,
|
2123
|
+
calld->PendingBatchesFail(self->elem_, error,
|
2134
2124
|
YieldCallCombinerIfPendingBatchesFound);
|
2135
2125
|
}
|
2136
2126
|
}
|
@@ -2229,7 +2219,7 @@ grpc_error_handle ClientChannel::CallData::ApplyServiceConfigToCallLocked(
|
|
2229
2219
|
// Set the dynamic filter stack.
|
2230
2220
|
dynamic_filters_ = chand->dynamic_filters_;
|
2231
2221
|
}
|
2232
|
-
return
|
2222
|
+
return absl::OkStatus();
|
2233
2223
|
}
|
2234
2224
|
|
2235
2225
|
void ClientChannel::CallData::
|
@@ -2245,7 +2235,7 @@ void ClientChannel::CallData::
|
|
2245
2235
|
gpr_log(GPR_INFO,
|
2246
2236
|
"chand=%p calld=%p: got recv_trailing_metadata_ready: error=%s "
|
2247
2237
|
"service_config_call_data=%p",
|
2248
|
-
chand, calld,
|
2238
|
+
chand, calld, StatusToString(error).c_str(),
|
2249
2239
|
service_config_call_data);
|
2250
2240
|
}
|
2251
2241
|
if (service_config_call_data != nullptr) {
|
@@ -2253,7 +2243,7 @@ void ClientChannel::CallData::
|
|
2253
2243
|
}
|
2254
2244
|
// Chain to original callback.
|
2255
2245
|
Closure::Run(DEBUG_LOCATION, calld->original_recv_trailing_metadata_ready_,
|
2256
|
-
|
2246
|
+
error);
|
2257
2247
|
}
|
2258
2248
|
|
2259
2249
|
void ClientChannel::CallData::AsyncResolutionDone(grpc_call_element* elem,
|
@@ -2268,13 +2258,13 @@ void ClientChannel::CallData::ResolutionDone(void* arg,
|
|
2268
2258
|
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
2269
2259
|
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
2270
2260
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
2271
|
-
if (!
|
2261
|
+
if (!error.ok()) {
|
2272
2262
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
2273
2263
|
gpr_log(GPR_INFO,
|
2274
2264
|
"chand=%p calld=%p: error applying config to call: error=%s",
|
2275
|
-
chand, calld,
|
2265
|
+
chand, calld, StatusToString(error).c_str());
|
2276
2266
|
}
|
2277
|
-
calld->PendingBatchesFail(elem,
|
2267
|
+
calld->PendingBatchesFail(elem, error, YieldCallCombiner);
|
2278
2268
|
return;
|
2279
2269
|
}
|
2280
2270
|
calld->CreateDynamicCall(elem);
|
@@ -2292,7 +2282,6 @@ void ClientChannel::CallData::CheckResolution(void* arg,
|
|
2292
2282
|
}
|
2293
2283
|
if (resolution_complete) {
|
2294
2284
|
ResolutionDone(elem, error);
|
2295
|
-
GRPC_ERROR_UNREF(error);
|
2296
2285
|
}
|
2297
2286
|
}
|
2298
2287
|
|
@@ -2324,7 +2313,7 @@ bool ClientChannel::CallData::CheckResolutionLocked(grpc_call_element* elem,
|
|
2324
2313
|
DEBUG_LOCATION);
|
2325
2314
|
},
|
2326
2315
|
chand, nullptr),
|
2327
|
-
|
2316
|
+
absl::OkStatus());
|
2328
2317
|
}
|
2329
2318
|
// Get send_initial_metadata batch and flags.
|
2330
2319
|
auto& send_initial_metadata =
|
@@ -2376,7 +2365,7 @@ void ClientChannel::CallData::CreateDynamicCall(grpc_call_element* elem) {
|
|
2376
2365
|
arena_,
|
2377
2366
|
call_context_,
|
2378
2367
|
call_combiner_};
|
2379
|
-
grpc_error_handle error
|
2368
|
+
grpc_error_handle error;
|
2380
2369
|
DynamicFilters* channel_stack = args.channel_stack.get();
|
2381
2370
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
2382
2371
|
gpr_log(
|
@@ -2385,11 +2374,11 @@ void ClientChannel::CallData::CreateDynamicCall(grpc_call_element* elem) {
|
|
2385
2374
|
chand, this, channel_stack);
|
2386
2375
|
}
|
2387
2376
|
dynamic_call_ = channel_stack->CreateCall(std::move(args), &error);
|
2388
|
-
if (!
|
2377
|
+
if (!error.ok()) {
|
2389
2378
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
2390
2379
|
gpr_log(GPR_INFO,
|
2391
2380
|
"chand=%p calld=%p: failed to create dynamic call: error=%s",
|
2392
|
-
chand, this,
|
2381
|
+
chand, this, StatusToString(error).c_str());
|
2393
2382
|
}
|
2394
2383
|
PendingBatchesFail(elem, error, YieldCallCombiner);
|
2395
2384
|
return;
|
@@ -2556,7 +2545,7 @@ ClientChannel::LoadBalancedCall::LoadBalancedCall(
|
|
2556
2545
|
? "LoadBalancedCall"
|
2557
2546
|
: nullptr),
|
2558
2547
|
chand_(chand),
|
2559
|
-
path_(
|
2548
|
+
path_(CSliceRef(args.path)),
|
2560
2549
|
deadline_(args.deadline),
|
2561
2550
|
arena_(args.arena),
|
2562
2551
|
owning_call_(args.call_stack),
|
@@ -2573,8 +2562,6 @@ ClientChannel::LoadBalancedCall::LoadBalancedCall(
|
|
2573
2562
|
}
|
2574
2563
|
|
2575
2564
|
ClientChannel::LoadBalancedCall::~LoadBalancedCall() {
|
2576
|
-
GRPC_ERROR_UNREF(cancel_error_);
|
2577
|
-
GRPC_ERROR_UNREF(failure_error_);
|
2578
2565
|
if (backend_metric_data_ != nullptr) {
|
2579
2566
|
backend_metric_data_->BackendMetricData::~BackendMetricData();
|
2580
2567
|
}
|
@@ -2584,7 +2571,7 @@ ClientChannel::LoadBalancedCall::~LoadBalancedCall() {
|
|
2584
2571
|
}
|
2585
2572
|
if (on_call_destruction_complete_ != nullptr) {
|
2586
2573
|
ExecCtx::Run(DEBUG_LOCATION, on_call_destruction_complete_,
|
2587
|
-
|
2574
|
+
absl::OkStatus());
|
2588
2575
|
}
|
2589
2576
|
}
|
2590
2577
|
|
@@ -2637,16 +2624,15 @@ void ClientChannel::LoadBalancedCall::FailPendingBatchInCallCombiner(
|
|
2637
2624
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
2638
2625
|
auto* self = static_cast<LoadBalancedCall*>(batch->handler_private.extra_arg);
|
2639
2626
|
// Note: This will release the call combiner.
|
2640
|
-
grpc_transport_stream_op_batch_finish_with_failure(
|
2641
|
-
|
2627
|
+
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
|
2628
|
+
self->call_combiner_);
|
2642
2629
|
}
|
2643
2630
|
|
2644
2631
|
// This is called via the call combiner, so access to calld is synchronized.
|
2645
2632
|
void ClientChannel::LoadBalancedCall::PendingBatchesFail(
|
2646
2633
|
grpc_error_handle error,
|
2647
2634
|
YieldCallCombinerPredicate yield_call_combiner_predicate) {
|
2648
|
-
GPR_ASSERT(!
|
2649
|
-
GRPC_ERROR_UNREF(failure_error_);
|
2635
|
+
GPR_ASSERT(!error.ok());
|
2650
2636
|
failure_error_ = error;
|
2651
2637
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
2652
2638
|
size_t num_batches = 0;
|
@@ -2655,7 +2641,7 @@ void ClientChannel::LoadBalancedCall::PendingBatchesFail(
|
|
2655
2641
|
}
|
2656
2642
|
gpr_log(GPR_INFO,
|
2657
2643
|
"chand=%p lb_call=%p: failing %" PRIuPTR " pending batches: %s",
|
2658
|
-
chand_, this, num_batches,
|
2644
|
+
chand_, this, num_batches, StatusToString(error).c_str());
|
2659
2645
|
}
|
2660
2646
|
CallCombinerClosureList closures;
|
2661
2647
|
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
|
@@ -2665,7 +2651,7 @@ void ClientChannel::LoadBalancedCall::PendingBatchesFail(
|
|
2665
2651
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure,
|
2666
2652
|
FailPendingBatchInCallCombiner, batch,
|
2667
2653
|
grpc_schedule_on_exec_ctx);
|
2668
|
-
closures.Add(&batch->handler_private.closure,
|
2654
|
+
closures.Add(&batch->handler_private.closure, error,
|
2669
2655
|
"PendingBatchesFail");
|
2670
2656
|
batch = nullptr;
|
2671
2657
|
}
|
@@ -2708,7 +2694,7 @@ void ClientChannel::LoadBalancedCall::PendingBatchesResume() {
|
|
2708
2694
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure,
|
2709
2695
|
ResumePendingBatchInCallCombiner, batch,
|
2710
2696
|
grpc_schedule_on_exec_ctx);
|
2711
|
-
closures.Add(&batch->handler_private.closure,
|
2697
|
+
closures.Add(&batch->handler_private.closure, absl::OkStatus(),
|
2712
2698
|
"resuming pending batch from LB call");
|
2713
2699
|
batch = nullptr;
|
2714
2700
|
}
|
@@ -2732,7 +2718,7 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
|
|
2732
2718
|
// Record send ops in tracer.
|
2733
2719
|
if (batch->cancel_stream) {
|
2734
2720
|
call_attempt_tracer_->RecordCancel(
|
2735
|
-
|
2721
|
+
batch->payload->cancel_stream.cancel_error);
|
2736
2722
|
}
|
2737
2723
|
if (batch->send_initial_metadata) {
|
2738
2724
|
call_attempt_tracer_->RecordSendInitialMetadata(
|
@@ -2800,14 +2786,14 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
|
|
2800
2786
|
// We do not yet have a subchannel call.
|
2801
2787
|
//
|
2802
2788
|
// If we've previously been cancelled, immediately fail any new batches.
|
2803
|
-
if (GPR_UNLIKELY(!
|
2789
|
+
if (GPR_UNLIKELY(!cancel_error_.ok())) {
|
2804
2790
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
2805
2791
|
gpr_log(GPR_INFO, "chand=%p lb_call=%p: failing batch with error: %s",
|
2806
|
-
chand_, this,
|
2792
|
+
chand_, this, StatusToString(cancel_error_).c_str());
|
2807
2793
|
}
|
2808
2794
|
// Note: This will release the call combiner.
|
2809
|
-
grpc_transport_stream_op_batch_finish_with_failure(
|
2810
|
-
|
2795
|
+
grpc_transport_stream_op_batch_finish_with_failure(batch, cancel_error_,
|
2796
|
+
call_combiner_);
|
2811
2797
|
return;
|
2812
2798
|
}
|
2813
2799
|
// Handle cancellation.
|
@@ -2817,17 +2803,16 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
|
|
2817
2803
|
// cancelled before any batches are passed down (e.g., if the deadline
|
2818
2804
|
// is in the past when the call starts), we can return the right
|
2819
2805
|
// error to the caller when the first batch does get passed down.
|
2820
|
-
|
2821
|
-
cancel_error_ = GRPC_ERROR_REF(batch->payload->cancel_stream.cancel_error);
|
2806
|
+
cancel_error_ = batch->payload->cancel_stream.cancel_error;
|
2822
2807
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
2823
2808
|
gpr_log(GPR_INFO, "chand=%p lb_call=%p: recording cancel_error=%s",
|
2824
|
-
chand_, this,
|
2809
|
+
chand_, this, StatusToString(cancel_error_).c_str());
|
2825
2810
|
}
|
2826
2811
|
// Fail all pending batches.
|
2827
|
-
PendingBatchesFail(
|
2812
|
+
PendingBatchesFail(cancel_error_, NoYieldCallCombiner);
|
2828
2813
|
// Note: This will release the call combiner.
|
2829
|
-
grpc_transport_stream_op_batch_finish_with_failure(
|
2830
|
-
|
2814
|
+
grpc_transport_stream_op_batch_finish_with_failure(batch, cancel_error_,
|
2815
|
+
call_combiner_);
|
2831
2816
|
return;
|
2832
2817
|
}
|
2833
2818
|
// Add the batch to the pending list.
|
@@ -2840,7 +2825,7 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
|
|
2840
2825
|
"chand=%p lb_call=%p: grabbing data plane mutex to perform pick",
|
2841
2826
|
chand_, this);
|
2842
2827
|
}
|
2843
|
-
PickSubchannel(this,
|
2828
|
+
PickSubchannel(this, absl::OkStatus());
|
2844
2829
|
} else {
|
2845
2830
|
// For all other batches, release the call combiner.
|
2846
2831
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
@@ -2860,13 +2845,12 @@ void ClientChannel::LoadBalancedCall::SendInitialMetadataOnComplete(
|
|
2860
2845
|
gpr_log(GPR_INFO,
|
2861
2846
|
"chand=%p lb_call=%p: got on_complete for send_initial_metadata: "
|
2862
2847
|
"error=%s",
|
2863
|
-
self->chand_, self,
|
2848
|
+
self->chand_, self, StatusToString(error).c_str());
|
2864
2849
|
}
|
2865
2850
|
self->call_attempt_tracer_->RecordOnDoneSendInitialMetadata(
|
2866
2851
|
self->peer_string_);
|
2867
2852
|
Closure::Run(DEBUG_LOCATION,
|
2868
|
-
self->original_send_initial_metadata_on_complete_,
|
2869
|
-
GRPC_ERROR_REF(error));
|
2853
|
+
self->original_send_initial_metadata_on_complete_, error);
|
2870
2854
|
}
|
2871
2855
|
|
2872
2856
|
void ClientChannel::LoadBalancedCall::RecvInitialMetadataReady(
|
@@ -2875,15 +2859,15 @@ void ClientChannel::LoadBalancedCall::RecvInitialMetadataReady(
|
|
2875
2859
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
2876
2860
|
gpr_log(GPR_INFO,
|
2877
2861
|
"chand=%p lb_call=%p: got recv_initial_metadata_ready: error=%s",
|
2878
|
-
self->chand_, self,
|
2862
|
+
self->chand_, self, StatusToString(error).c_str());
|
2879
2863
|
}
|
2880
|
-
if (
|
2864
|
+
if (error.ok()) {
|
2881
2865
|
// recv_initial_metadata_flags is not populated for clients
|
2882
2866
|
self->call_attempt_tracer_->RecordReceivedInitialMetadata(
|
2883
2867
|
self->recv_initial_metadata_, 0 /* recv_initial_metadata_flags */);
|
2884
2868
|
}
|
2885
2869
|
Closure::Run(DEBUG_LOCATION, self->original_recv_initial_metadata_ready_,
|
2886
|
-
|
2870
|
+
error);
|
2887
2871
|
}
|
2888
2872
|
|
2889
2873
|
void ClientChannel::LoadBalancedCall::RecvMessageReady(
|
@@ -2891,13 +2875,12 @@ void ClientChannel::LoadBalancedCall::RecvMessageReady(
|
|
2891
2875
|
auto* self = static_cast<LoadBalancedCall*>(arg);
|
2892
2876
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
2893
2877
|
gpr_log(GPR_INFO, "chand=%p lb_call=%p: got recv_message_ready: error=%s",
|
2894
|
-
self->chand_, self,
|
2878
|
+
self->chand_, self, StatusToString(error).c_str());
|
2895
2879
|
}
|
2896
2880
|
if (self->recv_message_->has_value()) {
|
2897
2881
|
self->call_attempt_tracer_->RecordReceivedMessage(**self->recv_message_);
|
2898
2882
|
}
|
2899
|
-
Closure::Run(DEBUG_LOCATION, self->original_recv_message_ready_,
|
2900
|
-
GRPC_ERROR_REF(error));
|
2883
|
+
Closure::Run(DEBUG_LOCATION, self->original_recv_message_ready_, error);
|
2901
2884
|
}
|
2902
2885
|
|
2903
2886
|
void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
|
@@ -2908,16 +2891,16 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
|
|
2908
2891
|
"chand=%p lb_call=%p: got recv_trailing_metadata_ready: error=%s "
|
2909
2892
|
"call_attempt_tracer_=%p lb_subchannel_call_tracker_=%p "
|
2910
2893
|
"failure_error_=%s",
|
2911
|
-
self->chand_, self,
|
2894
|
+
self->chand_, self, StatusToString(error).c_str(),
|
2912
2895
|
self->call_attempt_tracer_, self->lb_subchannel_call_tracker_.get(),
|
2913
|
-
|
2896
|
+
StatusToString(self->failure_error_).c_str());
|
2914
2897
|
}
|
2915
2898
|
// Check if we have a tracer or an LB callback to invoke.
|
2916
2899
|
if (self->call_attempt_tracer_ != nullptr ||
|
2917
2900
|
self->lb_subchannel_call_tracker_ != nullptr) {
|
2918
2901
|
// Get the call's status.
|
2919
2902
|
absl::Status status;
|
2920
|
-
if (!
|
2903
|
+
if (!error.ok()) {
|
2921
2904
|
// Get status from error.
|
2922
2905
|
grpc_status_code code;
|
2923
2906
|
std::string message;
|
@@ -2940,11 +2923,9 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
|
|
2940
2923
|
self->RecordCallCompletion(status);
|
2941
2924
|
}
|
2942
2925
|
// Chain to original callback.
|
2943
|
-
if (!
|
2926
|
+
if (!self->failure_error_.ok()) {
|
2944
2927
|
error = self->failure_error_;
|
2945
|
-
self->failure_error_ =
|
2946
|
-
} else {
|
2947
|
-
error = GRPC_ERROR_REF(error);
|
2928
|
+
self->failure_error_ = absl::OkStatus();
|
2948
2929
|
}
|
2949
2930
|
Closure::Run(DEBUG_LOCATION, self->original_recv_trailing_metadata_ready_,
|
2950
2931
|
error);
|
@@ -2976,18 +2957,18 @@ void ClientChannel::LoadBalancedCall::CreateSubchannelCall() {
|
|
2976
2957
|
// TODO(roth): When we implement hedging support, we will probably
|
2977
2958
|
// need to use a separate call context for each subchannel call.
|
2978
2959
|
call_context_, call_combiner_};
|
2979
|
-
grpc_error_handle error
|
2960
|
+
grpc_error_handle error;
|
2980
2961
|
subchannel_call_ = SubchannelCall::Create(std::move(call_args), &error);
|
2981
2962
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
2982
2963
|
gpr_log(GPR_INFO,
|
2983
2964
|
"chand=%p lb_call=%p: create subchannel_call=%p: error=%s", chand_,
|
2984
|
-
this, subchannel_call_.get(),
|
2965
|
+
this, subchannel_call_.get(), StatusToString(error).c_str());
|
2985
2966
|
}
|
2986
2967
|
if (on_call_destruction_complete_ != nullptr) {
|
2987
2968
|
subchannel_call_->SetAfterCallStackDestroy(on_call_destruction_complete_);
|
2988
2969
|
on_call_destruction_complete_ = nullptr;
|
2989
2970
|
}
|
2990
|
-
if (GPR_UNLIKELY(!
|
2971
|
+
if (GPR_UNLIKELY(!error.ok())) {
|
2991
2972
|
PendingBatchesFail(error, YieldCallCombiner);
|
2992
2973
|
} else {
|
2993
2974
|
PendingBatchesResume();
|
@@ -3021,15 +3002,15 @@ class ClientChannel::LoadBalancedCall::LbQueuedCallCanceller {
|
|
3021
3002
|
gpr_log(GPR_INFO,
|
3022
3003
|
"chand=%p lb_call=%p: cancelling queued pick: "
|
3023
3004
|
"error=%s self=%p calld->pick_canceller=%p",
|
3024
|
-
chand, lb_call,
|
3005
|
+
chand, lb_call, StatusToString(error).c_str(), self,
|
3025
3006
|
lb_call->lb_call_canceller_);
|
3026
3007
|
}
|
3027
|
-
if (lb_call->lb_call_canceller_ == self && !
|
3008
|
+
if (lb_call->lb_call_canceller_ == self && !error.ok()) {
|
3028
3009
|
lb_call->call_dispatch_controller_->Commit();
|
3029
3010
|
// Remove pick from list of queued picks.
|
3030
3011
|
lb_call->MaybeRemoveCallFromLbQueuedCallsLocked();
|
3031
3012
|
// Fail pending batches on the call.
|
3032
|
-
lb_call->PendingBatchesFail(
|
3013
|
+
lb_call->PendingBatchesFail(error,
|
3033
3014
|
YieldCallCombinerIfPendingBatchesFound);
|
3034
3015
|
}
|
3035
3016
|
}
|
@@ -3075,13 +3056,13 @@ void ClientChannel::LoadBalancedCall::AsyncPickDone(grpc_error_handle error) {
|
|
3075
3056
|
void ClientChannel::LoadBalancedCall::PickDone(void* arg,
|
3076
3057
|
grpc_error_handle error) {
|
3077
3058
|
auto* self = static_cast<LoadBalancedCall*>(arg);
|
3078
|
-
if (!
|
3059
|
+
if (!error.ok()) {
|
3079
3060
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
3080
3061
|
gpr_log(GPR_INFO,
|
3081
3062
|
"chand=%p lb_call=%p: failed to pick subchannel: error=%s",
|
3082
|
-
self->chand_, self,
|
3063
|
+
self->chand_, self, StatusToString(error).c_str());
|
3083
3064
|
}
|
3084
|
-
self->PendingBatchesFail(
|
3065
|
+
self->PendingBatchesFail(error, YieldCallCombiner);
|
3085
3066
|
return;
|
3086
3067
|
}
|
3087
3068
|
self->call_dispatch_controller_->Commit();
|
@@ -3098,7 +3079,6 @@ void ClientChannel::LoadBalancedCall::PickSubchannel(void* arg,
|
|
3098
3079
|
}
|
3099
3080
|
if (pick_complete) {
|
3100
3081
|
PickDone(self, error);
|
3101
|
-
GRPC_ERROR_UNREF(error);
|
3102
3082
|
}
|
3103
3083
|
}
|
3104
3084
|
|
@@ -3199,7 +3179,7 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(
|
|
3199
3179
|
*error = grpc_error_set_int(
|
3200
3180
|
absl_status_to_grpc_error(MaybeRewriteIllegalStatusCode(
|
3201
3181
|
std::move(drop_pick->status), "LB drop")),
|
3202
|
-
|
3182
|
+
StatusIntProperty::kLbPolicyDrop, 1);
|
3203
3183
|
MaybeRemoveCallFromLbQueuedCallsLocked();
|
3204
3184
|
return true;
|
3205
3185
|
});
|