grpc 1.58.0 → 1.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (551) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +48 -33
  3. data/include/grpc/event_engine/event_engine.h +6 -10
  4. data/include/grpc/impl/channel_arg_names.h +4 -0
  5. data/include/grpc/support/port_platform.h +74 -1
  6. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +22 -9
  7. data/src/core/ext/filters/client_channel/client_channel.cc +422 -56
  8. data/src/core/ext/filters/client_channel/client_channel.h +52 -8
  9. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +15 -1
  10. data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -0
  11. data/src/core/ext/filters/client_channel/{http_proxy.cc → http_proxy_mapper.cc} +1 -1
  12. data/src/core/ext/filters/client_channel/{http_proxy.h → http_proxy_mapper.h} +3 -3
  13. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +188 -0
  14. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +214 -0
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +17 -4
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +41 -6
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +5 -3
  18. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +32 -103
  19. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +0 -7
  20. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +416 -139
  21. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +16 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +434 -459
  23. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +410 -26
  24. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -46
  25. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +851 -57
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +16 -10
  27. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +47 -32
  28. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +55 -3
  29. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +105 -175
  30. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +14 -7
  31. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +24 -6
  32. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +36 -2
  33. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +54 -44
  34. data/src/core/ext/filters/client_channel/subchannel.cc +33 -0
  35. data/src/core/ext/filters/client_channel/subchannel.h +9 -0
  36. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  37. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -6
  38. data/src/core/ext/transport/chttp2/transport/flow_control.cc +28 -22
  39. data/src/core/ext/transport/chttp2/transport/flow_control.h +27 -4
  40. data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
  41. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -1
  42. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +9 -0
  43. data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
  44. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
  45. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -1
  46. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -1
  47. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
  48. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
  49. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
  50. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +19 -10
  51. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
  52. data/src/core/ext/transport/chttp2/transport/internal.h +66 -47
  53. data/src/core/ext/transport/chttp2/transport/{frame.h → legacy_frame.h} +3 -3
  54. data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -2
  55. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +10 -0
  56. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +4 -0
  57. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -1
  58. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -1
  59. data/src/core/ext/transport/inproc/inproc_transport.cc +9 -0
  60. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +16 -18
  61. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +75 -83
  62. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +27 -29
  63. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +102 -110
  64. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +16 -18
  65. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +73 -81
  66. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +65 -67
  67. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +294 -302
  68. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +4 -6
  69. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +20 -28
  70. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +5 -7
  71. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +24 -32
  72. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +7 -9
  73. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +19 -27
  74. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +4 -6
  75. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +10 -18
  76. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +4 -6
  77. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +10 -18
  78. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +42 -44
  79. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +141 -149
  80. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +3 -5
  81. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +8 -16
  82. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +5 -7
  83. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -9
  84. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -5
  85. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +4 -12
  86. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +36 -38
  87. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +157 -165
  88. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +87 -89
  89. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +372 -380
  90. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -15
  91. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +55 -63
  92. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -113
  93. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +441 -449
  94. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -5
  95. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +8 -16
  96. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -25
  97. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +88 -96
  98. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +40 -42
  99. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +180 -188
  100. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +26 -28
  101. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +108 -116
  102. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +3 -5
  103. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +9 -17
  104. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +65 -67
  105. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +245 -253
  106. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +27 -29
  107. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +119 -127
  108. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +2 -4
  109. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +6 -14
  110. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +3 -5
  111. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +8 -16
  112. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +4 -6
  113. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +20 -28
  114. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +49 -51
  115. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +184 -192
  116. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +49 -51
  117. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +225 -233
  118. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -6
  119. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +13 -21
  120. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +63 -65
  121. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +246 -254
  122. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +5 -7
  123. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +19 -27
  124. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +5 -7
  125. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +19 -27
  126. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -10
  127. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +30 -38
  128. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +7 -9
  129. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +28 -36
  130. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +3 -5
  131. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +9 -17
  132. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +12 -14
  133. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +48 -56
  134. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +23 -25
  135. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +92 -100
  136. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +27 -29
  137. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +108 -116
  138. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -4
  139. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +5 -13
  140. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +38 -40
  141. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +167 -175
  142. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +34 -36
  143. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +162 -170
  144. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +10 -12
  145. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +37 -45
  146. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +4 -6
  147. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -21
  148. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +6 -8
  149. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +18 -26
  150. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +22 -24
  151. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +97 -105
  152. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +24 -26
  153. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +111 -119
  154. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +43 -45
  155. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +183 -191
  156. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +20 -22
  157. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +102 -110
  158. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +253 -255
  159. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +1108 -1116
  160. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +8 -10
  161. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -39
  162. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +35 -37
  163. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +150 -158
  164. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +4 -6
  165. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +10 -18
  166. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +3 -5
  167. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +8 -16
  168. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +4 -6
  169. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +13 -21
  170. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +5 -7
  171. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +19 -27
  172. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +14 -16
  173. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +53 -61
  174. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -5
  175. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +8 -16
  176. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +2 -4
  177. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +5 -13
  178. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +7 -9
  179. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +24 -32
  180. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +1 -3
  181. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +1 -9
  182. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +7 -9
  183. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +23 -31
  184. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +8 -10
  185. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +23 -31
  186. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +114 -116
  187. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +372 -380
  188. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +2 -4
  189. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +9 -17
  190. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +8 -10
  191. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +30 -38
  192. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +21 -23
  193. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +81 -89
  194. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +7 -9
  195. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +24 -32
  196. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +12 -14
  197. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +52 -60
  198. data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.c +4 -6
  199. data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +14 -22
  200. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +114 -116
  201. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +468 -476
  202. data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.c +2 -4
  203. data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.h +5 -13
  204. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +7 -9
  205. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +25 -33
  206. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +11 -13
  207. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +40 -48
  208. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +2 -4
  209. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +4 -12
  210. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +8 -10
  211. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +27 -35
  212. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.c +2 -4
  213. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +5 -13
  214. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -3
  215. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -9
  216. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +35 -37
  217. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +165 -173
  218. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +9 -11
  219. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +32 -40
  220. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +39 -41
  221. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +169 -177
  222. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +4 -6
  223. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +16 -24
  224. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -3
  225. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +1 -9
  226. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +55 -57
  227. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +241 -249
  228. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -9
  229. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -39
  230. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +23 -25
  231. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +98 -106
  232. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +4 -6
  233. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +11 -19
  234. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +4 -6
  235. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +18 -26
  236. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +3 -5
  237. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +9 -17
  238. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +6 -8
  239. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +16 -24
  240. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +6 -8
  241. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +24 -32
  242. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +3 -5
  243. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +13 -21
  244. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +3 -5
  245. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +10 -18
  246. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +2 -4
  247. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +6 -14
  248. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -8
  249. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +20 -28
  250. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +1 -3
  251. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +1 -9
  252. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +8 -10
  253. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +33 -41
  254. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +4 -6
  255. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +18 -26
  256. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +8 -10
  257. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -39
  258. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +8 -10
  259. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +34 -42
  260. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +14 -16
  261. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +47 -55
  262. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +4 -6
  263. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +13 -21
  264. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -3
  265. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -9
  266. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +2 -4
  267. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +4 -12
  268. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +4 -6
  269. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +10 -18
  270. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +7 -9
  271. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -27
  272. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.c +6 -8
  273. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.h +20 -28
  274. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +1 -3
  275. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +1 -9
  276. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +4 -6
  277. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +10 -18
  278. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +4 -6
  279. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +12 -20
  280. data/src/core/ext/upb-generated/google/api/annotations.upb.c +2 -4
  281. data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -9
  282. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +45 -47
  283. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +190 -198
  284. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +54 -56
  285. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +210 -218
  286. data/src/core/ext/upb-generated/google/api/http.upb.c +15 -17
  287. data/src/core/ext/upb-generated/google/api/http.upb.h +60 -68
  288. data/src/core/ext/upb-generated/google/api/httpbody.upb.c +4 -6
  289. data/src/core/ext/upb-generated/google/api/httpbody.upb.h +15 -23
  290. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +3 -5
  291. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -15
  292. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +359 -204
  293. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1340 -760
  294. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +3 -5
  295. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -15
  296. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -3
  297. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -9
  298. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +11 -13
  299. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +43 -51
  300. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +3 -5
  301. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -15
  302. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +10 -12
  303. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +28 -36
  304. data/src/core/ext/upb-generated/google/rpc/status.upb.c +4 -6
  305. data/src/core/ext/upb-generated/google/rpc/status.upb.h +15 -23
  306. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +11 -13
  307. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +35 -43
  308. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +10 -12
  309. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +28 -36
  310. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +48 -50
  311. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +190 -198
  312. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -7
  313. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +15 -23
  314. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +3 -5
  315. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +7 -15
  316. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +21 -23
  317. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +80 -88
  318. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +9 -11
  319. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +29 -37
  320. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +32 -34
  321. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +147 -155
  322. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +10 -12
  323. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +13 -21
  324. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
  325. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -15
  326. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +2 -4
  327. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -9
  328. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -6
  329. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +7 -15
  330. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -5
  331. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +4 -12
  332. data/src/core/ext/upb-generated/validate/validate.upb.c +201 -203
  333. data/src/core/ext/upb-generated/validate/validate.upb.h +924 -932
  334. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +10 -12
  335. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +13 -21
  336. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +4 -6
  337. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +7 -15
  338. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +2 -4
  339. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +1 -9
  340. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +9 -11
  341. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +16 -24
  342. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +3 -5
  343. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +4 -12
  344. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +2 -4
  345. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +4 -12
  346. data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.c +3 -5
  347. data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.h +8 -16
  348. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +6 -8
  349. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +20 -28
  350. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +4 -6
  351. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +9 -17
  352. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +3 -5
  353. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +8 -16
  354. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +4 -6
  355. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +12 -20
  356. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +9 -11
  357. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +35 -43
  358. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +5 -7
  359. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +14 -22
  360. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +16 -18
  361. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +43 -51
  362. data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.c +3 -5
  363. data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +13 -21
  364. data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.c +2 -4
  365. data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.h +5 -13
  366. data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.c +4 -6
  367. data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.h +21 -29
  368. data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.c +1 -3
  369. data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.h +1 -9
  370. data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.c +5 -7
  371. data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.h +24 -32
  372. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +24 -26
  373. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +103 -111
  374. data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.c +10 -12
  375. data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.h +61 -69
  376. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +3 -5
  377. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +9 -17
  378. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +8 -10
  379. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +33 -41
  380. data/src/core/ext/upb-generated/xds/type/v3/cel.upb.c +5 -7
  381. data/src/core/ext/upb-generated/xds/type/v3/cel.upb.h +18 -26
  382. data/src/core/ext/upb-generated/xds/type/v3/range.upb.c +7 -9
  383. data/src/core/ext/upb-generated/xds/type/v3/range.upb.h +19 -27
  384. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +3 -5
  385. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +8 -16
  386. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +367 -290
  387. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +10 -0
  388. data/src/core/ext/xds/xds_client.cc +6 -9
  389. data/src/core/ext/xds/xds_client.h +2 -2
  390. data/src/core/ext/xds/xds_cluster.cc +30 -42
  391. data/src/core/ext/xds/xds_cluster.h +0 -4
  392. data/src/core/ext/xds/xds_endpoint.cc +12 -19
  393. data/src/core/ext/xds/xds_endpoint.h +0 -1
  394. data/src/core/ext/xds/xds_http_filters.cc +1 -4
  395. data/src/core/ext/xds/xds_http_stateful_session_filter.cc +1 -4
  396. data/src/core/ext/xds/xds_listener.cc +14 -14
  397. data/src/core/ext/xds/xds_listener.h +13 -3
  398. data/src/core/ext/xds/xds_resource_type.h +1 -7
  399. data/src/core/ext/xds/xds_resource_type_impl.h +9 -11
  400. data/src/core/ext/xds/xds_route_config.cc +10 -11
  401. data/src/core/ext/xds/xds_route_config.h +1 -1
  402. data/src/core/ext/xds/xds_server_config_fetcher.cc +53 -28
  403. data/src/core/ext/xds/xds_transport_grpc.cc +11 -1
  404. data/src/core/lib/backoff/random_early_detection.cc +4 -2
  405. data/src/core/lib/backoff/random_early_detection.h +2 -4
  406. data/src/core/lib/channel/call_tracer.cc +7 -1
  407. data/src/core/lib/channel/call_tracer.h +4 -1
  408. data/src/core/lib/channel/channelz_registry.h +4 -2
  409. data/src/core/lib/channel/connected_channel.cc +1 -1
  410. data/src/core/lib/config/config_vars.h +1 -1
  411. data/src/core/lib/config/core_configuration.cc +2 -1
  412. data/src/core/lib/config/core_configuration.h +5 -4
  413. data/src/core/lib/debug/stats_data.cc +146 -51
  414. data/src/core/lib/debug/stats_data.h +81 -20
  415. data/src/core/lib/event_engine/ares_resolver.cc +9 -0
  416. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +3 -0
  417. data/src/core/lib/event_engine/cf_engine/cf_engine.h +3 -0
  418. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +3 -0
  419. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +3 -0
  420. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +3 -0
  421. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +15 -3
  422. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +3 -0
  423. data/src/core/lib/event_engine/nameser.h +102 -0
  424. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
  425. data/src/core/lib/event_engine/thread_pool/thread_count.h +15 -0
  426. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +3 -15
  427. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +10 -4
  428. data/src/core/lib/experiments/config.cc +9 -1
  429. data/src/core/lib/experiments/experiments.cc +409 -144
  430. data/src/core/lib/experiments/experiments.h +153 -39
  431. data/src/core/lib/gprpp/fork.h +1 -1
  432. data/src/core/lib/gprpp/manual_constructor.h +1 -2
  433. data/src/core/lib/gprpp/no_destruct.h +1 -1
  434. data/src/core/lib/gprpp/per_cpu.cc +2 -0
  435. data/src/core/lib/gprpp/per_cpu.h +36 -7
  436. data/src/core/lib/gprpp/ref_counted_ptr.h +63 -0
  437. data/src/core/lib/gprpp/work_serializer.cc +297 -25
  438. data/src/core/lib/gprpp/work_serializer.h +25 -9
  439. data/src/core/lib/iomgr/combiner.cc +54 -15
  440. data/src/core/lib/iomgr/combiner.h +8 -3
  441. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -4
  442. data/src/core/lib/iomgr/exec_ctx.cc +12 -0
  443. data/src/core/lib/iomgr/exec_ctx.h +55 -19
  444. data/src/core/lib/iomgr/polling_entity.cc +10 -0
  445. data/src/core/lib/iomgr/polling_entity.h +2 -0
  446. data/src/core/lib/iomgr/port.h +14 -0
  447. data/src/core/lib/iomgr/tcp_posix.cc +17 -14
  448. data/src/core/lib/load_balancing/lb_policy.h +10 -9
  449. data/src/core/lib/promise/arena_promise.h +5 -1
  450. data/src/core/lib/promise/detail/seq_state.h +418 -0
  451. data/src/core/lib/promise/latch.h +1 -0
  452. data/src/core/lib/promise/loop.h +8 -5
  453. data/src/core/lib/promise/pipe.h +24 -24
  454. data/src/core/lib/promise/poll.h +4 -6
  455. data/src/core/lib/resolver/server_address.h +1 -0
  456. data/src/core/lib/resource_quota/memory_quota.cc +58 -2
  457. data/src/core/lib/resource_quota/memory_quota.h +4 -1
  458. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +115 -9
  459. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +14 -0
  460. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_match.cc +86 -0
  461. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +0 -59
  462. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +2 -0
  463. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +7 -57
  464. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -1
  465. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -14
  466. data/src/core/lib/slice/slice.h +6 -0
  467. data/src/core/lib/slice/slice_buffer.cc +15 -0
  468. data/src/core/lib/slice/slice_buffer.h +16 -4
  469. data/src/core/lib/slice/slice_refcount.h +1 -1
  470. data/src/core/lib/surface/call.cc +92 -34
  471. data/src/core/lib/surface/call.h +4 -0
  472. data/src/core/lib/surface/channel.cc +7 -4
  473. data/src/core/lib/surface/channel_init.h +3 -2
  474. data/src/core/lib/surface/server.cc +45 -5
  475. data/src/core/lib/surface/server.h +18 -6
  476. data/src/core/lib/surface/version.cc +2 -2
  477. data/src/core/lib/transport/batch_builder.cc +3 -5
  478. data/src/core/lib/transport/metadata_batch.cc +6 -0
  479. data/src/core/lib/transport/metadata_batch.h +20 -1
  480. data/src/core/lib/transport/parsed_metadata.h +2 -4
  481. data/src/core/lib/transport/simple_slice_based_metadata.h +1 -2
  482. data/src/core/lib/transport/transport.h +21 -11
  483. data/src/core/tsi/ssl_transport_security.cc +7 -0
  484. data/src/core/tsi/ssl_transport_security.h +4 -0
  485. data/src/ruby/ext/grpc/extconf.rb +1 -1
  486. data/src/ruby/ext/grpc/rb_channel_args.c +6 -4
  487. data/src/ruby/lib/grpc/version.rb +1 -1
  488. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +4 -1
  489. data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +185 -0
  490. data/third_party/upb/upb/collections/array.c +6 -0
  491. data/third_party/upb/upb/collections/array.h +6 -0
  492. data/third_party/upb/upb/collections/map.c +7 -0
  493. data/third_party/upb/upb/collections/map.h +5 -0
  494. data/third_party/upb/upb/collections/map_sorter_internal.h +1 -1
  495. data/third_party/upb/upb/collections/message_value.h +8 -1
  496. data/third_party/upb/upb/generated_code_support.h +54 -0
  497. data/third_party/upb/upb/hash/common.c +5 -0
  498. data/third_party/upb/upb/hash/common.h +1 -0
  499. data/third_party/upb/upb/hash/str_table.h +1 -0
  500. data/third_party/upb/upb/message/accessors.c +25 -1
  501. data/third_party/upb/upb/message/accessors.h +46 -25
  502. data/third_party/upb/upb/message/accessors_internal.h +69 -3
  503. data/third_party/upb/upb/message/extension_internal.h +1 -1
  504. data/third_party/upb/upb/message/internal/map_entry.h +64 -0
  505. data/third_party/upb/upb/message/internal.h +2 -6
  506. data/third_party/upb/upb/message/message.c +0 -6
  507. data/third_party/upb/upb/message/message.h +1 -1
  508. data/third_party/upb/upb/message/tagged_ptr.h +89 -0
  509. data/third_party/upb/upb/mini_descriptor/build_enum.c +150 -0
  510. data/third_party/upb/upb/mini_descriptor/build_enum.h +63 -0
  511. data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.c +122 -374
  512. data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.h +11 -50
  513. data/third_party/upb/upb/mini_descriptor/internal/base92.c +46 -0
  514. data/third_party/upb/upb/mini_descriptor/internal/base92.h +81 -0
  515. data/third_party/upb/upb/mini_descriptor/internal/decoder.h +73 -0
  516. data/third_party/upb/upb/{mini_table → mini_descriptor/internal}/encode.c +58 -32
  517. data/third_party/upb/upb/{mini_table/encode_internal.h → mini_descriptor/internal/encode.h} +3 -4
  518. data/third_party/upb/upb/{mini_table/encode_internal.hpp → mini_descriptor/internal/encode.hpp} +1 -1
  519. data/third_party/upb/upb/mini_descriptor/internal/modifiers.h +50 -0
  520. data/third_party/upb/upb/{mini_table/common_internal.h → mini_descriptor/internal/wire_constants.h} +3 -23
  521. data/third_party/upb/upb/mini_descriptor/link.c +142 -0
  522. data/third_party/upb/upb/mini_descriptor/link.h +104 -0
  523. data/third_party/upb/upb/mini_table/{types.h → enum.h} +19 -9
  524. data/third_party/upb/upb/mini_table/extension.h +40 -0
  525. data/third_party/upb/upb/mini_table/extension_registry.c +1 -1
  526. data/third_party/upb/upb/mini_table/extension_registry.h +2 -1
  527. data/third_party/upb/upb/mini_table/field.h +118 -0
  528. data/third_party/upb/upb/{json_decode.h → mini_table/file.h} +5 -6
  529. data/third_party/upb/upb/mini_table/{enum_internal.h → internal/enum.h} +7 -19
  530. data/third_party/upb/upb/mini_table/{extension_internal.h → internal/extension.h} +8 -8
  531. data/third_party/upb/upb/mini_table/{field_internal.h → internal/field.h} +10 -66
  532. data/third_party/upb/upb/mini_table/{file_internal.h → internal/file.h} +6 -4
  533. data/third_party/upb/upb/mini_table/internal/message.c +39 -0
  534. data/third_party/upb/upb/mini_table/{message_internal.h → internal/message.h} +14 -37
  535. data/third_party/upb/upb/mini_table/{sub_internal.h → internal/sub.h} +7 -6
  536. data/third_party/upb/upb/mini_table/{common.c → message.c} +2 -33
  537. data/third_party/upb/upb/mini_table/{common.h → message.h} +12 -77
  538. data/third_party/upb/upb/{json_encode.h → mini_table/sub.h} +5 -6
  539. data/third_party/upb/upb/reflection/def.hpp +16 -4
  540. data/third_party/upb/upb/reflection/def_pool_internal.h +1 -1
  541. data/third_party/upb/upb/reflection/desc_state_internal.h +1 -1
  542. data/third_party/upb/upb/reflection/enum_def.c +1 -1
  543. data/third_party/upb/upb/reflection/field_def.c +2 -1
  544. data/third_party/upb/upb/reflection/message.c +2 -2
  545. data/third_party/upb/upb/reflection/message_def.c +3 -1
  546. data/third_party/upb/upb/wire/decode.c +68 -29
  547. data/third_party/upb/upb/wire/decode.h +40 -0
  548. data/third_party/upb/upb/wire/encode.c +23 -13
  549. metadata +44 -27
  550. data/src/core/lib/event_engine/thread_pool/original_thread_pool.cc +0 -256
  551. data/src/core/lib/event_engine/thread_pool/original_thread_pool.h +0 -137
@@ -69,8 +69,11 @@
69
69
  #include "src/core/lib/channel/status_util.h"
70
70
  #include "src/core/lib/config/core_configuration.h"
71
71
  #include "src/core/lib/debug/trace.h"
72
+ #include "src/core/lib/experiments/experiments.h"
72
73
  #include "src/core/lib/gpr/useful.h"
74
+ #include "src/core/lib/gprpp/crash.h"
73
75
  #include "src/core/lib/gprpp/debug_location.h"
76
+ #include "src/core/lib/gprpp/manual_constructor.h"
74
77
  #include "src/core/lib/gprpp/status_helper.h"
75
78
  #include "src/core/lib/gprpp/sync.h"
76
79
  #include "src/core/lib/gprpp/unique_type_name.h"
@@ -82,6 +85,14 @@
82
85
  #include "src/core/lib/json/json.h"
83
86
  #include "src/core/lib/load_balancing/lb_policy_registry.h"
84
87
  #include "src/core/lib/load_balancing/subchannel_interface.h"
88
+ #include "src/core/lib/promise/cancel_callback.h"
89
+ #include "src/core/lib/promise/context.h"
90
+ #include "src/core/lib/promise/latch.h"
91
+ #include "src/core/lib/promise/map.h"
92
+ #include "src/core/lib/promise/pipe.h"
93
+ #include "src/core/lib/promise/poll.h"
94
+ #include "src/core/lib/promise/promise.h"
95
+ #include "src/core/lib/promise/try_seq.h"
85
96
  #include "src/core/lib/resolver/resolver_registry.h"
86
97
  #include "src/core/lib/resolver/server_address.h"
87
98
  #include "src/core/lib/security/credentials/credentials.h"
@@ -89,6 +100,7 @@
89
100
  #include "src/core/lib/service_config/service_config_impl.h"
90
101
  #include "src/core/lib/slice/slice.h"
91
102
  #include "src/core/lib/slice/slice_internal.h"
103
+ #include "src/core/lib/surface/call.h"
92
104
  #include "src/core/lib/surface/channel.h"
93
105
  #include "src/core/lib/transport/connectivity_state.h"
94
106
  #include "src/core/lib/transport/error_utils.h"
@@ -146,7 +158,7 @@ class ClientChannel::CallData {
146
158
  // Accessors for data stored in the subclass.
147
159
  virtual ClientChannel* chand() const = 0;
148
160
  virtual Arena* arena() const = 0;
149
- virtual grpc_polling_entity* pollent() const = 0;
161
+ virtual grpc_polling_entity* pollent() = 0;
150
162
  virtual grpc_metadata_batch* send_initial_metadata() = 0;
151
163
  virtual grpc_call_context_element* call_context() const = 0;
152
164
 
@@ -205,7 +217,7 @@ class ClientChannel::FilterBasedCallData : public ClientChannel::CallData {
205
217
  return static_cast<ClientChannel*>(elem()->channel_data);
206
218
  }
207
219
  Arena* arena() const override { return deadline_state_.arena; }
208
- grpc_polling_entity* pollent() const override { return pollent_; }
220
+ grpc_polling_entity* pollent() override { return pollent_; }
209
221
  grpc_metadata_batch* send_initial_metadata() override {
210
222
  return pending_batches_[0]
211
223
  ->payload->send_initial_metadata.send_initial_metadata;
@@ -298,11 +310,108 @@ class ClientChannel::FilterBasedCallData : public ClientChannel::CallData {
298
310
  grpc_error_handle cancel_error_;
299
311
  };
300
312
 
313
+ class ClientChannel::PromiseBasedCallData : public ClientChannel::CallData {
314
+ public:
315
+ explicit PromiseBasedCallData(ClientChannel* chand) : chand_(chand) {}
316
+
317
+ ArenaPromise<absl::StatusOr<CallArgs>> MakeNameResolutionPromise(
318
+ CallArgs call_args) {
319
+ pollent_ = NowOrNever(call_args.polling_entity->WaitAndCopy()).value();
320
+ client_initial_metadata_ = std::move(call_args.client_initial_metadata);
321
+ // If we're still in IDLE, we need to start resolving.
322
+ if (GPR_UNLIKELY(chand_->CheckConnectivityState(false) ==
323
+ GRPC_CHANNEL_IDLE)) {
324
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
325
+ gpr_log(GPR_INFO, "chand=%p calld=%p: %striggering exit idle", chand_,
326
+ this, Activity::current()->DebugTag().c_str());
327
+ }
328
+ // Bounce into the control plane work serializer to start resolving.
329
+ GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ExitIdle");
330
+ chand_->work_serializer_->Run(
331
+ [chand = chand_]()
332
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
333
+ chand->CheckConnectivityState(/*try_to_connect=*/true);
334
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "ExitIdle");
335
+ },
336
+ DEBUG_LOCATION);
337
+ }
338
+ return [this, call_args = std::move(
339
+ call_args)]() mutable -> Poll<absl::StatusOr<CallArgs>> {
340
+ auto result = CheckResolution(was_queued_);
341
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
342
+ gpr_log(GPR_INFO, "chand=%p calld=%p: %sCheckResolution returns %s",
343
+ chand_, this, Activity::current()->DebugTag().c_str(),
344
+ result.has_value() ? result->ToString().c_str() : "Pending");
345
+ }
346
+ if (!result.has_value()) return Pending{};
347
+ if (!result->ok()) return *result;
348
+ call_args.client_initial_metadata = std::move(client_initial_metadata_);
349
+ return std::move(call_args);
350
+ };
351
+ }
352
+
353
+ private:
354
+ ClientChannel* chand() const override { return chand_; }
355
+ Arena* arena() const override { return GetContext<Arena>(); }
356
+ grpc_polling_entity* pollent() override { return &pollent_; }
357
+ grpc_metadata_batch* send_initial_metadata() override {
358
+ return client_initial_metadata_.get();
359
+ }
360
+ grpc_call_context_element* call_context() const override {
361
+ return GetContext<grpc_call_context_element>();
362
+ }
363
+
364
+ void OnAddToQueueLocked() override
365
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::resolution_mu_) {
366
+ waker_ = Activity::current()->MakeNonOwningWaker();
367
+ was_queued_ = true;
368
+ }
369
+
370
+ void RetryCheckResolutionLocked()
371
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::resolution_mu_) override {
372
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
373
+ gpr_log(GPR_INFO, "chand=%p calld=%p: RetryCheckResolutionLocked(): %s",
374
+ chand_, this, waker_.ActivityDebugTag().c_str());
375
+ }
376
+ waker_.WakeupAsync();
377
+ }
378
+
379
+ void ResetDeadline(Duration timeout) override {
380
+ CallContext* call_context = GetContext<CallContext>();
381
+ const Timestamp per_method_deadline =
382
+ Timestamp::FromCycleCounterRoundUp(call_context->call_start_time()) +
383
+ timeout;
384
+ call_context->UpdateDeadline(per_method_deadline);
385
+ }
386
+
387
+ ClientChannel* chand_;
388
+ grpc_polling_entity pollent_;
389
+ ClientMetadataHandle client_initial_metadata_;
390
+ bool was_queued_ = false;
391
+ Waker waker_ ABSL_GUARDED_BY(&ClientChannel::resolution_mu_);
392
+ };
393
+
301
394
  //
302
395
  // Filter vtable
303
396
  //
304
397
 
305
- const grpc_channel_filter ClientChannel::kFilterVtable = {
398
+ const grpc_channel_filter ClientChannel::kFilterVtableWithPromises = {
399
+ ClientChannel::FilterBasedCallData::StartTransportStreamOpBatch,
400
+ ClientChannel::MakeCallPromise,
401
+ ClientChannel::StartTransportOp,
402
+ sizeof(ClientChannel::FilterBasedCallData),
403
+ ClientChannel::FilterBasedCallData::Init,
404
+ ClientChannel::FilterBasedCallData::SetPollent,
405
+ ClientChannel::FilterBasedCallData::Destroy,
406
+ sizeof(ClientChannel),
407
+ ClientChannel::Init,
408
+ grpc_channel_stack_no_post_init,
409
+ ClientChannel::Destroy,
410
+ ClientChannel::GetChannelInfo,
411
+ "client-channel",
412
+ };
413
+
414
+ const grpc_channel_filter ClientChannel::kFilterVtableWithoutPromises = {
306
415
  ClientChannel::FilterBasedCallData::StartTransportStreamOpBatch,
307
416
  nullptr,
308
417
  ClientChannel::StartTransportOp,
@@ -324,6 +433,12 @@ const grpc_channel_filter ClientChannel::kFilterVtable = {
324
433
 
325
434
  namespace {
326
435
 
436
+ ClientChannelServiceConfigCallData* GetServiceConfigCallData(
437
+ grpc_call_context_element* context) {
438
+ return static_cast<ClientChannelServiceConfigCallData*>(
439
+ context[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
440
+ }
441
+
327
442
  class DynamicTerminationFilter {
328
443
  public:
329
444
  class CallData;
@@ -349,6 +464,19 @@ class DynamicTerminationFilter {
349
464
  static void GetChannelInfo(grpc_channel_element* /*elem*/,
350
465
  const grpc_channel_info* /*info*/) {}
351
466
 
467
+ static ArenaPromise<ServerMetadataHandle> MakeCallPromise(
468
+ grpc_channel_element* elem, CallArgs call_args, NextPromiseFactory) {
469
+ auto* chand = static_cast<DynamicTerminationFilter*>(elem->channel_data);
470
+ return chand->chand_->CreateLoadBalancedCallPromise(
471
+ std::move(call_args),
472
+ []() {
473
+ auto* service_config_call_data =
474
+ GetServiceConfigCallData(GetContext<grpc_call_context_element>());
475
+ service_config_call_data->Commit();
476
+ },
477
+ /*is_transparent_retry=*/false);
478
+ }
479
+
352
480
  private:
353
481
  explicit DynamicTerminationFilter(const ChannelArgs& args)
354
482
  : chand_(args.GetObject<ClientChannel>()) {}
@@ -397,8 +525,7 @@ class DynamicTerminationFilter::CallData {
397
525
  /*start_time=*/0, calld->deadline_,
398
526
  calld->arena_, calld->call_combiner_};
399
527
  auto* service_config_call_data =
400
- static_cast<ClientChannelServiceConfigCallData*>(
401
- calld->call_context_[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
528
+ GetServiceConfigCallData(calld->call_context_);
402
529
  calld->lb_call_ = client_channel->CreateLoadBalancedCall(
403
530
  args, pollent, nullptr,
404
531
  [service_config_call_data]() { service_config_call_data->Commit(); },
@@ -433,7 +560,7 @@ class DynamicTerminationFilter::CallData {
433
560
 
434
561
  const grpc_channel_filter DynamicTerminationFilter::kFilterVtable = {
435
562
  DynamicTerminationFilter::CallData::StartTransportStreamOpBatch,
436
- nullptr,
563
+ DynamicTerminationFilter::MakeCallPromise,
437
564
  DynamicTerminationFilter::StartTransportOp,
438
565
  sizeof(DynamicTerminationFilter::CallData),
439
566
  DynamicTerminationFilter::CallData::Init,
@@ -501,6 +628,7 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
501
628
  chand, this, subchannel_.get());
502
629
  }
503
630
  GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper");
631
+ GPR_DEBUG_ASSERT(chand_->work_serializer_->RunningInWorkSerializer());
504
632
  if (chand_->channelz_node_ != nullptr) {
505
633
  auto* subchannel_node = subchannel_->channelz_node();
506
634
  if (subchannel_node != nullptr) {
@@ -513,7 +641,6 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
513
641
  ++it->second;
514
642
  }
515
643
  }
516
- GPR_DEBUG_ASSERT(chand_->work_serializer_->RunningInWorkSerializer());
517
644
  chand_->subchannel_wrappers_.insert(this);
518
645
  }
519
646
 
@@ -523,24 +650,53 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
523
650
  "chand=%p: destroying subchannel wrapper %p for subchannel %p",
524
651
  chand_, this, subchannel_.get());
525
652
  }
526
- GPR_DEBUG_ASSERT(chand_->work_serializer_->RunningInWorkSerializer());
527
- chand_->subchannel_wrappers_.erase(this);
528
- if (chand_->channelz_node_ != nullptr) {
529
- auto* subchannel_node = subchannel_->channelz_node();
530
- if (subchannel_node != nullptr) {
531
- auto it = chand_->subchannel_refcount_map_.find(subchannel_.get());
532
- GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
533
- --it->second;
534
- if (it->second == 0) {
535
- chand_->channelz_node_->RemoveChildSubchannel(
536
- subchannel_node->uuid());
537
- chand_->subchannel_refcount_map_.erase(it);
653
+ if (!IsWorkSerializerDispatchEnabled()) {
654
+ chand_->subchannel_wrappers_.erase(this);
655
+ if (chand_->channelz_node_ != nullptr) {
656
+ auto* subchannel_node = subchannel_->channelz_node();
657
+ if (subchannel_node != nullptr) {
658
+ auto it = chand_->subchannel_refcount_map_.find(subchannel_.get());
659
+ GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
660
+ --it->second;
661
+ if (it->second == 0) {
662
+ chand_->channelz_node_->RemoveChildSubchannel(
663
+ subchannel_node->uuid());
664
+ chand_->subchannel_refcount_map_.erase(it);
665
+ }
538
666
  }
539
667
  }
540
668
  }
541
669
  GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "SubchannelWrapper");
542
670
  }
543
671
 
672
+ void Orphan() override {
673
+ if (!IsWorkSerializerDispatchEnabled()) return;
674
+ // Make sure we clean up the channel's subchannel maps inside the
675
+ // WorkSerializer.
676
+ // Ref held by callback.
677
+ WeakRef(DEBUG_LOCATION, "subchannel map cleanup").release();
678
+ chand_->work_serializer_->Run(
679
+ [this]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
680
+ chand_->subchannel_wrappers_.erase(this);
681
+ if (chand_->channelz_node_ != nullptr) {
682
+ auto* subchannel_node = subchannel_->channelz_node();
683
+ if (subchannel_node != nullptr) {
684
+ auto it =
685
+ chand_->subchannel_refcount_map_.find(subchannel_.get());
686
+ GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
687
+ --it->second;
688
+ if (it->second == 0) {
689
+ chand_->channelz_node_->RemoveChildSubchannel(
690
+ subchannel_node->uuid());
691
+ chand_->subchannel_refcount_map_.erase(it);
692
+ }
693
+ }
694
+ }
695
+ WeakUnref(DEBUG_LOCATION, "subchannel map cleanup");
696
+ },
697
+ DEBUG_LOCATION);
698
+ }
699
+
544
700
  void WatchConnectivityState(
545
701
  std::unique_ptr<ConnectivityStateWatcherInterface> watcher) override
546
702
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
@@ -608,13 +764,17 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
608
764
  : watcher_(std::move(watcher)), parent_(std::move(parent)) {}
609
765
 
610
766
  ~WatcherWrapper() override {
611
- auto* parent = parent_.release(); // ref owned by lambda
612
- parent->chand_->work_serializer_->Run(
613
- [parent]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(
614
- *parent_->chand_->work_serializer_) {
615
- parent->Unref(DEBUG_LOCATION, "WatcherWrapper");
616
- },
617
- DEBUG_LOCATION);
767
+ if (!IsWorkSerializerDispatchEnabled()) {
768
+ auto* parent = parent_.release(); // ref owned by lambda
769
+ parent->chand_->work_serializer_->Run(
770
+ [parent]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(
771
+ *parent_->chand_->work_serializer_) {
772
+ parent->Unref(DEBUG_LOCATION, "WatcherWrapper");
773
+ },
774
+ DEBUG_LOCATION);
775
+ return;
776
+ }
777
+ parent_.reset(DEBUG_LOCATION, "WatcherWrapper");
618
778
  }
619
779
 
620
780
  void OnConnectivityStateChange(
@@ -1013,14 +1173,18 @@ class ClientChannel::ClientChannelControlHelper
1013
1173
  ClientChannel* ClientChannel::GetFromChannel(Channel* channel) {
1014
1174
  grpc_channel_element* elem =
1015
1175
  grpc_channel_stack_last_element(channel->channel_stack());
1016
- if (elem->filter != &kFilterVtable) return nullptr;
1176
+ if (elem->filter != &kFilterVtableWithPromises &&
1177
+ elem->filter != &kFilterVtableWithoutPromises) {
1178
+ return nullptr;
1179
+ }
1017
1180
  return static_cast<ClientChannel*>(elem->channel_data);
1018
1181
  }
1019
1182
 
1020
1183
  grpc_error_handle ClientChannel::Init(grpc_channel_element* elem,
1021
1184
  grpc_channel_element_args* args) {
1022
1185
  GPR_ASSERT(args->is_last);
1023
- GPR_ASSERT(elem->filter == &kFilterVtable);
1186
+ GPR_ASSERT(elem->filter == &kFilterVtableWithPromises ||
1187
+ elem->filter == &kFilterVtableWithoutPromises);
1024
1188
  grpc_error_handle error;
1025
1189
  new (elem->channel_data) ClientChannel(args, &error);
1026
1190
  return error;
@@ -1053,7 +1217,8 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
1053
1217
  interested_parties_(grpc_pollset_set_create()),
1054
1218
  service_config_parser_index_(
1055
1219
  internal::ClientChannelServiceConfigParser::ParserIndex()),
1056
- work_serializer_(std::make_shared<WorkSerializer>()),
1220
+ work_serializer_(
1221
+ std::make_shared<WorkSerializer>(*args->channel_stack->event_engine)),
1057
1222
  state_tracker_("client_channel", GRPC_CHANNEL_IDLE),
1058
1223
  subchannel_pool_(GetSubchannelPool(channel_args_)) {
1059
1224
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
@@ -1136,6 +1301,21 @@ ClientChannel::~ClientChannel() {
1136
1301
  grpc_pollset_set_destroy(interested_parties_);
1137
1302
  }
1138
1303
 
1304
+ ArenaPromise<ServerMetadataHandle> ClientChannel::MakeCallPromise(
1305
+ grpc_channel_element* elem, CallArgs call_args, NextPromiseFactory) {
1306
+ auto* chand = static_cast<ClientChannel*>(elem->channel_data);
1307
+ // TODO(roth): Is this the right lifetime story for calld?
1308
+ auto* calld = GetContext<Arena>()->ManagedNew<PromiseBasedCallData>(chand);
1309
+ return TrySeq(
1310
+ // Name resolution.
1311
+ calld->MakeNameResolutionPromise(std::move(call_args)),
1312
+ // Dynamic filter stack.
1313
+ [calld](CallArgs call_args) mutable {
1314
+ return calld->dynamic_filters()->channel_stack()->MakeClientCallPromise(
1315
+ std::move(call_args));
1316
+ });
1317
+ }
1318
+
1139
1319
  OrphanablePtr<ClientChannel::FilterBasedLoadBalancedCall>
1140
1320
  ClientChannel::CreateLoadBalancedCall(
1141
1321
  const grpc_call_element_args& args, grpc_polling_entity* pollent,
@@ -1147,6 +1327,16 @@ ClientChannel::CreateLoadBalancedCall(
1147
1327
  std::move(on_commit), is_transparent_retry));
1148
1328
  }
1149
1329
 
1330
+ ArenaPromise<ServerMetadataHandle> ClientChannel::CreateLoadBalancedCallPromise(
1331
+ CallArgs call_args, absl::AnyInvocable<void()> on_commit,
1332
+ bool is_transparent_retry) {
1333
+ OrphanablePtr<PromiseBasedLoadBalancedCall> lb_call(
1334
+ GetContext<Arena>()->New<PromiseBasedLoadBalancedCall>(
1335
+ this, std::move(on_commit), is_transparent_retry));
1336
+ auto* call_ptr = lb_call.get();
1337
+ return call_ptr->MakeCallPromise(std::move(call_args), std::move(lb_call));
1338
+ }
1339
+
1150
1340
  ChannelArgs ClientChannel::MakeSubchannelArgs(
1151
1341
  const ChannelArgs& channel_args, const ChannelArgs& address_args,
1152
1342
  const RefCountedPtr<SubchannelPoolInterface>& subchannel_pool,
@@ -1588,6 +1778,10 @@ void ClientChannel::DestroyResolverAndLbPolicyLocked() {
1588
1778
  void ClientChannel::UpdateStateLocked(grpc_connectivity_state state,
1589
1779
  const absl::Status& status,
1590
1780
  const char* reason) {
1781
+ if (state != GRPC_CHANNEL_SHUTDOWN &&
1782
+ state_tracker_.state() == GRPC_CHANNEL_SHUTDOWN) {
1783
+ Crash("Illegal transition SHUTDOWN -> anything");
1784
+ }
1591
1785
  state_tracker_.SetState(state, status, reason);
1592
1786
  if (channelz_node_ != nullptr) {
1593
1787
  channelz_node_->SetConnectivityState(state);
@@ -1610,7 +1804,7 @@ void ClientChannel::UpdateStateAndPickerLocked(
1610
1804
  MutexLock lock(&lb_mu_);
1611
1805
  picker_.swap(picker);
1612
1806
  // Reprocess queued picks.
1613
- for (LoadBalancedCall* call : lb_queued_calls_) {
1807
+ for (auto& call : lb_queued_calls_) {
1614
1808
  call->RemoveCallFromLbQueuedCallsLocked();
1615
1809
  call->RetryPickLocked();
1616
1810
  }
@@ -1784,10 +1978,12 @@ void ClientChannel::GetChannelInfo(grpc_channel_element* elem,
1784
1978
  }
1785
1979
 
1786
1980
  void ClientChannel::TryToConnectLocked() {
1787
- if (lb_policy_ != nullptr) {
1788
- lb_policy_->ExitIdleLocked();
1789
- } else if (resolver_ == nullptr) {
1790
- CreateResolverLocked();
1981
+ if (disconnect_error_.ok()) {
1982
+ if (lb_policy_ != nullptr) {
1983
+ lb_policy_->ExitIdleLocked();
1984
+ } else if (resolver_ == nullptr) {
1985
+ CreateResolverLocked();
1986
+ }
1791
1987
  }
1792
1988
  GRPC_CHANNEL_STACK_UNREF(owning_stack_, "TryToConnect");
1793
1989
  }
@@ -1840,8 +2036,10 @@ void ClientChannel::CallData::RemoveCallFromResolverQueuedCallsLocked() {
1840
2036
 
1841
2037
  void ClientChannel::CallData::AddCallToResolverQueuedCallsLocked() {
1842
2038
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
1843
- gpr_log(GPR_INFO, "chand=%p calld=%p: adding to resolver queued picks list",
1844
- chand(), this);
2039
+ gpr_log(
2040
+ GPR_INFO,
2041
+ "chand=%p calld=%p: adding to resolver queued picks list; pollent=%s",
2042
+ chand(), this, grpc_polling_entity_string(pollent()).c_str());
1845
2043
  }
1846
2044
  // Add call's pollent to channel's interested_parties, so that I/O
1847
2045
  // can be done under the call's CQ.
@@ -1914,7 +2112,7 @@ absl::optional<absl::Status> ClientChannel::CallData::CheckResolution(
1914
2112
  // We have a result. Apply service config to call.
1915
2113
  grpc_error_handle error = ApplyServiceConfigToCallLocked(config_selector);
1916
2114
  // ConfigSelector must be unreffed inside the WorkSerializer.
1917
- if (config_selector.ok()) {
2115
+ if (!IsWorkSerializerDispatchEnabled() && config_selector.ok()) {
1918
2116
  chand()->work_serializer_->Run(
1919
2117
  [config_selector = std::move(*config_selector)]() mutable {
1920
2118
  config_selector.reset();
@@ -2351,8 +2549,7 @@ void ClientChannel::FilterBasedCallData::
2351
2549
  auto* calld = static_cast<FilterBasedCallData*>(arg);
2352
2550
  auto* chand = calld->chand();
2353
2551
  auto* service_config_call_data =
2354
- static_cast<ClientChannelServiceConfigCallData*>(
2355
- calld->call_context()[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
2552
+ GetServiceConfigCallData(calld->call_context());
2356
2553
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
2357
2554
  gpr_log(GPR_INFO,
2358
2555
  "chand=%p calld=%p: got recv_trailing_metadata_ready: error=%s "
@@ -2470,8 +2667,8 @@ class ClientChannel::LoadBalancedCall::Metadata
2470
2667
  ServiceConfigCallData::CallAttributeInterface*
2471
2668
  ClientChannel::LoadBalancedCall::LbCallState::GetCallAttribute(
2472
2669
  UniqueTypeName type) const {
2473
- auto* service_config_call_data = static_cast<ServiceConfigCallData*>(
2474
- lb_call_->call_context()[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
2670
+ auto* service_config_call_data =
2671
+ GetServiceConfigCallData(lb_call_->call_context());
2475
2672
  return service_config_call_data->GetCallAttribute(type);
2476
2673
  }
2477
2674
 
@@ -2559,16 +2756,6 @@ ClientChannel::LoadBalancedCall::~LoadBalancedCall() {
2559
2756
  }
2560
2757
  }
2561
2758
 
2562
- void ClientChannel::LoadBalancedCall::Orphan() {
2563
- // Compute latency and report it to the tracer.
2564
- if (call_attempt_tracer() != nullptr) {
2565
- gpr_timespec latency =
2566
- gpr_cycle_counter_sub(gpr_get_cycle_counter(), lb_call_start_time_);
2567
- call_attempt_tracer()->RecordEnd(latency);
2568
- }
2569
- Unref();
2570
- }
2571
-
2572
2759
  void ClientChannel::LoadBalancedCall::RecordCallCompletion(
2573
2760
  absl::Status status, grpc_metadata_batch* recv_trailing_metadata,
2574
2761
  grpc_transport_stream_stats* transport_stream_stats,
@@ -2590,6 +2777,15 @@ void ClientChannel::LoadBalancedCall::RecordCallCompletion(
2590
2777
  }
2591
2778
  }
2592
2779
 
2780
+ void ClientChannel::LoadBalancedCall::RecordLatency() {
2781
+ // Compute latency and report it to the tracer.
2782
+ if (call_attempt_tracer() != nullptr) {
2783
+ gpr_timespec latency =
2784
+ gpr_cycle_counter_sub(gpr_get_cycle_counter(), lb_call_start_time_);
2785
+ call_attempt_tracer()->RecordEnd(latency);
2786
+ }
2787
+ }
2788
+
2593
2789
  void ClientChannel::LoadBalancedCall::RemoveCallFromLbQueuedCallsLocked() {
2594
2790
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
2595
2791
  gpr_log(GPR_INFO, "chand=%p lb_call=%p: removing from queued picks list",
@@ -2614,7 +2810,7 @@ void ClientChannel::LoadBalancedCall::AddCallToLbQueuedCallsLocked() {
2614
2810
  grpc_polling_entity_add_to_pollset_set(pollent(),
2615
2811
  chand_->interested_parties_);
2616
2812
  // Add to queue.
2617
- chand_->lb_queued_calls_.insert(this);
2813
+ chand_->lb_queued_calls_.insert(Ref());
2618
2814
  OnAddToQueueLocked();
2619
2815
  }
2620
2816
 
@@ -2626,6 +2822,7 @@ absl::optional<absl::Status> ClientChannel::LoadBalancedCall::PickSubchannel(
2626
2822
  // We need to unref pickers in the WorkSerializer.
2627
2823
  std::vector<RefCountedPtr<LoadBalancingPolicy::SubchannelPicker>> pickers;
2628
2824
  auto cleanup = absl::MakeCleanup([&]() {
2825
+ if (IsWorkSerializerDispatchEnabled()) return;
2629
2826
  chand_->work_serializer_->Run(
2630
2827
  [pickers = std::move(pickers)]() mutable {
2631
2828
  for (auto& picker : pickers) {
@@ -2634,14 +2831,29 @@ absl::optional<absl::Status> ClientChannel::LoadBalancedCall::PickSubchannel(
2634
2831
  },
2635
2832
  DEBUG_LOCATION);
2636
2833
  });
2834
+ absl::AnyInvocable<void(RefCountedPtr<LoadBalancingPolicy::SubchannelPicker>)>
2835
+ set_picker;
2836
+ if (!IsWorkSerializerDispatchEnabled()) {
2837
+ set_picker =
2838
+ [&](RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker) {
2839
+ pickers.emplace_back(std::move(picker));
2840
+ };
2841
+ } else {
2842
+ pickers.emplace_back();
2843
+ set_picker =
2844
+ [&](RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker) {
2845
+ pickers[0] = std::move(picker);
2846
+ };
2847
+ }
2637
2848
  // Grab mutex and take a ref to the picker.
2638
2849
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
2639
2850
  gpr_log(GPR_INFO, "chand=%p lb_call=%p: grabbing LB mutex to get picker",
2640
2851
  chand_, this);
2641
2852
  }
2853
+ RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker;
2642
2854
  {
2643
2855
  MutexLock lock(&chand_->lb_mu_);
2644
- pickers.emplace_back(chand_->picker_);
2856
+ set_picker(chand_->picker_);
2645
2857
  }
2646
2858
  while (true) {
2647
2859
  // Do pick.
@@ -2652,15 +2864,20 @@ absl::optional<absl::Status> ClientChannel::LoadBalancedCall::PickSubchannel(
2652
2864
  grpc_error_handle error;
2653
2865
  bool pick_complete = PickSubchannelImpl(pickers.back().get(), &error);
2654
2866
  if (!pick_complete) {
2867
+ RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> old_picker;
2655
2868
  MutexLock lock(&chand_->lb_mu_);
2656
2869
  // If picker has been swapped out since we grabbed it, try again.
2657
- if (chand_->picker_ != pickers.back()) {
2870
+ if (pickers.back() != chand_->picker_) {
2658
2871
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
2659
2872
  gpr_log(GPR_INFO,
2660
2873
  "chand=%p lb_call=%p: pick not complete, but picker changed",
2661
2874
  chand_, this);
2662
2875
  }
2663
- pickers.emplace_back(chand_->picker_);
2876
+ if (IsWorkSerializerDispatchEnabled()) {
2877
+ // Don't unref until after we release the mutex.
2878
+ old_picker = std::move(pickers.back());
2879
+ }
2880
+ set_picker(chand_->picker_);
2664
2881
  continue;
2665
2882
  }
2666
2883
  // Otherwise queue the pick to try again later when we get a new picker.
@@ -2813,6 +3030,7 @@ void ClientChannel::FilterBasedLoadBalancedCall::Orphan() {
2813
3030
  RecordCallCompletion(absl::CancelledError("call cancelled"), nullptr,
2814
3031
  nullptr, "");
2815
3032
  }
3033
+ RecordLatency();
2816
3034
  // Delegate to parent.
2817
3035
  LoadBalancedCall::Orphan();
2818
3036
  }
@@ -3153,7 +3371,7 @@ class ClientChannel::FilterBasedLoadBalancedCall::LbQueuedCallCanceller {
3153
3371
  // Remove pick from list of queued picks.
3154
3372
  lb_call->RemoveCallFromLbQueuedCallsLocked();
3155
3373
  // Remove from queued picks list.
3156
- chand->lb_queued_calls_.erase(lb_call);
3374
+ chand->lb_queued_calls_.erase(self->lb_call_);
3157
3375
  // Fail pending batches on the call.
3158
3376
  lb_call->PendingBatchesFail(error,
3159
3377
  YieldCallCombinerIfPendingBatchesFound);
@@ -3243,4 +3461,152 @@ void ClientChannel::FilterBasedLoadBalancedCall::CreateSubchannelCall() {
3243
3461
  }
3244
3462
  }
3245
3463
 
3464
+ //
3465
+ // ClientChannel::PromiseBasedLoadBalancedCall
3466
+ //
3467
+
3468
+ ClientChannel::PromiseBasedLoadBalancedCall::PromiseBasedLoadBalancedCall(
3469
+ ClientChannel* chand, absl::AnyInvocable<void()> on_commit,
3470
+ bool is_transparent_retry)
3471
+ : LoadBalancedCall(chand, GetContext<grpc_call_context_element>(),
3472
+ std::move(on_commit), is_transparent_retry) {}
3473
+
3474
+ ArenaPromise<ServerMetadataHandle>
3475
+ ClientChannel::PromiseBasedLoadBalancedCall::MakeCallPromise(
3476
+ CallArgs call_args, OrphanablePtr<PromiseBasedLoadBalancedCall> lb_call) {
3477
+ pollent_ = NowOrNever(call_args.polling_entity->WaitAndCopy()).value();
3478
+ // Record ops in tracer.
3479
+ if (call_attempt_tracer() != nullptr) {
3480
+ call_attempt_tracer()->RecordSendInitialMetadata(
3481
+ call_args.client_initial_metadata.get());
3482
+ // TODO(ctiller): Find a way to do this without registering a no-op mapper.
3483
+ call_args.client_to_server_messages->InterceptAndMapWithHalfClose(
3484
+ [](MessageHandle message) { return message; }, // No-op.
3485
+ [this]() {
3486
+ // TODO(roth): Change CallTracer API to not pass metadata
3487
+ // batch to this method, since the batch is always empty.
3488
+ grpc_metadata_batch metadata(GetContext<Arena>());
3489
+ call_attempt_tracer()->RecordSendTrailingMetadata(&metadata);
3490
+ });
3491
+ }
3492
+ // Extract peer name from server initial metadata.
3493
+ call_args.server_initial_metadata->InterceptAndMap(
3494
+ [this](ServerMetadataHandle metadata) {
3495
+ if (call_attempt_tracer() != nullptr) {
3496
+ call_attempt_tracer()->RecordReceivedInitialMetadata(metadata.get());
3497
+ }
3498
+ Slice* peer_string = metadata->get_pointer(PeerString());
3499
+ if (peer_string != nullptr) peer_string_ = peer_string->Ref();
3500
+ return metadata;
3501
+ });
3502
+ client_initial_metadata_ = std::move(call_args.client_initial_metadata);
3503
+ return OnCancel(
3504
+ Map(TrySeq(
3505
+ // LB pick.
3506
+ [this]() -> Poll<absl::Status> {
3507
+ auto result = PickSubchannel(was_queued_);
3508
+ if (GRPC_TRACE_FLAG_ENABLED(
3509
+ grpc_client_channel_lb_call_trace)) {
3510
+ gpr_log(GPR_INFO,
3511
+ "chand=%p lb_call=%p: %sPickSubchannel() returns %s",
3512
+ chand(), this,
3513
+ Activity::current()->DebugTag().c_str(),
3514
+ result.has_value() ? result->ToString().c_str()
3515
+ : "Pending");
3516
+ }
3517
+ if (result == absl::nullopt) return Pending{};
3518
+ return std::move(*result);
3519
+ },
3520
+ [this, call_args = std::move(call_args)]() mutable
3521
+ -> ArenaPromise<ServerMetadataHandle> {
3522
+ call_args.client_initial_metadata =
3523
+ std::move(client_initial_metadata_);
3524
+ return connected_subchannel()->MakeCallPromise(
3525
+ std::move(call_args));
3526
+ }),
3527
+ // Record call completion.
3528
+ [this](ServerMetadataHandle metadata) {
3529
+ if (call_attempt_tracer() != nullptr ||
3530
+ lb_subchannel_call_tracker() != nullptr) {
3531
+ absl::Status status;
3532
+ grpc_status_code code = metadata->get(GrpcStatusMetadata())
3533
+ .value_or(GRPC_STATUS_UNKNOWN);
3534
+ if (code != GRPC_STATUS_OK) {
3535
+ absl::string_view message;
3536
+ if (const auto* grpc_message =
3537
+ metadata->get_pointer(GrpcMessageMetadata())) {
3538
+ message = grpc_message->as_string_view();
3539
+ }
3540
+ status =
3541
+ absl::Status(static_cast<absl::StatusCode>(code), message);
3542
+ }
3543
+ RecordCallCompletion(status, metadata.get(),
3544
+ &GetContext<CallContext>()
3545
+ ->call_stats()
3546
+ ->transport_stream_stats,
3547
+ peer_string_.as_string_view());
3548
+ }
3549
+ RecordLatency();
3550
+ return metadata;
3551
+ }),
3552
+ [lb_call = std::move(lb_call)]() {
3553
+ // If the waker is pending, then we need to remove ourself from
3554
+ // the list of queued LB calls.
3555
+ if (!lb_call->waker_.is_unwakeable()) {
3556
+ MutexLock lock(&lb_call->chand()->lb_mu_);
3557
+ lb_call->Commit();
3558
+ // Remove pick from list of queued picks.
3559
+ lb_call->RemoveCallFromLbQueuedCallsLocked();
3560
+ // Remove from queued picks list.
3561
+ lb_call->chand()->lb_queued_calls_.erase(lb_call.get());
3562
+ }
3563
+ // TODO(ctiller): We don't have access to the call's actual status
3564
+ // here, so we just assume CANCELLED. We could change this to use
3565
+ // CallFinalization instead of OnCancel() so that we can get the
3566
+ // actual status. But we should also have access to the trailing
3567
+ // metadata, which we don't have in either case. Ultimately, we
3568
+ // need a better story for code that needs to run at the end of a
3569
+ // call in both cancellation and non-cancellation cases that needs
3570
+ // access to server trailing metadata and the call's real status.
3571
+ if (lb_call->call_attempt_tracer() != nullptr) {
3572
+ lb_call->call_attempt_tracer()->RecordCancel(
3573
+ absl::CancelledError("call cancelled"));
3574
+ }
3575
+ if (lb_call->call_attempt_tracer() != nullptr ||
3576
+ lb_call->lb_subchannel_call_tracker() != nullptr) {
3577
+ // If we were cancelled without recording call completion, then
3578
+ // record call completion here, as best we can. We assume status
3579
+ // CANCELLED in this case.
3580
+ lb_call->RecordCallCompletion(absl::CancelledError("call cancelled"),
3581
+ nullptr, nullptr, "");
3582
+ }
3583
+ });
3584
+ }
3585
+
3586
+ Arena* ClientChannel::PromiseBasedLoadBalancedCall::arena() const {
3587
+ return GetContext<Arena>();
3588
+ }
3589
+
3590
+ grpc_call_context_element*
3591
+ ClientChannel::PromiseBasedLoadBalancedCall::call_context() const {
3592
+ return GetContext<grpc_call_context_element>();
3593
+ }
3594
+
3595
+ grpc_metadata_batch*
3596
+ ClientChannel::PromiseBasedLoadBalancedCall::send_initial_metadata() const {
3597
+ return client_initial_metadata_.get();
3598
+ }
3599
+
3600
+ void ClientChannel::PromiseBasedLoadBalancedCall::OnAddToQueueLocked() {
3601
+ waker_ = Activity::current()->MakeNonOwningWaker();
3602
+ was_queued_ = true;
3603
+ }
3604
+
3605
+ void ClientChannel::PromiseBasedLoadBalancedCall::RetryPickLocked() {
3606
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
3607
+ gpr_log(GPR_INFO, "chand=%p lb_call=%p: RetryPickLocked()", chand(), this);
3608
+ }
3609
+ waker_.WakeupAsync();
3610
+ }
3611
+
3246
3612
  } // namespace grpc_core