grpc 1.56.2 → 1.57.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +29 -22
  3. data/include/grpc/event_engine/event_engine.h +22 -32
  4. data/include/grpc/impl/grpc_types.h +3 -0
  5. data/include/grpc/support/port_platform.h +29 -23
  6. data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
  7. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  8. data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
  9. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
  11. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
  12. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
  19. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +97 -71
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
  22. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +1 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
  39. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
  40. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
  41. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
  42. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
  43. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
  45. data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
  46. data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
  47. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
  48. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
  49. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
  50. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  51. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
  52. data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
  53. data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
  55. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
  56. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
  57. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
  59. data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
  60. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
  61. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +4 -3
  62. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -8
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -2
  65. data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
  66. data/src/core/ext/transport/chttp2/transport/parsing.cc +15 -3
  67. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
  68. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
  69. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
  73. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
  74. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
  75. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
  76. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
  77. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
  78. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
  79. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
  80. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
  81. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
  82. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
  83. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
  84. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
  85. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
  86. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
  87. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
  88. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
  89. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
  90. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
  91. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
  92. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
  93. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
  94. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
  95. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
  96. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
  97. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
  98. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
  99. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
  100. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
  101. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
  102. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  103. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
  104. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
  105. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
  106. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
  107. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
  108. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
  109. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  110. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
  111. data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
  112. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
  113. data/src/core/ext/xds/xds_client_grpc.cc +11 -6
  114. data/src/core/ext/xds/xds_client_grpc.h +16 -2
  115. data/src/core/ext/xds/xds_client_stats.h +10 -0
  116. data/src/core/ext/xds/xds_cluster.cc +26 -16
  117. data/src/core/ext/xds/xds_endpoint.cc +4 -7
  118. data/src/core/ext/xds/xds_health_status.cc +0 -17
  119. data/src/core/ext/xds/xds_health_status.h +5 -25
  120. data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
  121. data/src/core/ext/xds/xds_route_config.cc +4 -0
  122. data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
  123. data/src/core/lib/address_utils/parse_address.cc +63 -1
  124. data/src/core/lib/address_utils/parse_address.h +8 -0
  125. data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
  126. data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
  127. data/src/core/lib/channel/channel_args.cc +21 -10
  128. data/src/core/lib/channel/channel_args.h +3 -0
  129. data/src/core/lib/channel/connected_channel.cc +4 -1
  130. data/src/core/lib/channel/promise_based_filter.h +1 -0
  131. data/src/core/lib/debug/trace.cc +1 -4
  132. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
  133. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
  134. data/src/core/lib/event_engine/event_engine.cc +0 -12
  135. data/src/core/lib/event_engine/forkable.cc +47 -42
  136. data/src/core/lib/event_engine/handle_containers.h +0 -4
  137. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
  138. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
  139. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
  140. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
  141. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
  142. data/src/core/lib/event_engine/posix_engine/posix_engine.h +8 -12
  143. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +37 -27
  144. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
  146. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
  147. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
  148. data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
  149. data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
  150. data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
  151. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
  152. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
  153. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
  154. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
  155. data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
  156. data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
  157. data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
  158. data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
  159. data/src/core/lib/experiments/config.cc +60 -22
  160. data/src/core/lib/experiments/config.h +20 -8
  161. data/src/core/lib/experiments/experiments.cc +278 -0
  162. data/src/core/lib/experiments/experiments.h +59 -1
  163. data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
  164. data/src/core/lib/gprpp/fork.cc +8 -9
  165. data/src/core/lib/gprpp/fork.h +6 -5
  166. data/src/core/lib/gprpp/if_list.h +4530 -0
  167. data/src/core/lib/gprpp/orphanable.h +3 -3
  168. data/src/core/lib/gprpp/ref_counted.h +6 -6
  169. data/src/core/lib/gprpp/sorted_pack.h +3 -12
  170. data/src/core/lib/gprpp/status_helper.h +16 -15
  171. data/src/core/lib/gprpp/time.h +12 -0
  172. data/src/core/lib/gprpp/type_list.h +32 -0
  173. data/src/core/lib/http/httpcli.h +6 -9
  174. data/src/core/lib/iomgr/error.cc +32 -2
  175. data/src/core/lib/iomgr/error.h +9 -10
  176. data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
  177. data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
  178. data/src/core/lib/iomgr/exec_ctx.h +11 -0
  179. data/src/core/lib/iomgr/pollset.h +4 -5
  180. data/src/core/lib/iomgr/port.h +10 -0
  181. data/src/core/lib/iomgr/resolve_address.cc +13 -1
  182. data/src/core/lib/iomgr/resolve_address.h +17 -3
  183. data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
  184. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
  185. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
  186. data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
  188. data/src/core/lib/iomgr/tcp_posix.cc +21 -4
  189. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -2
  190. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -2
  191. data/src/core/lib/iomgr/tcp_windows.cc +1 -3
  192. data/src/core/lib/iomgr/vsock.cc +59 -0
  193. data/src/core/lib/iomgr/vsock.h +38 -0
  194. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
  195. data/src/core/lib/load_balancing/delegating_helper.h +115 -0
  196. data/src/core/lib/load_balancing/lb_policy.h +20 -0
  197. data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
  198. data/src/core/lib/promise/party.h +1 -1
  199. data/src/core/lib/resolver/resolver_factory.h +3 -2
  200. data/src/core/lib/resolver/server_address.cc +9 -94
  201. data/src/core/lib/resolver/server_address.h +10 -64
  202. data/src/core/lib/resource_quota/memory_quota.h +1 -1
  203. data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
  204. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
  205. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  206. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
  207. data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
  208. data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
  209. data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
  210. data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
  212. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
  213. data/src/core/lib/service_config/service_config_call_data.h +5 -0
  214. data/src/core/lib/slice/slice.h +16 -0
  215. data/src/core/lib/surface/call.cc +31 -29
  216. data/src/core/lib/surface/server.h +2 -2
  217. data/src/core/lib/surface/version.cc +2 -2
  218. data/src/core/lib/transport/metadata_batch.cc +7 -7
  219. data/src/core/lib/transport/metadata_batch.h +86 -48
  220. data/src/core/lib/transport/parsed_metadata.h +34 -20
  221. data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
  222. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
  223. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
  224. data/src/core/tsi/ssl_transport_security.cc +28 -7
  225. data/src/ruby/bin/math_pb.rb +24 -18
  226. data/src/ruby/ext/grpc/extconf.rb +19 -18
  227. data/src/ruby/ext/grpc/rb_call.c +62 -39
  228. data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
  229. data/src/ruby/ext/grpc/rb_channel.c +126 -49
  230. data/src/ruby/ext/grpc/rb_channel.h +1 -0
  231. data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
  232. data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
  233. data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
  234. data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
  235. data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
  236. data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
  237. data/src/ruby/ext/grpc/rb_grpc.c +192 -30
  238. data/src/ruby/ext/grpc/rb_grpc.h +8 -2
  239. data/src/ruby/ext/grpc/rb_server.c +62 -45
  240. data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
  241. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
  242. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
  243. data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
  244. data/src/ruby/lib/grpc/version.rb +1 -1
  245. data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
  246. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
  247. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
  248. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
  249. data/third_party/boringssl-with-bazel/err_data.c +552 -552
  250. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
  251. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
  252. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
  253. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
  254. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
  255. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
  256. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
  257. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
  258. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
  259. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
  260. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
  261. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
  262. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
  263. data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
  264. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
  265. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
  266. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
  267. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
  269. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
  270. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
  271. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
  272. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
  273. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
  274. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
  275. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
  277. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
  278. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
  279. data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
  313. data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
  314. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
  316. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
  317. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
  318. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
  319. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
  320. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
  321. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
  322. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
  323. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
  325. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
  326. data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
  327. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
  328. data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
  329. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
  330. data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
  332. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
  333. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
  334. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
  335. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
  336. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
  337. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
  338. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
  339. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
  341. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
  342. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
  343. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
  344. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
  345. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
  346. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
  347. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
  348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
  349. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
  350. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
  351. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
  353. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
  354. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
  355. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
  356. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
  358. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
  359. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
  360. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
  361. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
  362. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
  363. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
  364. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
  365. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
  366. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
  367. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
  368. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
  369. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
  370. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  371. data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
  372. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
  373. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
  374. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
  375. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
  376. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
  377. data/third_party/upb/upb/collections/map.c +3 -3
  378. metadata +27 -12
  379. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
  380. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
  381. data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
  382. data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
  383. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -24,6 +24,7 @@
24
24
 
25
25
  #include <vector>
26
26
 
27
+ #include "absl/strings/string_view.h"
27
28
  #include "upb/mem/arena.h"
28
29
 
29
30
  #include <grpc/slice.h>
@@ -56,7 +57,8 @@ struct GrpcLbResponse {
56
57
  };
57
58
 
58
59
  // Creates a serialized grpclb request.
59
- grpc_slice GrpcLbRequestCreate(const char* lb_service_name, upb_Arena* arena);
60
+ grpc_slice GrpcLbRequestCreate(absl::string_view lb_service_name,
61
+ upb_Arena* arena);
60
62
 
61
63
  // Creates a serialized grpclb load report request.
62
64
  grpc_slice GrpcLbLoadReportRequestCreate(
@@ -29,18 +29,22 @@
29
29
  #include "absl/status/status.h"
30
30
  #include "absl/status/statusor.h"
31
31
  #include "absl/strings/string_view.h"
32
+ #include "absl/types/optional.h"
32
33
  #include "upb/base/string_view.h"
33
34
  #include "upb/upb.hpp"
34
35
 
36
+ #include <grpc/grpc.h>
35
37
  #include <grpc/impl/connectivity_state.h>
36
38
  #include <grpc/slice.h>
37
39
  #include <grpc/status.h>
38
40
  #include <grpc/support/log.h>
39
41
 
40
42
  #include "src/core/ext/filters/client_channel/client_channel_channelz.h"
43
+ #include "src/core/ext/filters/client_channel/client_channel_internal.h"
41
44
  #include "src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h"
42
45
  #include "src/core/ext/filters/client_channel/subchannel.h"
43
46
  #include "src/core/ext/filters/client_channel/subchannel_stream_client.h"
47
+ #include "src/core/lib/channel/channel_args.h"
44
48
  #include "src/core/lib/channel/channel_trace.h"
45
49
  #include "src/core/lib/debug/trace.h"
46
50
  #include "src/core/lib/gprpp/debug_location.h"
@@ -351,28 +355,40 @@ void HealthProducer::Orphan() {
351
355
  subchannel_->RemoveDataProducer(this);
352
356
  }
353
357
 
354
- void HealthProducer::AddWatcher(HealthWatcher* watcher,
355
- const std::string& health_check_service_name) {
358
+ void HealthProducer::AddWatcher(
359
+ HealthWatcher* watcher,
360
+ const absl::optional<std::string>& health_check_service_name) {
356
361
  MutexLock lock(&mu_);
357
362
  grpc_pollset_set_add_pollset_set(interested_parties_,
358
363
  watcher->interested_parties());
359
- auto it = health_checkers_.emplace(health_check_service_name, nullptr).first;
360
- auto& health_checker = it->second;
361
- if (health_checker == nullptr) {
362
- health_checker = MakeOrphanable<HealthChecker>(WeakRef(), it->first);
364
+ if (!health_check_service_name.has_value()) {
365
+ watcher->Notify(state_, status_);
366
+ non_health_watchers_.insert(watcher);
367
+ } else {
368
+ auto it =
369
+ health_checkers_.emplace(*health_check_service_name, nullptr).first;
370
+ auto& health_checker = it->second;
371
+ if (health_checker == nullptr) {
372
+ health_checker = MakeOrphanable<HealthChecker>(WeakRef(), it->first);
373
+ }
374
+ health_checker->AddWatcherLocked(watcher);
363
375
  }
364
- health_checker->AddWatcherLocked(watcher);
365
376
  }
366
377
 
367
378
  void HealthProducer::RemoveWatcher(
368
- HealthWatcher* watcher, const std::string& health_check_service_name) {
379
+ HealthWatcher* watcher,
380
+ const absl::optional<std::string>& health_check_service_name) {
369
381
  MutexLock lock(&mu_);
370
382
  grpc_pollset_set_del_pollset_set(interested_parties_,
371
383
  watcher->interested_parties());
372
- auto it = health_checkers_.find(health_check_service_name);
373
- if (it == health_checkers_.end()) return;
374
- const bool empty = it->second->RemoveWatcherLocked(watcher);
375
- if (empty) health_checkers_.erase(it);
384
+ if (!health_check_service_name.has_value()) {
385
+ non_health_watchers_.erase(watcher);
386
+ } else {
387
+ auto it = health_checkers_.find(*health_check_service_name);
388
+ if (it == health_checkers_.end()) return;
389
+ const bool empty = it->second->RemoveWatcherLocked(watcher);
390
+ if (empty) health_checkers_.erase(it);
391
+ }
376
392
  }
377
393
 
378
394
  void HealthProducer::OnConnectivityStateChange(grpc_connectivity_state state,
@@ -393,6 +409,9 @@ void HealthProducer::OnConnectivityStateChange(grpc_connectivity_state state,
393
409
  for (const auto& p : health_checkers_) {
394
410
  p.second->OnConnectivityStateChangeLocked(state, status);
395
411
  }
412
+ for (HealthWatcher* watcher : non_health_watchers_) {
413
+ watcher->Notify(state, status);
414
+ }
396
415
  }
397
416
 
398
417
  //
@@ -443,12 +462,16 @@ void HealthWatcher::Notify(grpc_connectivity_state state, absl::Status status) {
443
462
 
444
463
  std::unique_ptr<SubchannelInterface::DataWatcherInterface>
445
464
  MakeHealthCheckWatcher(
446
- std::shared_ptr<WorkSerializer> work_serializer,
447
- absl::string_view health_check_service_name,
465
+ std::shared_ptr<WorkSerializer> work_serializer, const ChannelArgs& args,
448
466
  std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
449
467
  watcher) {
468
+ absl::optional<std::string> health_check_service_name;
469
+ if (!args.GetBool(GRPC_ARG_INHIBIT_HEALTH_CHECKING).value_or(false)) {
470
+ health_check_service_name =
471
+ args.GetOwnedString(GRPC_ARG_HEALTH_CHECK_SERVICE_NAME);
472
+ }
450
473
  return std::make_unique<HealthWatcher>(std::move(work_serializer),
451
- health_check_service_name,
474
+ std::move(health_check_service_name),
452
475
  std::move(watcher));
453
476
  }
454
477
 
@@ -21,8 +21,7 @@
21
21
 
22
22
  #include <memory>
23
23
 
24
- #include "absl/strings/string_view.h"
25
-
24
+ #include "src/core/lib/channel/channel_args.h"
26
25
  #include "src/core/lib/gprpp/work_serializer.h"
27
26
  #include "src/core/lib/load_balancing/subchannel_interface.h"
28
27
 
@@ -39,13 +38,12 @@ namespace grpc_core {
39
38
  // like this:
40
39
  // subchannel->AddDataWatcher(
41
40
  // MakeHealthCheckWatcher(
42
- // work_serializer(), health_check_service_name,
41
+ // work_serializer(), channel_args,
43
42
  // std::make_unique<MyConnectivityStateWatcherSubclass>(...)));
44
43
 
45
44
  std::unique_ptr<SubchannelInterface::DataWatcherInterface>
46
45
  MakeHealthCheckWatcher(
47
- std::shared_ptr<WorkSerializer> work_serializer,
48
- absl::string_view health_check_service_name,
46
+ std::shared_ptr<WorkSerializer> work_serializer, const ChannelArgs& args,
49
47
  std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
50
48
  watcher);
51
49
 
@@ -28,6 +28,7 @@
28
28
  #include "absl/base/thread_annotations.h"
29
29
  #include "absl/status/status.h"
30
30
  #include "absl/strings/string_view.h"
31
+ #include "absl/types/optional.h"
31
32
 
32
33
  #include <grpc/impl/connectivity_state.h>
33
34
 
@@ -68,9 +69,10 @@ class HealthProducer : public Subchannel::DataProducerInterface {
68
69
  UniqueTypeName type() const override { return Type(); }
69
70
 
70
71
  void AddWatcher(HealthWatcher* watcher,
71
- const std::string& health_check_service_name);
72
- void RemoveWatcher(HealthWatcher* watcher,
73
- const std::string& health_check_service_name);
72
+ const absl::optional<std::string>& health_check_service_name);
73
+ void RemoveWatcher(
74
+ HealthWatcher* watcher,
75
+ const absl::optional<std::string>& health_check_service_name);
74
76
 
75
77
  private:
76
78
  class ConnectivityWatcher;
@@ -148,6 +150,7 @@ class HealthProducer : public Subchannel::DataProducerInterface {
148
150
  std::map<std::string /*health_check_service_name*/,
149
151
  OrphanablePtr<HealthChecker>>
150
152
  health_checkers_ ABSL_GUARDED_BY(&mu_);
153
+ std::set<HealthWatcher*> non_health_watchers_ ABSL_GUARDED_BY(&mu_);
151
154
  };
152
155
 
153
156
  // A data watcher that handles health checking.
@@ -155,18 +158,31 @@ class HealthWatcher : public InternalSubchannelDataWatcherInterface {
155
158
  public:
156
159
  HealthWatcher(
157
160
  std::shared_ptr<WorkSerializer> work_serializer,
158
- absl::string_view health_check_service_name,
161
+ absl::optional<std::string> health_check_service_name,
159
162
  std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
160
163
  watcher)
161
164
  : work_serializer_(std::move(work_serializer)),
162
- health_check_service_name_(health_check_service_name),
165
+ health_check_service_name_(std::move(health_check_service_name)),
163
166
  watcher_(std::move(watcher)) {}
164
167
  ~HealthWatcher() override;
165
168
 
169
+ UniqueTypeName type() const override { return HealthProducer::Type(); }
170
+
166
171
  // When the client channel sees this wrapper, it will pass it the real
167
172
  // subchannel to use.
168
173
  void SetSubchannel(Subchannel* subchannel) override;
169
174
 
175
+ // For intercepting the watcher before it gets up to the real subchannel.
176
+ std::shared_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
177
+ TakeWatcher() {
178
+ return std::move(watcher_);
179
+ }
180
+ void SetWatcher(
181
+ std::shared_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
182
+ watcher) {
183
+ watcher_ = std::move(watcher);
184
+ }
185
+
170
186
  void Notify(grpc_connectivity_state state, absl::Status status);
171
187
 
172
188
  grpc_pollset_set* interested_parties() const {
@@ -175,7 +191,7 @@ class HealthWatcher : public InternalSubchannelDataWatcherInterface {
175
191
 
176
192
  private:
177
193
  std::shared_ptr<WorkSerializer> work_serializer_;
178
- std::string health_check_service_name_;
194
+ absl::optional<std::string> health_check_service_name_;
179
195
  std::shared_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
180
196
  watcher_;
181
197
  RefCountedPtr<HealthProducer> producer_;
@@ -102,6 +102,8 @@ class OrcaWatcher : public InternalSubchannelDataWatcherInterface {
102
102
  Duration report_interval() const { return report_interval_; }
103
103
  OobBackendMetricWatcher* watcher() const { return watcher_.get(); }
104
104
 
105
+ UniqueTypeName type() const override { return OrcaProducer::Type(); }
106
+
105
107
  // When the client channel sees this wrapper, it will pass it the real
106
108
  // subchannel to use.
107
109
  void SetSubchannel(Subchannel* subchannel) override;
@@ -43,20 +43,25 @@
43
43
  #include <grpc/support/log.h>
44
44
 
45
45
  #include "src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h"
46
+ #include "src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h"
47
+ #include "src/core/ext/filters/client_channel/subchannel_interface_internal.h"
46
48
  #include "src/core/lib/address_utils/sockaddr_utils.h"
47
49
  #include "src/core/lib/channel/channel_args.h"
48
50
  #include "src/core/lib/config/core_configuration.h"
49
51
  #include "src/core/lib/debug/trace.h"
50
52
  #include "src/core/lib/gprpp/debug_location.h"
53
+ #include "src/core/lib/gprpp/match.h"
51
54
  #include "src/core/lib/gprpp/orphanable.h"
52
55
  #include "src/core/lib/gprpp/ref_counted.h"
53
56
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
57
+ #include "src/core/lib/gprpp/unique_type_name.h"
54
58
  #include "src/core/lib/gprpp/validation_errors.h"
55
59
  #include "src/core/lib/gprpp/work_serializer.h"
56
60
  #include "src/core/lib/iomgr/exec_ctx.h"
57
61
  #include "src/core/lib/iomgr/iomgr_fwd.h"
58
62
  #include "src/core/lib/iomgr/pollset_set.h"
59
63
  #include "src/core/lib/json/json.h"
64
+ #include "src/core/lib/load_balancing/delegating_helper.h"
60
65
  #include "src/core/lib/load_balancing/lb_policy.h"
61
66
  #include "src/core/lib/load_balancing/lb_policy_factory.h"
62
67
  #include "src/core/lib/load_balancing/lb_policy_registry.h"
@@ -68,9 +73,6 @@ namespace grpc_core {
68
73
 
69
74
  TraceFlag grpc_outlier_detection_lb_trace(false, "outlier_detection_lb");
70
75
 
71
- const char* DisableOutlierDetectionAttribute::kName =
72
- "disable_outlier_detection";
73
-
74
76
  namespace {
75
77
 
76
78
  using ::grpc_event_engine::experimental::EventEngine;
@@ -123,9 +125,12 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
123
125
  class SubchannelWrapper : public DelegatingSubchannel {
124
126
  public:
125
127
  SubchannelWrapper(RefCountedPtr<SubchannelState> subchannel_state,
126
- RefCountedPtr<SubchannelInterface> subchannel)
128
+ RefCountedPtr<SubchannelInterface> subchannel,
129
+ bool disable_via_raw_connectivity_watch)
127
130
  : DelegatingSubchannel(std::move(subchannel)),
128
- subchannel_state_(std::move(subchannel_state)) {
131
+ subchannel_state_(std::move(subchannel_state)),
132
+ disable_via_raw_connectivity_watch_(
133
+ disable_via_raw_connectivity_watch) {
129
134
  if (subchannel_state_ != nullptr) {
130
135
  subchannel_state_->AddSubchannel(this);
131
136
  if (subchannel_state_->ejection_time().has_value()) {
@@ -150,14 +155,27 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
150
155
  void CancelConnectivityStateWatch(
151
156
  ConnectivityStateWatcherInterface* watcher) override;
152
157
 
158
+ void AddDataWatcher(std::unique_ptr<DataWatcherInterface> watcher) override;
159
+
153
160
  RefCountedPtr<SubchannelState> subchannel_state() const {
154
161
  return subchannel_state_;
155
162
  }
156
163
 
157
164
  private:
165
+ // TODO(roth): As a temporary hack, this needs to handle watchers
166
+ // stored as both unique_ptr<> and shared_ptr<>, since the former is
167
+ // used for raw connectivity state watches and the latter is used
168
+ // for health watches. This hack will go away as part of implementing
169
+ // dualstack backend support.
158
170
  class WatcherWrapper
159
171
  : public SubchannelInterface::ConnectivityStateWatcherInterface {
160
172
  public:
173
+ WatcherWrapper(std::shared_ptr<
174
+ SubchannelInterface::ConnectivityStateWatcherInterface>
175
+ health_watcher,
176
+ bool ejected)
177
+ : watcher_(std::move(health_watcher)), ejected_(ejected) {}
178
+
161
179
  WatcherWrapper(std::unique_ptr<
162
180
  SubchannelInterface::ConnectivityStateWatcherInterface>
163
181
  watcher,
@@ -167,7 +185,7 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
167
185
  void Eject() {
168
186
  ejected_ = true;
169
187
  if (last_seen_state_.has_value()) {
170
- watcher_->OnConnectivityStateChange(
188
+ watcher()->OnConnectivityStateChange(
171
189
  GRPC_CHANNEL_TRANSIENT_FAILURE,
172
190
  absl::UnavailableError(
173
191
  "subchannel ejected by outlier detection"));
@@ -177,8 +195,8 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
177
195
  void Uneject() {
178
196
  ejected_ = false;
179
197
  if (last_seen_state_.has_value()) {
180
- watcher_->OnConnectivityStateChange(*last_seen_state_,
181
- last_seen_status_);
198
+ watcher()->OnConnectivityStateChange(*last_seen_state_,
199
+ last_seen_status_);
182
200
  }
183
201
  }
184
202
 
@@ -193,16 +211,30 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
193
211
  status = absl::UnavailableError(
194
212
  "subchannel ejected by outlier detection");
195
213
  }
196
- watcher_->OnConnectivityStateChange(new_state, status);
214
+ watcher()->OnConnectivityStateChange(new_state, status);
197
215
  }
198
216
  }
199
217
 
200
218
  grpc_pollset_set* interested_parties() override {
201
- return watcher_->interested_parties();
219
+ return watcher()->interested_parties();
202
220
  }
203
221
 
204
222
  private:
205
- std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
223
+ SubchannelInterface::ConnectivityStateWatcherInterface* watcher() const {
224
+ return Match(
225
+ watcher_,
226
+ [](const std::shared_ptr<
227
+ SubchannelInterface::ConnectivityStateWatcherInterface>&
228
+ watcher) { return watcher.get(); },
229
+ [](const std::unique_ptr<
230
+ SubchannelInterface::ConnectivityStateWatcherInterface>&
231
+ watcher) { return watcher.get(); });
232
+ }
233
+
234
+ absl::variant<std::shared_ptr<
235
+ SubchannelInterface::ConnectivityStateWatcherInterface>,
236
+ std::unique_ptr<
237
+ SubchannelInterface::ConnectivityStateWatcherInterface>>
206
238
  watcher_;
207
239
  absl::optional<grpc_connectivity_state> last_seen_state_;
208
240
  absl::Status last_seen_status_;
@@ -210,10 +242,12 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
210
242
  };
211
243
 
212
244
  RefCountedPtr<SubchannelState> subchannel_state_;
245
+ const bool disable_via_raw_connectivity_watch_;
213
246
  bool ejected_ = false;
214
247
  std::map<SubchannelInterface::ConnectivityStateWatcherInterface*,
215
248
  WatcherWrapper*>
216
249
  watchers_;
250
+ WatcherWrapper* watcher_wrapper_ = nullptr; // For health watching.
217
251
  };
218
252
 
219
253
  class SubchannelState : public RefCounted<SubchannelState> {
@@ -328,27 +362,17 @@ class OutlierDetectionLb : public LoadBalancingPolicy {
328
362
  bool counting_enabled_;
329
363
  };
330
364
 
331
- class Helper : public ChannelControlHelper {
365
+ class Helper
366
+ : public ParentOwningDelegatingChannelControlHelper<OutlierDetectionLb> {
332
367
  public:
333
368
  explicit Helper(RefCountedPtr<OutlierDetectionLb> outlier_detection_policy)
334
- : outlier_detection_policy_(std::move(outlier_detection_policy)) {}
335
-
336
- ~Helper() override {
337
- outlier_detection_policy_.reset(DEBUG_LOCATION, "Helper");
338
- }
369
+ : ParentOwningDelegatingChannelControlHelper(
370
+ std::move(outlier_detection_policy)) {}
339
371
 
340
372
  RefCountedPtr<SubchannelInterface> CreateSubchannel(
341
373
  ServerAddress address, const ChannelArgs& args) override;
342
374
  void UpdateState(grpc_connectivity_state state, const absl::Status& status,
343
375
  RefCountedPtr<SubchannelPicker> picker) override;
344
- void RequestReresolution() override;
345
- absl::string_view GetAuthority() override;
346
- grpc_event_engine::experimental::EventEngine* GetEventEngine() override;
347
- void AddTraceEvent(TraceSeverity severity,
348
- absl::string_view message) override;
349
-
350
- private:
351
- RefCountedPtr<OutlierDetectionLb> outlier_detection_policy_;
352
376
  };
353
377
 
354
378
  class EjectionTimer : public InternallyRefCounted<EjectionTimer> {
@@ -412,6 +436,7 @@ void OutlierDetectionLb::SubchannelWrapper::Eject() {
412
436
  ++it;
413
437
  watcher->Eject();
414
438
  }
439
+ if (watcher_wrapper_ != nullptr) watcher_wrapper_->Eject();
415
440
  }
416
441
 
417
442
  void OutlierDetectionLb::SubchannelWrapper::Uneject() {
@@ -419,10 +444,15 @@ void OutlierDetectionLb::SubchannelWrapper::Uneject() {
419
444
  for (auto& watcher : watchers_) {
420
445
  watcher.second->Uneject();
421
446
  }
447
+ if (watcher_wrapper_ != nullptr) watcher_wrapper_->Uneject();
422
448
  }
423
449
 
424
450
  void OutlierDetectionLb::SubchannelWrapper::WatchConnectivityState(
425
451
  std::unique_ptr<ConnectivityStateWatcherInterface> watcher) {
452
+ if (disable_via_raw_connectivity_watch_) {
453
+ wrapped_subchannel()->WatchConnectivityState(std::move(watcher));
454
+ return;
455
+ }
426
456
  ConnectivityStateWatcherInterface* watcher_ptr = watcher.get();
427
457
  auto watcher_wrapper =
428
458
  std::make_unique<WatcherWrapper>(std::move(watcher), ejected_);
@@ -432,12 +462,29 @@ void OutlierDetectionLb::SubchannelWrapper::WatchConnectivityState(
432
462
 
433
463
  void OutlierDetectionLb::SubchannelWrapper::CancelConnectivityStateWatch(
434
464
  ConnectivityStateWatcherInterface* watcher) {
465
+ if (disable_via_raw_connectivity_watch_) {
466
+ wrapped_subchannel()->CancelConnectivityStateWatch(watcher);
467
+ return;
468
+ }
435
469
  auto it = watchers_.find(watcher);
436
470
  if (it == watchers_.end()) return;
437
471
  wrapped_subchannel()->CancelConnectivityStateWatch(it->second);
438
472
  watchers_.erase(it);
439
473
  }
440
474
 
475
+ void OutlierDetectionLb::SubchannelWrapper::AddDataWatcher(
476
+ std::unique_ptr<DataWatcherInterface> watcher) {
477
+ auto* w = static_cast<InternalSubchannelDataWatcherInterface*>(watcher.get());
478
+ if (w->type() == HealthProducer::Type()) {
479
+ auto* health_watcher = static_cast<HealthWatcher*>(watcher.get());
480
+ auto watcher_wrapper = std::make_shared<WatcherWrapper>(
481
+ health_watcher->TakeWatcher(), ejected_);
482
+ watcher_wrapper_ = watcher_wrapper.get();
483
+ health_watcher->SetWatcher(std::move(watcher_wrapper));
484
+ }
485
+ DelegatingSubchannel::AddDataWatcher(std::move(watcher));
486
+ }
487
+
441
488
  //
442
489
  // OutlierDetectionLb::Picker::SubchannelCallTracker
443
490
  //
@@ -551,16 +598,6 @@ OutlierDetectionLb::~OutlierDetectionLb() {
551
598
 
552
599
  std::string OutlierDetectionLb::MakeKeyForAddress(
553
600
  const ServerAddress& address) {
554
- // If the address has the DisableOutlierDetectionAttribute attribute,
555
- // ignore it.
556
- // TODO(roth): This is a hack to prevent outlier_detection from
557
- // working with pick_first, as per discussion in
558
- // https://github.com/grpc/grpc/issues/32967. Remove this as part of
559
- // implementing dualstack backend support.
560
- if (address.GetAttribute(DisableOutlierDetectionAttribute::kName) !=
561
- nullptr) {
562
- return "";
563
- }
564
601
  // Use only the address, not the attributes.
565
602
  auto addr_str = grpc_sockaddr_to_string(&address.address(), false);
566
603
  // If address couldn't be stringified, ignore it.
@@ -739,25 +776,35 @@ OrphanablePtr<LoadBalancingPolicy> OutlierDetectionLb::CreateChildPolicyLocked(
739
776
 
740
777
  RefCountedPtr<SubchannelInterface> OutlierDetectionLb::Helper::CreateSubchannel(
741
778
  ServerAddress address, const ChannelArgs& args) {
742
- if (outlier_detection_policy_->shutting_down_) return nullptr;
779
+ if (parent()->shutting_down_) return nullptr;
780
+ // If the address has the DisableOutlierDetectionAttribute attribute,
781
+ // ignore it for raw connectivity state updates.
782
+ // TODO(roth): This is a hack to prevent outlier_detection from
783
+ // working with pick_first, as per discussion in
784
+ // https://github.com/grpc/grpc/issues/32967. Remove this as part of
785
+ // implementing dualstack backend support.
786
+ const bool disable_via_raw_connectivity_watch =
787
+ address.args().GetInt(GRPC_ARG_OUTLIER_DETECTION_DISABLE) == 1;
743
788
  RefCountedPtr<SubchannelState> subchannel_state;
744
789
  std::string key = MakeKeyForAddress(address);
745
790
  if (GRPC_TRACE_FLAG_ENABLED(grpc_outlier_detection_lb_trace)) {
746
791
  gpr_log(GPR_INFO,
747
- "[outlier_detection_lb %p] using key %s for subchannel address %s",
748
- outlier_detection_policy_.get(), key.c_str(),
749
- address.ToString().c_str());
792
+ "[outlier_detection_lb %p] using key %s for subchannel "
793
+ "address %s, disable_via_raw_connectivity_watch=%d",
794
+ parent(), key.c_str(), address.ToString().c_str(),
795
+ disable_via_raw_connectivity_watch);
750
796
  }
751
797
  if (!key.empty()) {
752
- auto it = outlier_detection_policy_->subchannel_state_map_.find(key);
753
- if (it != outlier_detection_policy_->subchannel_state_map_.end()) {
798
+ auto it = parent()->subchannel_state_map_.find(key);
799
+ if (it != parent()->subchannel_state_map_.end()) {
754
800
  subchannel_state = it->second->Ref();
755
801
  }
756
802
  }
757
803
  auto subchannel = MakeRefCounted<SubchannelWrapper>(
758
804
  subchannel_state,
759
- outlier_detection_policy_->channel_control_helper()->CreateSubchannel(
760
- std::move(address), args));
805
+ parent()->channel_control_helper()->CreateSubchannel(std::move(address),
806
+ args),
807
+ disable_via_raw_connectivity_watch);
761
808
  if (subchannel_state != nullptr) {
762
809
  subchannel_state->AddSubchannel(subchannel.get());
763
810
  }
@@ -767,41 +814,20 @@ RefCountedPtr<SubchannelInterface> OutlierDetectionLb::Helper::CreateSubchannel(
767
814
  void OutlierDetectionLb::Helper::UpdateState(
768
815
  grpc_connectivity_state state, const absl::Status& status,
769
816
  RefCountedPtr<SubchannelPicker> picker) {
770
- if (outlier_detection_policy_->shutting_down_) return;
817
+ if (parent()->shutting_down_) return;
771
818
  if (GRPC_TRACE_FLAG_ENABLED(grpc_outlier_detection_lb_trace)) {
772
819
  gpr_log(GPR_INFO,
773
820
  "[outlier_detection_lb %p] child connectivity state update: "
774
821
  "state=%s (%s) picker=%p",
775
- outlier_detection_policy_.get(), ConnectivityStateName(state),
776
- status.ToString().c_str(), picker.get());
822
+ parent(), ConnectivityStateName(state), status.ToString().c_str(),
823
+ picker.get());
777
824
  }
778
825
  // Save the state and picker.
779
- outlier_detection_policy_->state_ = state;
780
- outlier_detection_policy_->status_ = status;
781
- outlier_detection_policy_->picker_ = std::move(picker);
826
+ parent()->state_ = state;
827
+ parent()->status_ = status;
828
+ parent()->picker_ = std::move(picker);
782
829
  // Wrap the picker and return it to the channel.
783
- outlier_detection_policy_->MaybeUpdatePickerLocked();
784
- }
785
-
786
- void OutlierDetectionLb::Helper::RequestReresolution() {
787
- if (outlier_detection_policy_->shutting_down_) return;
788
- outlier_detection_policy_->channel_control_helper()->RequestReresolution();
789
- }
790
-
791
- absl::string_view OutlierDetectionLb::Helper::GetAuthority() {
792
- return outlier_detection_policy_->channel_control_helper()->GetAuthority();
793
- }
794
-
795
- grpc_event_engine::experimental::EventEngine*
796
- OutlierDetectionLb::Helper::GetEventEngine() {
797
- return outlier_detection_policy_->channel_control_helper()->GetEventEngine();
798
- }
799
-
800
- void OutlierDetectionLb::Helper::AddTraceEvent(TraceSeverity severity,
801
- absl::string_view message) {
802
- if (outlier_detection_policy_->shutting_down_) return;
803
- outlier_detection_policy_->channel_control_helper()->AddTraceEvent(severity,
804
- message);
830
+ parent()->MaybeUpdatePickerLocked();
805
831
  }
806
832
 
807
833
  //
@@ -21,9 +21,6 @@
21
21
 
22
22
  #include <stdint.h> // for uint32_t
23
23
 
24
- #include <memory>
25
- #include <string>
26
-
27
24
  #include "absl/types/optional.h"
28
25
 
29
26
  #include "src/core/lib/gprpp/time.h"
@@ -96,19 +93,8 @@ struct OutlierDetectionConfig {
96
93
  // TODO(roth): This is a horrible hack used to disable outlier detection
97
94
  // when used with the pick_first policy. Remove this as part of
98
95
  // implementing the dualstack backend design.
99
- class DisableOutlierDetectionAttribute
100
- : public ServerAddress::AttributeInterface {
101
- public:
102
- static const char* kName;
103
-
104
- std::unique_ptr<AttributeInterface> Copy() const override {
105
- return std::make_unique<DisableOutlierDetectionAttribute>();
106
- }
107
-
108
- int Cmp(const AttributeInterface*) const override { return true; }
109
-
110
- std::string ToString() const override { return "true"; }
111
- };
96
+ #define GRPC_ARG_OUTLIER_DETECTION_DISABLE \
97
+ GRPC_ARG_NO_SUBCHANNEL_PREFIX "outlier_detection_disable"
112
98
 
113
99
  } // namespace grpc_core
114
100