grpc 1.78.0 → 1.80.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +22 -8
  3. data/include/grpc/credentials.h +47 -37
  4. data/include/grpc/credentials_cpp.h +39 -0
  5. data/include/grpc/event_engine/event_engine.h +8 -3
  6. data/include/grpc/grpc.h +4 -0
  7. data/include/grpc/impl/call.h +9 -0
  8. data/include/grpc/impl/channel_arg_names.h +7 -0
  9. data/include/grpc/module.modulemap +2 -0
  10. data/include/grpc/private_key_signer.h +104 -0
  11. data/include/grpc/support/port_platform.h +6 -0
  12. data/src/core/call/call_filters.h +101 -78
  13. data/src/core/call/call_spine.h +91 -68
  14. data/src/core/call/call_state.h +60 -4
  15. data/src/core/call/client_call.cc +9 -9
  16. data/src/core/call/client_call.h +1 -1
  17. data/src/core/call/metadata_batch.cc +2 -0
  18. data/src/core/call/metadata_batch.h +48 -1
  19. data/src/core/call/metadata_info.cc +35 -0
  20. data/src/core/call/metadata_info.h +2 -0
  21. data/src/core/call/simple_slice_based_metadata.h +2 -1
  22. data/src/core/channelz/channelz.cc +9 -6
  23. data/src/core/channelz/channelz.h +7 -4
  24. data/src/core/channelz/property_list.h +5 -0
  25. data/src/core/channelz/v2tov1/convert.cc +1 -1
  26. data/src/core/channelz/v2tov1/legacy_api.cc +164 -307
  27. data/src/core/client_channel/buffered_call.cc +7 -3
  28. data/src/core/client_channel/buffered_call.h +11 -5
  29. data/src/core/client_channel/client_channel.cc +106 -44
  30. data/src/core/client_channel/client_channel.h +3 -6
  31. data/src/core/client_channel/client_channel_filter.cc +90 -64
  32. data/src/core/client_channel/client_channel_filter.h +3 -6
  33. data/src/core/client_channel/client_channel_internal.h +5 -0
  34. data/src/core/client_channel/config_selector.h +17 -12
  35. data/src/core/client_channel/dynamic_filters.cc +8 -7
  36. data/src/core/client_channel/dynamic_filters.h +7 -5
  37. data/src/core/client_channel/retry_filter.cc +1 -1
  38. data/src/core/client_channel/retry_filter.h +2 -2
  39. data/src/core/client_channel/subchannel.cc +1682 -266
  40. data/src/core/client_channel/subchannel.h +411 -134
  41. data/src/core/client_channel/subchannel_stream_client.cc +22 -18
  42. data/src/core/client_channel/subchannel_stream_client.h +8 -9
  43. data/src/core/client_channel/subchannel_stream_limiter.cc +76 -0
  44. data/src/core/client_channel/subchannel_stream_limiter.h +51 -0
  45. data/src/core/config/config_vars.cc +9 -1
  46. data/src/core/config/config_vars.h +6 -0
  47. data/src/core/credentials/call/call_creds_registry.h +51 -22
  48. data/src/core/credentials/call/call_creds_registry_init.cc +86 -2
  49. data/src/core/credentials/call/external/aws_external_account_credentials.cc +2 -2
  50. data/src/core/credentials/call/external/external_account_credentials.cc +11 -4
  51. data/src/core/credentials/call/external/file_external_account_credentials.cc +2 -2
  52. data/src/core/credentials/transport/channel_creds_registry.h +71 -20
  53. data/src/core/credentials/transport/channel_creds_registry_init.cc +338 -29
  54. data/src/core/credentials/transport/ssl/ssl_credentials.cc +43 -24
  55. data/src/core/credentials/transport/ssl/ssl_credentials.h +7 -1
  56. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +2 -8
  57. data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -3
  58. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +25 -5
  59. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +7 -5
  60. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +181 -109
  61. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +55 -42
  62. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +28 -23
  63. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +26 -23
  64. data/src/core/credentials/transport/tls/spiffe_utils.cc +2 -2
  65. data/src/core/credentials/transport/tls/ssl_utils.cc +18 -18
  66. data/src/core/credentials/transport/tls/ssl_utils.h +12 -10
  67. data/src/core/credentials/transport/tls/tls_security_connector.cc +106 -74
  68. data/src/core/credentials/transport/tls/tls_security_connector.h +12 -8
  69. data/src/core/credentials/transport/xds/xds_credentials.cc +76 -32
  70. data/src/core/credentials/transport/xds/xds_credentials.h +4 -2
  71. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +117 -35
  72. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +42 -4
  73. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +58 -29
  74. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +19 -11
  75. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +82 -25
  76. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +28 -3
  77. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +9 -7
  78. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +1 -1
  79. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +7 -1
  80. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +117 -67
  81. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
  82. data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -1
  83. data/src/core/ext/transport/chttp2/transport/frame.cc +2 -15
  84. data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
  85. data/src/core/ext/transport/chttp2/transport/goaway.cc +17 -2
  86. data/src/core/ext/transport/chttp2/transport/goaway.h +27 -6
  87. data/src/core/ext/transport/chttp2/transport/header_assembler.h +8 -21
  88. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +101 -40
  89. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +95 -0
  90. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +923 -772
  91. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +406 -423
  92. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -0
  93. data/src/core/ext/transport/chttp2/transport/http2_settings.h +8 -1
  94. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +25 -13
  95. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +71 -24
  96. data/src/core/ext/transport/chttp2/transport/http2_transport.h +25 -49
  97. data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +2 -2
  98. data/src/core/ext/transport/chttp2/transport/incoming_metadata_tracker.h +29 -9
  99. data/src/core/ext/transport/chttp2/transport/internal.h +6 -2
  100. data/src/core/ext/transport/chttp2/transport/keepalive.cc +14 -20
  101. data/src/core/ext/transport/chttp2/transport/keepalive.h +9 -6
  102. data/src/core/ext/transport/chttp2/transport/parsing.cc +11 -0
  103. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +34 -74
  104. data/src/core/ext/transport/chttp2/transport/ping_promise.h +123 -79
  105. data/src/core/ext/transport/chttp2/transport/security_frame.h +233 -3
  106. data/src/core/ext/transport/chttp2/transport/stream.h +152 -73
  107. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +155 -85
  108. data/src/core/ext/transport/chttp2/transport/transport_common.h +0 -5
  109. data/src/core/ext/transport/chttp2/transport/writable_streams.h +8 -7
  110. data/src/core/ext/transport/chttp2/transport/write_cycle.cc +86 -0
  111. data/src/core/ext/transport/chttp2/transport/write_cycle.h +355 -0
  112. data/src/core/ext/transport/chttp2/transport/writing.cc +31 -29
  113. data/src/core/ext/upb-gen/cel/expr/checked.upb.h +1875 -0
  114. data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.c +409 -0
  115. data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.h +56 -0
  116. data/src/core/ext/upb-gen/cel/expr/syntax.upb.h +2223 -0
  117. data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.c +489 -0
  118. data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.h +60 -0
  119. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +2 -1
  120. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +130 -18
  121. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +18 -13
  122. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +70 -38
  123. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +20 -17
  124. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +26 -10
  125. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +8 -7
  126. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb.h +495 -0
  127. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.c +114 -0
  128. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.h +36 -0
  129. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +26 -10
  130. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +8 -7
  131. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb.h +121 -0
  132. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.c +54 -0
  133. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.h +32 -0
  134. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +143 -9
  135. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +18 -6
  136. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +112 -11
  137. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +22 -9
  138. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb.h +276 -0
  139. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.c +60 -5
  140. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.h +4 -0
  141. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +72 -0
  142. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +23 -2
  143. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.h +2 -0
  144. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +129 -13
  145. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +36 -10
  146. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +2 -0
  147. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +30 -0
  148. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +5 -3
  149. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +16 -0
  150. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -3
  151. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +31 -0
  152. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +5 -3
  153. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
  154. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +63 -0
  155. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +12 -7
  156. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +97 -81
  157. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +40 -23
  158. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +604 -228
  159. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +146 -100
  160. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +30 -0
  161. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +5 -3
  162. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +35 -3
  163. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +7 -4
  164. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +66 -14
  165. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +22 -11
  166. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +87 -0
  167. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.c +29 -2
  168. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.h +2 -0
  169. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +0 -1
  170. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +0 -1
  171. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +20 -4
  172. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +5 -4
  173. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +239 -60
  174. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +59 -28
  175. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +2 -0
  176. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h +89 -0
  177. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.c +50 -0
  178. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.h +32 -0
  179. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb.h +135 -0
  180. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.c +53 -0
  181. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.h +32 -0
  182. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb.h +105 -0
  183. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.c +51 -0
  184. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.h +32 -0
  185. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +32 -0
  186. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +6 -3
  187. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +206 -0
  188. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +41 -8
  189. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +2 -0
  190. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +64 -0
  191. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +4 -3
  192. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +64 -0
  193. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.c +31 -5
  194. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.h +2 -0
  195. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +283 -14
  196. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +48 -11
  197. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +2 -0
  198. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +144 -6
  199. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +35 -7
  200. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.h +2 -0
  201. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +42 -21
  202. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +9 -8
  203. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +164 -1
  204. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +37 -6
  205. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +2 -0
  206. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +0 -1
  207. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +0 -1
  208. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb.h +0 -1
  209. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.c +0 -1
  210. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +26 -11
  211. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +8 -8
  212. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +33 -0
  213. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.c +14 -3
  214. data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +90 -10
  215. data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.c +18 -7
  216. data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.c +248 -0
  217. data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.h +97 -0
  218. data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.c +283 -0
  219. data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.h +107 -0
  220. data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.c +213 -211
  221. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +635 -614
  222. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +1012 -1000
  223. data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.c +276 -273
  224. data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.c +152 -0
  225. data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.h +47 -0
  226. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +149 -144
  227. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +367 -370
  228. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.c +63 -0
  229. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.h +37 -0
  230. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.c +297 -284
  231. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +492 -469
  232. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.c +74 -43
  233. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.h +10 -0
  234. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.c +60 -59
  235. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +202 -184
  236. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +5 -0
  237. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +354 -339
  238. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -0
  239. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +28 -19
  240. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.c +30 -27
  241. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +71 -66
  242. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +94 -91
  243. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +386 -369
  244. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.c +60 -57
  245. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +1974 -1884
  246. data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.c +119 -112
  247. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +62 -51
  248. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +109 -88
  249. data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +54 -36
  250. data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +5 -0
  251. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +78 -84
  252. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +48 -46
  253. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +1041 -984
  254. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  255. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +304 -290
  256. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +94 -77
  257. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +5 -0
  258. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +246 -193
  259. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +5 -0
  260. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.c +37 -23
  261. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.h +5 -0
  262. data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.c +5 -3
  263. data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.c +4 -4
  264. data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.c +4 -5
  265. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +113 -87
  266. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +5 -0
  267. data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.c +5 -5
  268. data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.c +6 -5
  269. data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.c +5 -5
  270. data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.c +5 -5
  271. data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.c +5 -5
  272. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.c +25 -30
  273. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.c +14 -20
  274. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.c +180 -183
  275. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.c +56 -47
  276. data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.c +69 -47
  277. data/src/core/filter/filter_chain.h +95 -0
  278. data/src/core/handshaker/http_connect/{http_connect_handshaker.cc → http_connect_client_handshaker.cc} +32 -31
  279. data/src/core/handshaker/http_connect/{http_connect_handshaker.h → http_connect_client_handshaker.h} +4 -4
  280. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +1 -1
  281. data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +1 -1
  282. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +14 -13
  283. data/src/core/handshaker/security/secure_endpoint.cc +282 -68
  284. data/src/core/handshaker/security/secure_endpoint.h +0 -7
  285. data/src/core/lib/channel/channel_args.h +1 -1
  286. data/src/core/lib/channel/promise_based_filter.cc +17 -4
  287. data/src/core/lib/channel/promise_based_filter.h +3 -2
  288. data/src/core/lib/debug/trace_flags.cc +2 -0
  289. data/src/core/lib/debug/trace_flags.h +1 -0
  290. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +35 -8
  291. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +1 -2
  292. data/src/core/lib/event_engine/event_engine.cc +9 -0
  293. data/src/core/lib/event_engine/extensions/tcp_trace.h +0 -3
  294. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +2 -2
  295. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +1 -1
  296. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +34 -9
  297. data/src/core/lib/event_engine/posix_engine/posix_engine.h +24 -2
  298. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -3
  299. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +141 -14
  300. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +19 -2
  301. data/src/core/lib/event_engine/posix_engine/posix_interface.h +7 -0
  302. data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +21 -3
  303. data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +16 -0
  304. data/src/core/lib/experiments/experiments.cc +309 -201
  305. data/src/core/lib/experiments/experiments.h +141 -80
  306. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
  307. data/src/core/lib/iomgr/resolve_address.h +0 -2
  308. data/src/core/lib/iomgr/resolved_address.h +0 -2
  309. data/src/core/lib/iomgr/tcp_posix.cc +13 -5
  310. data/src/core/lib/iomgr/tcp_server.cc +0 -5
  311. data/src/core/lib/iomgr/tcp_server.h +0 -7
  312. data/src/core/lib/iomgr/tcp_server_posix.cc +0 -17
  313. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -3
  314. data/src/core/lib/iomgr/tcp_server_windows.cc +12 -51
  315. data/src/core/lib/promise/all_ok.h +17 -12
  316. data/src/core/lib/promise/cancel_callback.h +12 -13
  317. data/src/core/lib/promise/detail/join_state.h +626 -0
  318. data/src/core/lib/promise/detail/promise_factory.h +14 -14
  319. data/src/core/lib/promise/for_each.h +32 -8
  320. data/src/core/lib/promise/if.h +9 -7
  321. data/src/core/lib/promise/loop.h +18 -16
  322. data/src/core/lib/promise/map.h +54 -47
  323. data/src/core/lib/promise/mpsc.h +11 -10
  324. data/src/core/lib/promise/observable.h +6 -6
  325. data/src/core/lib/promise/party.h +25 -19
  326. data/src/core/lib/promise/poll.h +5 -5
  327. data/src/core/lib/promise/prioritized_race.h +10 -7
  328. data/src/core/lib/promise/promise.h +16 -11
  329. data/src/core/lib/promise/race.h +6 -5
  330. data/src/core/lib/promise/seq.h +109 -74
  331. data/src/core/lib/promise/try_join.h +14 -6
  332. data/src/core/lib/promise/try_seq.h +76 -60
  333. data/src/core/lib/resource_quota/api.cc +7 -0
  334. data/src/core/lib/resource_quota/arena.h +1 -1
  335. data/src/core/lib/resource_quota/memory_quota.cc +4 -1
  336. data/src/core/lib/resource_quota/resource_quota.cc +2 -1
  337. data/src/core/lib/resource_quota/resource_quota.h +3 -0
  338. data/src/core/lib/resource_quota/stream_quota.cc +77 -1
  339. data/src/core/lib/resource_quota/stream_quota.h +64 -1
  340. data/src/core/lib/resource_quota/telemetry.h +1 -1
  341. data/src/core/lib/surface/call.cc +13 -0
  342. data/src/core/lib/surface/call_utils.h +58 -43
  343. data/src/core/lib/surface/channel.h +1 -4
  344. data/src/core/lib/surface/completion_queue.cc +13 -6
  345. data/src/core/lib/surface/validate_metadata.cc +20 -15
  346. data/src/core/lib/surface/validate_metadata.h +3 -1
  347. data/src/core/lib/surface/version.cc +2 -2
  348. data/src/core/lib/transport/promise_endpoint.cc +1 -1
  349. data/src/core/lib/transport/promise_endpoint.h +1 -1
  350. data/src/core/lib/transport/transport.h +5 -0
  351. data/src/core/load_balancing/health_check_client.cc +1 -15
  352. data/src/core/load_balancing/health_check_client_internal.h +0 -2
  353. data/src/core/load_balancing/oob_backend_metric.cc +1 -5
  354. data/src/core/load_balancing/oob_backend_metric_internal.h +0 -1
  355. data/src/core/load_balancing/xds/xds_cluster_impl.cc +12 -9
  356. data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -2
  357. data/src/core/resolver/xds/xds_resolver.cc +162 -116
  358. data/src/core/server/server.cc +18 -1
  359. data/src/core/server/server.h +2 -0
  360. data/src/core/server/xds_server_config_fetcher.cc +4 -4
  361. data/src/core/telemetry/call_tracer.cc +87 -2
  362. data/src/core/telemetry/call_tracer.h +46 -8
  363. data/src/core/telemetry/instrument.cc +102 -40
  364. data/src/core/telemetry/instrument.h +246 -65
  365. data/src/core/tsi/fake_transport_security.cc +3 -1
  366. data/src/core/tsi/ssl_transport_security.cc +516 -137
  367. data/src/core/tsi/ssl_transport_security.h +28 -22
  368. data/src/core/tsi/ssl_transport_security_utils.cc +2 -2
  369. data/src/core/tsi/ssl_transport_security_utils.h +2 -2
  370. data/src/core/util/bitset.h +6 -0
  371. data/src/core/util/function_signature.h +3 -1
  372. data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
  373. data/src/core/util/json/json_reader.cc +0 -4
  374. data/src/core/xds/grpc/certificate_provider_store.cc +2 -1
  375. data/src/core/xds/grpc/certificate_provider_store.h +3 -17
  376. data/src/core/xds/grpc/certificate_provider_store_interface.h +61 -0
  377. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +48 -0
  378. data/src/core/xds/grpc/xds_bootstrap_grpc.h +18 -0
  379. data/src/core/xds/grpc/xds_certificate_provider.cc +7 -2
  380. data/src/core/xds/grpc/xds_certificate_provider.h +13 -2
  381. data/src/core/xds/grpc/xds_client_grpc.cc +13 -6
  382. data/src/core/xds/grpc/xds_client_grpc.h +10 -7
  383. data/src/core/xds/grpc/xds_cluster.cc +18 -4
  384. data/src/core/xds/grpc/xds_cluster.h +17 -2
  385. data/src/core/xds/grpc/xds_cluster_parser.cc +36 -11
  386. data/src/core/xds/grpc/xds_common_types.cc +45 -0
  387. data/src/core/xds/grpc/xds_common_types.h +31 -0
  388. data/src/core/xds/grpc/xds_common_types_parser.cc +274 -16
  389. data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
  390. data/src/core/xds/grpc/xds_http_fault_filter.cc +128 -24
  391. data/src/core/xds/grpc/xds_http_fault_filter.h +19 -10
  392. data/src/core/xds/grpc/xds_http_filter.cc +38 -0
  393. data/src/core/xds/grpc/xds_http_filter.h +70 -47
  394. data/src/core/xds/grpc/xds_http_filter_registry.cc +48 -14
  395. data/src/core/xds/grpc/xds_http_filter_registry.h +29 -15
  396. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +88 -22
  397. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +22 -11
  398. data/src/core/xds/grpc/xds_http_rbac_filter.cc +36 -20
  399. data/src/core/xds/grpc/xds_http_rbac_filter.h +19 -10
  400. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +143 -26
  401. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +19 -10
  402. data/src/core/xds/grpc/xds_listener.cc +4 -1
  403. data/src/core/xds/grpc/xds_listener.h +10 -2
  404. data/src/core/xds/grpc/xds_listener_parser.cc +23 -18
  405. data/src/core/xds/grpc/xds_matcher.cc +40 -5
  406. data/src/core/xds/grpc/xds_matcher.h +13 -0
  407. data/src/core/xds/grpc/xds_matcher_action.h +1 -1
  408. data/src/core/xds/grpc/xds_matcher_parse.cc +60 -40
  409. data/src/core/xds/grpc/xds_matcher_parse.h +2 -1
  410. data/src/core/xds/grpc/xds_route_config.cc +12 -1
  411. data/src/core/xds/grpc/xds_route_config.h +15 -2
  412. data/src/core/xds/grpc/xds_route_config_parser.cc +11 -5
  413. data/src/core/xds/grpc/xds_routing.cc +181 -6
  414. data/src/core/xds/grpc/xds_routing.h +57 -0
  415. data/src/core/xds/grpc/xds_server_grpc.cc +55 -43
  416. data/src/core/xds/grpc/xds_server_grpc.h +13 -6
  417. data/src/core/xds/grpc/xds_server_grpc_interface.h +3 -2
  418. data/src/core/xds/grpc/xds_transport_grpc.cc +12 -6
  419. data/src/core/xds/grpc/xds_transport_grpc.h +5 -1
  420. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -8
  421. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +18 -12
  422. data/src/ruby/lib/grpc/grpc.rb +7 -9
  423. data/src/ruby/lib/grpc/version.rb +1 -1
  424. data/src/ruby/pb/generate_proto_ruby.sh +1 -1
  425. data/src/ruby/spec/client_server_spec.rb +1 -1
  426. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
  427. data/src/ruby/spec/generic/rpc_server_spec.rb +3 -4
  428. data/src/ruby/spec/spec_helper.rb +1 -1
  429. metadata +64 -14
  430. data/src/core/ext/transport/chttp2/transport/security_frame.cc +0 -31
  431. data/src/core/handshaker/security/legacy_secure_endpoint.cc +0 -597
@@ -419,7 +419,7 @@ class ArenaSpsc {
419
419
  T result = std::move(next->value);
420
420
  Destruct(&next->value);
421
421
  tail_.store(next, std::memory_order_release);
422
- return result;
422
+ return std::move(result);
423
423
  }
424
424
 
425
425
  T* Peek() {
@@ -31,6 +31,7 @@
31
31
  #include "src/core/channelz/channelz.h"
32
32
  #include "src/core/channelz/property_list.h"
33
33
  #include "src/core/lib/debug/trace.h"
34
+ #include "src/core/lib/iomgr/exec_ctx.h"
34
35
  #include "src/core/lib/promise/exec_ctx_wakeup_scheduler.h"
35
36
  #include "src/core/lib/promise/loop.h"
36
37
  #include "src/core/lib/promise/map.h"
@@ -557,7 +558,9 @@ void BasicMemoryQuota::Take(GrpcMemoryAllocatorImpl* allocator, size_t amount) {
557
558
  auto prior = free_bytes_.fetch_sub(amount, std::memory_order_acq_rel);
558
559
  // If we push into overcommit, awake the reclaimer.
559
560
  if (prior >= 0 && prior < static_cast<intptr_t>(amount)) {
560
- if (reclaimer_activity_ != nullptr) reclaimer_activity_->ForceWakeup();
561
+ if (reclaimer_activity_ != nullptr) {
562
+ EnsureRunInExecCtx([this]() { reclaimer_activity_->ForceWakeup(); });
563
+ }
561
564
  }
562
565
 
563
566
  if (IsFreeLargeAllocatorEnabled()) {
@@ -33,7 +33,8 @@ ResourceQuota::ResourceQuota(std::string name)
33
33
  : channelz_node_(
34
34
  MakeRefCounted<channelz::ResourceQuotaNode>(std::move(name))),
35
35
  memory_quota_(MakeMemoryQuota(channelz_node_)),
36
- thread_quota_(MakeRefCounted<ThreadQuota>()) {}
36
+ thread_quota_(MakeRefCounted<ThreadQuota>()),
37
+ stream_quota_(MakeRefCounted<StreamQuota>()) {}
37
38
 
38
39
  ResourceQuota::~ResourceQuota() = default;
39
40
 
@@ -53,6 +53,8 @@ class ResourceQuota : public RefCounted<ResourceQuota>,
53
53
 
54
54
  const RefCountedPtr<ThreadQuota>& thread_quota() { return thread_quota_; }
55
55
 
56
+ const RefCountedPtr<StreamQuota>& stream_quota() { return stream_quota_; }
57
+
56
58
  // The default global resource quota
57
59
  static ResourceQuotaRefPtr Default();
58
60
  static void TestOnlyResetDefaultResourceQuota();
@@ -66,6 +68,7 @@ class ResourceQuota : public RefCounted<ResourceQuota>,
66
68
  RefCountedPtr<channelz::ResourceQuotaNode> channelz_node_;
67
69
  MemoryQuotaRefPtr memory_quota_;
68
70
  RefCountedPtr<ThreadQuota> thread_quota_;
71
+ RefCountedPtr<StreamQuota> stream_quota_;
69
72
  };
70
73
 
71
74
  inline ResourceQuotaRefPtr MakeResourceQuota(std::string name) {
@@ -19,4 +19,80 @@
19
19
  #include <cstdint>
20
20
  #include <limits>
21
21
 
22
- namespace grpc_core {} // namespace grpc_core
22
+ namespace grpc_core {
23
+
24
+ void StreamQuota::SetMaxOutstandingStreams(
25
+ uint32_t new_max_outstanding_streams) {
26
+ limiter_.max_outstanding_requests.store(new_max_outstanding_streams,
27
+ std::memory_order_relaxed);
28
+ UpdatePerConnectionLimits();
29
+ }
30
+
31
+ uint32_t StreamQuota::GetPerConnectionMaxConcurrentRequests(
32
+ uint32_t current_open_requests) {
33
+ if (limiter_.max_outstanding_requests.load(std::memory_order_relaxed) ==
34
+ std::numeric_limits<uint32_t>::max()) {
35
+ return std::numeric_limits<uint32_t>::max();
36
+ }
37
+
38
+ limiter_.periodic_update.Tick(
39
+ [this](Duration) { UpdatePerConnectionLimits(); });
40
+ const uint64_t allowed_requests_per_channel =
41
+ limiter_.allowed_requests_per_channel.load(std::memory_order_relaxed);
42
+ const uint64_t target_mean_requests_per_channel =
43
+ limiter_.target_mean_requests_per_channel.load(std::memory_order_relaxed);
44
+
45
+ if (allowed_requests_per_channel == 0) {
46
+ // If there are open requests on this channel, but we're past capacity
47
+ // try to lower the number of requests here. This should slowly force
48
+ // ramping down to numbers we can cope with.
49
+ if (current_open_requests > 1) return current_open_requests - 1;
50
+ return 1;
51
+ }
52
+
53
+ // If there is only one channel, we can allow the target mean.
54
+ if (limiter_.open_channels.load(std::memory_order_relaxed) <= 1) {
55
+ return target_mean_requests_per_channel;
56
+ }
57
+
58
+ auto clamp = [](uint64_t x) {
59
+ return std::min<uint64_t>(x, std::numeric_limits<uint32_t>::max());
60
+ };
61
+ if (current_open_requests < target_mean_requests_per_channel) {
62
+ return std::min(clamp(current_open_requests + allowed_requests_per_channel),
63
+ target_mean_requests_per_channel);
64
+ } else if (current_open_requests < 2 * target_mean_requests_per_channel) {
65
+ return clamp(current_open_requests + 1);
66
+ } else {
67
+ return clamp(2 * target_mean_requests_per_channel);
68
+ }
69
+ }
70
+
71
+ void StreamQuota::UpdatePerConnectionLimits() {
72
+ int64_t outstanding_requests = 0;
73
+ int64_t open_channels =
74
+ limiter_.open_channels.load(std::memory_order_relaxed);
75
+ for (auto& stats : stats_) {
76
+ outstanding_requests +=
77
+ stats.outstanding_requests.load(std::memory_order_relaxed);
78
+ }
79
+ open_channels = std::max<int64_t>(1, open_channels);
80
+ outstanding_requests = std::max<int64_t>(0, outstanding_requests);
81
+ const int64_t max_outstanding_requests =
82
+ limiter_.max_outstanding_requests.load(std::memory_order_relaxed);
83
+ const int64_t allowed_requests_per_channel =
84
+ (max_outstanding_requests - outstanding_requests) / open_channels;
85
+ const uint64_t target_mean_requests_per_channel =
86
+ max_outstanding_requests / open_channels;
87
+ limiter_.allowed_requests_per_channel.store(
88
+ std::max<int64_t>(0, allowed_requests_per_channel),
89
+ std::memory_order_relaxed);
90
+ limiter_.target_mean_requests_per_channel.store(
91
+ target_mean_requests_per_channel, std::memory_order_relaxed);
92
+ }
93
+
94
+ void StreamQuota::UpdatePerConnectionLimitsForAllTestOnly() {
95
+ UpdatePerConnectionLimits();
96
+ }
97
+
98
+ } // namespace grpc_core
@@ -26,6 +26,69 @@
26
26
  #include "src/core/util/ref_counted.h"
27
27
  #include "src/core/util/ref_counted_ptr.h"
28
28
 
29
- namespace grpc_core {} // namespace grpc_core
29
+ namespace grpc_core {
30
+
31
+ // Tracks the amount of streams in a resource quota.
32
+ class StreamQuota : public RefCounted<StreamQuota> {
33
+ public:
34
+ StreamQuota() = default;
35
+ ~StreamQuota() override = default;
36
+
37
+ StreamQuota(const StreamQuota&) = delete;
38
+ StreamQuota& operator=(const StreamQuota&) = delete;
39
+
40
+ void IncrementOutstandingRequests() {
41
+ stats_.this_cpu().outstanding_requests.fetch_add(1,
42
+ std::memory_order_relaxed);
43
+ }
44
+
45
+ void DecrementOutstandingRequests() {
46
+ stats_.this_cpu().outstanding_requests.fetch_sub(1,
47
+ std::memory_order_relaxed);
48
+ }
49
+
50
+ void IncrementOpenChannels() {
51
+ limiter_.open_channels.fetch_add(1, std::memory_order_relaxed);
52
+ }
53
+
54
+ void DecrementOpenChannels() {
55
+ limiter_.open_channels.fetch_sub(1, std::memory_order_relaxed);
56
+ }
57
+
58
+ uint32_t GetConnectionMaxConcurrentRequests(uint32_t current_open_requests) {
59
+ return GetPerConnectionMaxConcurrentRequests(current_open_requests);
60
+ }
61
+
62
+ void SetMaxOutstandingStreams(uint32_t new_max_outstanding_streams);
63
+
64
+ void UpdatePerConnectionLimitsForAllTestOnly();
65
+
66
+ private:
67
+ uint32_t GetPerConnectionMaxConcurrentRequests(
68
+ uint32_t current_open_requests);
69
+
70
+ struct alignas(GPR_CACHELINE_SIZE) Statistics {
71
+ std::atomic<int64_t> outstanding_requests{0};
72
+ };
73
+ PerCpu<Statistics> stats_{PerCpuOptions()};
74
+
75
+ struct alignas(GPR_CACHELINE_SIZE) Limiter {
76
+ PeriodicUpdate periodic_update{Duration::Seconds(1)};
77
+ std::atomic<uint64_t> allowed_requests_per_channel{
78
+ std::numeric_limits<uint32_t>::max()};
79
+ std::atomic<uint64_t> target_mean_requests_per_channel{
80
+ std::numeric_limits<uint32_t>::max()};
81
+ std::atomic<uint64_t> max_outstanding_requests{
82
+ std::numeric_limits<uint32_t>::max()};
83
+ std::atomic<uint64_t> open_channels{0};
84
+ };
85
+ Limiter limiter_;
86
+
87
+ void UpdatePerConnectionLimits();
88
+ };
89
+
90
+ using StreamQuotaRefPtr = RefCountedPtr<StreamQuota>;
91
+
92
+ } // namespace grpc_core
30
93
 
31
94
  #endif // GRPC_SRC_CORE_LIB_RESOURCE_QUOTA_STREAM_QUOTA_H
@@ -21,9 +21,9 @@ namespace grpc_core {
21
21
 
22
22
  class ResourceQuotaDomain final : public InstrumentDomain<ResourceQuotaDomain> {
23
23
  public:
24
+ GRPC_INSTRUMENT_DOMAIN_LABELS("grpc.resource_quota");
24
25
  using Backend = HighContentionBackend;
25
26
  static constexpr absl::string_view kName = "resource_quota";
26
- static constexpr auto kLabels = Labels("grpc.resource_quota");
27
27
 
28
28
  static inline const auto kCallsDropped = RegisterCounter(
29
29
  "grpc.resource_quota.calls_dropped",
@@ -607,3 +607,16 @@ void grpc_call_run_in_event_engine(const grpc_call* call,
607
607
  ->GetContext<grpc_event_engine::experimental::EventEngine>()
608
608
  ->Run(std::move(cb));
609
609
  }
610
+
611
+ void grpc_call_run_cq_cb(const grpc_call* call,
612
+ absl::AnyInvocable<void()>&& cb) {
613
+ if (grpc_core::IsUseCallEventEngineInCompletionQueueEnabled()) {
614
+ grpc_call_run_in_event_engine(
615
+ call, [cb = std::forward<absl::AnyInvocable<void()>>(cb)]() mutable {
616
+ grpc_core::ExecCtx exec_ctx;
617
+ cb();
618
+ });
619
+ } else {
620
+ cb();
621
+ }
622
+ }
@@ -46,6 +46,7 @@
46
46
  #include "src/core/call/metadata.h"
47
47
  #include "src/core/call/metadata_batch.h"
48
48
  #include "src/core/channelz/property_list.h"
49
+ #include "src/core/lib/experiments/experiments.h"
49
50
  #include "src/core/lib/promise/activity.h"
50
51
  #include "src/core/lib/promise/cancel_callback.h"
51
52
  #include "src/core/lib/promise/detail/promise_like.h"
@@ -76,37 +77,48 @@ class PublishToAppEncoder {
76
77
  Append(key.c_slice(), value.c_slice());
77
78
  }
78
79
 
79
- // Catch anything that is not explicitly handled, and do not publish it to the
80
- // application. If new metadata is added to a batch that needs to be
81
- // published, it should be called out here.
80
+ // Publish only metadata traits that have kPublishToApp == true.
82
81
  template <typename Which>
83
- void Encode(Which, const typename Which::ValueType&) {}
84
-
85
- void Encode(UserAgentMetadata, const Slice& slice) {
86
- Append(UserAgentMetadata::key(), slice);
87
- }
88
-
89
- void Encode(HostMetadata, const Slice& slice) {
90
- Append(HostMetadata::key(), slice);
91
- }
92
-
93
- void Encode(GrpcPreviousRpcAttemptsMetadata, uint32_t count) {
94
- Append(GrpcPreviousRpcAttemptsMetadata::key(), count);
95
- }
96
-
97
- void Encode(GrpcRetryPushbackMsMetadata, Duration count) {
98
- Append(GrpcRetryPushbackMsMetadata::key(), count.millis());
99
- }
100
-
101
- void Encode(LbTokenMetadata, const Slice& slice) {
102
- Append(LbTokenMetadata::key(), slice);
82
+ void Encode(Which, const typename Which::ValueType& value) {
83
+ if (IsMetadataPublishToAppTagEnabled()) {
84
+ if constexpr (Which::kPublishToApp) {
85
+ Append(Which::key(), value);
86
+ }
87
+ } else {
88
+ if constexpr (std::is_same<UserAgentMetadata, Which>::value) {
89
+ Append(Which::key(), value);
90
+ }
91
+ if constexpr (std::is_same<HostMetadata, Which>::value) {
92
+ Append(Which::key(), value);
93
+ }
94
+ if constexpr (std::is_same<GrpcPreviousRpcAttemptsMetadata,
95
+ Which>::value) {
96
+ Append(Which::key(), value);
97
+ }
98
+ if constexpr (std::is_same<GrpcRetryPushbackMsMetadata, Which>::value) {
99
+ Append(Which::key(), value);
100
+ }
101
+ if constexpr (std::is_same<LbTokenMetadata, Which>::value) {
102
+ Append(Which::key(), value);
103
+ }
104
+ if constexpr (std::is_same<W3CTraceParentMetadata, Which>::value) {
105
+ Append(Which::key(), value);
106
+ }
107
+ if constexpr (std::is_same<XForwardedForMetadata, Which>::value) {
108
+ Append(Which::key(), value);
109
+ }
110
+ if constexpr (std::is_same<XForwardedHostMetadata, Which>::value) {
111
+ Append(Which::key(), value);
112
+ }
113
+ }
103
114
  }
104
115
 
105
- void Encode(W3CTraceParentMetadata, const Slice& slice) {
106
- Append(W3CTraceParentMetadata::key(), slice);
116
+ private:
117
+ void Append(absl::string_view key, Duration value) {
118
+ Append(StaticSlice::FromStaticString(key).c_slice(),
119
+ Slice::FromInt64(value.millis()).c_slice());
107
120
  }
108
121
 
109
- private:
110
122
  void Append(absl::string_view key, int64_t value) {
111
123
  Append(StaticSlice::FromStaticString(key).c_slice(),
112
124
  Slice::FromInt64(value).c_slice());
@@ -168,8 +180,9 @@ class OpHandlerImpl {
168
180
  "PromiseFactory must return a promise");
169
181
 
170
182
  OpHandlerImpl() : state_(State::kDismissed) {}
171
- explicit OpHandlerImpl(SetupResult result) : state_(State::kPromiseFactory) {
172
- Construct(&promise_factory_, std::move(result));
183
+ explicit OpHandlerImpl(SetupResult&& result)
184
+ : state_(State::kPromiseFactory) {
185
+ Construct(&promise_factory_, std::forward<SetupResult>(result));
173
186
  }
174
187
 
175
188
  ~OpHandlerImpl() {
@@ -274,8 +287,9 @@ class OpHandlerImpl {
274
287
  };
275
288
 
276
289
  template <grpc_op_type op_type, typename PromiseFactory>
277
- auto OpHandler(PromiseFactory setup) {
278
- return OpHandlerImpl<PromiseFactory, op_type>(std::move(setup));
290
+ auto OpHandler(PromiseFactory&& setup) {
291
+ return OpHandlerImpl<PromiseFactory, op_type>(
292
+ std::forward<PromiseFactory>(setup));
279
293
  }
280
294
 
281
295
  class BatchOpIndex {
@@ -329,7 +343,7 @@ class WaitForCqEndOp {
329
343
  grpc_completion_queue* cq;
330
344
  };
331
345
  struct Started {
332
- explicit Started(Waker waker) : waker(std::move(waker)) {}
346
+ explicit Started(Waker&& waker) : waker(std::forward<Waker>(waker)) {}
333
347
  Waker waker;
334
348
  grpc_cq_completion completion;
335
349
  std::atomic<bool> done{false};
@@ -388,7 +402,7 @@ class WaitForCqEndOp {
388
402
  };
389
403
 
390
404
  template <typename FalliblePart, typename FinalPart>
391
- auto InfallibleBatch(FalliblePart fallible_part, FinalPart final_part,
405
+ auto InfallibleBatch(FalliblePart&& fallible_part, FinalPart&& final_part,
392
406
  bool is_notify_tag_closure, void* notify_tag,
393
407
  grpc_completion_queue* cq) {
394
408
  // Perform fallible_part, then final_part, then wait for the
@@ -397,9 +411,9 @@ auto InfallibleBatch(FalliblePart fallible_part, FinalPart final_part,
397
411
  // There's a slight bug here in that if we cancel this promise after
398
412
  // the WaitForCqEndOp we'll double post -- but we don't currently do that.
399
413
  return OnCancelFactory(
400
- [fallible_part = std::move(fallible_part),
401
- final_part = std::move(final_part), is_notify_tag_closure, notify_tag,
402
- cq]() mutable {
414
+ [fallible_part = std::forward<FalliblePart>(fallible_part),
415
+ final_part = std::forward<FinalPart>(final_part), is_notify_tag_closure,
416
+ notify_tag, cq]() mutable {
403
417
  return LogPollBatch(notify_tag,
404
418
  Seq(std::move(fallible_part), std::move(final_part),
405
419
  [is_notify_tag_closure, notify_tag, cq]() {
@@ -417,15 +431,15 @@ auto InfallibleBatch(FalliblePart fallible_part, FinalPart final_part,
417
431
  }
418
432
 
419
433
  template <typename FalliblePart>
420
- auto FallibleBatch(FalliblePart fallible_part, bool is_notify_tag_closure,
434
+ auto FallibleBatch(FalliblePart&& fallible_part, bool is_notify_tag_closure,
421
435
  void* notify_tag, grpc_completion_queue* cq) {
422
436
  // Perform fallible_part, then wait for the completion queue to be done.
423
437
  // If cancelled, we'll ensure the completion queue is notified.
424
438
  // There's a slight bug here in that if we cancel this promise after
425
439
  // the WaitForCqEndOp we'll double post -- but we don't currently do that.
426
440
  return OnCancelFactory(
427
- [fallible_part = std::move(fallible_part), is_notify_tag_closure,
428
- notify_tag, cq]() mutable {
441
+ [fallible_part = std::forward<FalliblePart>(fallible_part),
442
+ is_notify_tag_closure, notify_tag, cq]() mutable {
429
443
  return LogPollBatch(
430
444
  notify_tag,
431
445
  Seq(std::move(fallible_part),
@@ -445,7 +459,7 @@ auto FallibleBatch(FalliblePart fallible_part, bool is_notify_tag_closure,
445
459
  template <typename F>
446
460
  class PollBatchLogger {
447
461
  public:
448
- PollBatchLogger(void* tag, F f) : tag_(tag), f_(std::move(f)) {}
462
+ PollBatchLogger(void* tag, F&& f) : tag_(tag), f_(std::forward<F>(f)) {}
449
463
 
450
464
  auto operator()() {
451
465
  GRPC_TRACE_LOG(call, INFO) << "Poll batch " << tag_;
@@ -474,8 +488,8 @@ class PollBatchLogger {
474
488
  };
475
489
 
476
490
  template <typename F>
477
- PollBatchLogger<F> LogPollBatch(void* tag, F f) {
478
- return PollBatchLogger<F>(tag, std::move(f));
491
+ PollBatchLogger<F> LogPollBatch(void* tag, F&& f) {
492
+ return PollBatchLogger<F>(tag, std::forward<F>(f));
479
493
  }
480
494
 
481
495
  class MessageReceiver {
@@ -497,8 +511,9 @@ class MessageReceiver {
497
511
  recv_message_ = op.data.recv_message.recv_message;
498
512
  return [this, puller]() mutable {
499
513
  return Map(puller->PullMessage(),
500
- [this](typename Puller::NextMessage msg) {
501
- return FinishRecvMessage(std::move(msg));
514
+ [this](typename Puller::NextMessage&& msg) {
515
+ return FinishRecvMessage(
516
+ std::forward<typename Puller::NextMessage>(msg));
502
517
  });
503
518
  };
504
519
  }
@@ -133,10 +133,7 @@ class Channel : public UnstartedCallDestination,
133
133
  }
134
134
 
135
135
  grpc_event_engine::experimental::MemoryAllocator* memory_allocator() const {
136
- if (IsTrackWritesInResourceQuotaEnabled()) {
137
- return memory_allocator_;
138
- }
139
- return nullptr;
136
+ return memory_allocator_;
140
137
  }
141
138
 
142
139
  protected:
@@ -33,11 +33,11 @@
33
33
  #include <vector>
34
34
 
35
35
  #include "src/core/lib/event_engine/shim.h"
36
+ #include "src/core/lib/experiments/experiments.h"
36
37
  #include "src/core/lib/iomgr/closure.h"
37
38
  #include "src/core/lib/iomgr/exec_ctx.h"
38
39
  #include "src/core/lib/iomgr/pollset.h"
39
40
  #include "src/core/lib/surface/event_string.h"
40
- #include "src/core/telemetry/stats.h"
41
41
  #include "src/core/telemetry/stats_data.h"
42
42
  #include "src/core/util/atomic_utils.h"
43
43
  #include "src/core/util/debug_location.h"
@@ -908,11 +908,18 @@ static void cq_end_op_for_callback(
908
908
  }
909
909
 
910
910
  auto* functor = static_cast<grpc_completion_queue_functor*>(tag);
911
- cqd->event_engine->Run(
912
- [engine = cqd->event_engine, functor, ok = error.ok()]() {
913
- grpc_core::ExecCtx exec_ctx;
914
- (*functor->functor_run)(functor, ok);
915
- });
911
+ if (grpc_core::IsUseCallEventEngineInCompletionQueueEnabled()) {
912
+ (*functor->functor_run)(functor, error.ok());
913
+ } else {
914
+ // While the experiment is rolling out, let us keep the cqd->event_engine
915
+ // field to prevent repeated calls to GetDefaultEventEngine() since it
916
+ // acquires a global lock.
917
+ cqd->event_engine->Run(
918
+ [engine = cqd->event_engine, functor, ok = error.ok()]() {
919
+ grpc_core::ExecCtx exec_ctx;
920
+ (*functor->functor_run)(functor, ok);
921
+ });
922
+ }
916
923
  }
917
924
 
918
925
  void grpc_cq_end_op(grpc_completion_queue* cq, void* tag,
@@ -42,6 +42,17 @@ class LegalHeaderKeyBits : public BitSet<256> {
42
42
  };
43
43
  constexpr LegalHeaderKeyBits g_legal_header_key_bits;
44
44
 
45
+ class LegalHeaderNonBinValueBits : public BitSet<256> {
46
+ public:
47
+ constexpr LegalHeaderNonBinValueBits() {
48
+ for (int i = 32; i <= 126; i++) {
49
+ set(i);
50
+ }
51
+ }
52
+ };
53
+
54
+ constexpr LegalHeaderNonBinValueBits g_legal_header_non_bin_value_bits;
55
+
45
56
  ValidateMetadataResult ConformsTo(absl::string_view x,
46
57
  const BitSet<256>& legal_bits,
47
58
  ValidateMetadataResult error) {
@@ -71,6 +82,12 @@ ValidateMetadataResult ValidateHeaderKeyIsLegal(absl::string_view key) {
71
82
  ValidateMetadataResult::kIllegalHeaderKey);
72
83
  }
73
84
 
85
+ ValidateMetadataResult ValidateNonBinaryHeaderValueIsLegal(
86
+ absl::string_view value) {
87
+ return ConformsTo(value, g_legal_header_non_bin_value_bits,
88
+ ValidateMetadataResult::kIllegalHeaderValue);
89
+ }
90
+
74
91
  const char* ValidateMetadataResultToString(ValidateMetadataResult result) {
75
92
  switch (result) {
76
93
  case ValidateMetadataResult::kOk:
@@ -103,23 +120,11 @@ int grpc_header_key_is_legal(grpc_slice slice) {
103
120
  return error2int(grpc_validate_header_key_is_legal(slice));
104
121
  }
105
122
 
106
- namespace {
107
- class LegalHeaderNonBinValueBits : public grpc_core::BitSet<256> {
108
- public:
109
- constexpr LegalHeaderNonBinValueBits() {
110
- for (int i = 32; i <= 126; i++) {
111
- set(i);
112
- }
113
- }
114
- };
115
- constexpr LegalHeaderNonBinValueBits g_legal_header_non_bin_value_bits;
116
- } // namespace
117
-
118
123
  grpc_error_handle grpc_validate_header_nonbin_value_is_legal(
119
124
  const grpc_slice& slice) {
120
- return grpc_core::UpgradeToStatus(grpc_core::ConformsTo(
121
- grpc_core::StringViewFromSlice(slice), g_legal_header_non_bin_value_bits,
122
- grpc_core::ValidateMetadataResult::kIllegalHeaderValue));
125
+ return grpc_core::UpgradeToStatus(
126
+ grpc_core::ValidateNonBinaryHeaderValueIsLegal(
127
+ grpc_core::StringViewFromSlice(slice)));
123
128
  }
124
129
 
125
130
  int grpc_header_nonbin_value_is_legal(grpc_slice slice) {
@@ -41,9 +41,11 @@ enum class ValidateMetadataResult : uint8_t {
41
41
 
42
42
  const char* ValidateMetadataResultToString(ValidateMetadataResult result);
43
43
 
44
- // Returns nullopt if the key is legal, otherwise returns an error message.
45
44
  ValidateMetadataResult ValidateHeaderKeyIsLegal(absl::string_view key);
46
45
 
46
+ ValidateMetadataResult ValidateNonBinaryHeaderValueIsLegal(
47
+ absl::string_view value);
48
+
47
49
  } // namespace grpc_core
48
50
 
49
51
  grpc_error_handle grpc_validate_header_key_is_legal(const grpc_slice& slice);
@@ -22,6 +22,6 @@
22
22
  #include <grpc/grpc.h>
23
23
  #include <grpc/support/port_platform.h>
24
24
 
25
- const char* grpc_version_string(void) { return "52.0.0"; }
25
+ const char* grpc_version_string(void) { return "53.0.0"; }
26
26
 
27
- const char* grpc_g_stands_for(void) { return "gutsy"; }
27
+ const char* grpc_g_stands_for(void) { return "glimmering"; }
@@ -94,7 +94,7 @@ void PromiseEndpoint::ReadState::Complete(absl::Status status,
94
94
  ExecCtx exec_ctx;
95
95
  self->Complete(std::move(status), num_bytes_requested);
96
96
  },
97
- &pending_buffer, std::move(read_args))) {
97
+ &pending_buffer, read_args)) {
98
98
  continue;
99
99
  }
100
100
  return;
@@ -157,7 +157,7 @@ class PromiseEndpoint {
157
157
  ExecCtx exec_ctx;
158
158
  read_state->Complete(std::move(status), num_bytes);
159
159
  },
160
- &read_state_->pending_buffer, std::move(read_args))) {
160
+ &read_state_->pending_buffer, read_args)) {
161
161
  read_state_->waker = Waker();
162
162
  read_state_->pending_buffer.MoveFirstNBytesIntoSliceBuffer(
163
163
  read_state_->pending_buffer.Length(), read_state_->buffer);
@@ -409,6 +409,11 @@ struct grpc_transport_stream_op_batch_payload {
409
409
  // This should be set for cancellations that result from malformed client
410
410
  // initial metadata.
411
411
  bool tarpit = false;
412
+ // Server-side only: If non-null, the transport sends this trailing
413
+ // metadata to the client.
414
+ // NOTE: This metadata bypasses subsequent filters and is sent directly
415
+ // to the client. Ensure it contains only fields intended for the client.
416
+ grpc_core::ServerMetadataHandle send_trailing_metadata = nullptr;
412
417
  } cancel_stream;
413
418
  };
414
419
 
@@ -263,8 +263,7 @@ void HealthProducer::HealthChecker::StartHealthStreamLocked() {
263
263
  << "HealthProducer " << producer_.get() << " HealthChecker " << this
264
264
  << ": creating HealthClient for \"" << health_check_service_name_ << "\"";
265
265
  stream_client_ = MakeOrphanable<SubchannelStreamClient>(
266
- producer_->connected_subchannel_, producer_->subchannel_->pollset_set(),
267
- std::make_unique<HealthStreamEventHandler>(Ref()),
266
+ producer_->subchannel_, std::make_unique<HealthStreamEventHandler>(Ref()),
268
267
  GRPC_TRACE_FLAG_ENABLED(health_check_client) ? "HealthClient" : nullptr);
269
268
  }
270
269
 
@@ -304,10 +303,6 @@ void HealthProducer::Start(WeakRefCountedPtr<Subchannel> subchannel) {
304
303
  << "HealthProducer " << this << ": starting with subchannel "
305
304
  << subchannel.get();
306
305
  subchannel_ = std::move(subchannel);
307
- {
308
- MutexLock lock(&mu_);
309
- connected_subchannel_ = subchannel_->connected_subchannel();
310
- }
311
306
  auto connectivity_watcher =
312
307
  MakeRefCounted<ConnectivityWatcher>(WeakRefAsSubclass<HealthProducer>());
313
308
  connectivity_watcher_ = connectivity_watcher.get();
@@ -369,15 +364,6 @@ void HealthProducer::OnConnectivityStateChange(grpc_connectivity_state state,
369
364
  << ": subchannel state update: state=" << ConnectivityStateName(state)
370
365
  << " status=" << status;
371
366
  MutexLock lock(&mu_);
372
- if (state == GRPC_CHANNEL_READY) {
373
- connected_subchannel_ = subchannel_->connected_subchannel();
374
- // If the subchannel became disconnected again before we got this
375
- // notification, then just ignore the READY notification. We should
376
- // get another notification shortly indicating a different state.
377
- if (connected_subchannel_ == nullptr) return;
378
- } else {
379
- connected_subchannel_.reset();
380
- }
381
367
  state_ = state;
382
368
  status_ = status;
383
369
  for (const auto& [_, health_checker] : health_checkers_) {
@@ -144,8 +144,6 @@ class HealthProducer final : public Subchannel::DataProducerInterface {
144
144
  Mutex mu_;
145
145
  std::optional<grpc_connectivity_state> state_ ABSL_GUARDED_BY(&mu_);
146
146
  absl::Status status_ ABSL_GUARDED_BY(&mu_);
147
- RefCountedPtr<ConnectedSubchannel> connected_subchannel_
148
- ABSL_GUARDED_BY(&mu_);
149
147
  std::map<std::string /*health_check_service_name*/,
150
148
  OrphanablePtr<HealthChecker>>
151
149
  health_checkers_ ABSL_GUARDED_BY(&mu_);