grpc 1.83.1 → 1.84.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 (322) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +21 -17
  3. data/include/grpc/credentials.h +10 -0
  4. data/include/grpc/grpc_security_constants.h +2 -0
  5. data/include/grpc/impl/channel_arg_names.h +9 -0
  6. data/src/core/call/call_filters.h +4 -2
  7. data/src/core/call/client_call.cc +20 -8
  8. data/src/core/call/client_call.h +4 -0
  9. data/src/core/call/interception_chain.cc +2 -0
  10. data/src/core/call/interception_chain.h +14 -1
  11. data/src/core/call/metadata.cc +1 -3
  12. data/src/core/call/metadata_batch.h +13 -5
  13. data/src/core/call/server_call.cc +31 -14
  14. data/src/core/call/server_call.h +4 -0
  15. data/src/core/channelz/text_encode.cc +9 -4
  16. data/src/core/channelz/v2tov1/convert.cc +2 -2
  17. data/src/core/client_channel/backup_poller.cc +1 -2
  18. data/src/core/client_channel/client_channel.cc +6 -33
  19. data/src/core/client_channel/client_channel_filter.cc +22 -55
  20. data/src/core/client_channel/client_channel_filter.h +2 -2
  21. data/src/core/client_channel/client_channel_service_config.cc +3 -19
  22. data/src/core/client_channel/direct_channel.cc +7 -1
  23. data/src/core/client_channel/direct_channel.h +2 -2
  24. data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
  25. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
  26. data/src/core/client_channel/subchannel.cc +310 -1058
  27. data/src/core/client_channel/subchannel.h +44 -329
  28. data/src/core/client_channel/subchannel_metrics.cc +48 -0
  29. data/src/core/client_channel/subchannel_metrics.h +60 -0
  30. data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
  31. data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
  32. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
  33. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
  34. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
  35. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
  36. data/src/core/credentials/call/json_util.h +1 -0
  37. data/src/core/credentials/call/jwt/json_token.cc +10 -2
  38. data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
  39. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
  40. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
  41. data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
  42. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
  43. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
  44. data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
  45. data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
  46. data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
  47. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
  48. data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
  49. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
  50. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
  51. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
  52. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
  53. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
  54. data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
  55. data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
  56. data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
  57. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
  58. data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
  59. data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
  60. data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
  61. data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
  62. data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
  63. data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
  64. data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
  65. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
  67. data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
  68. data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
  69. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
  70. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
  71. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
  72. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
  73. data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
  74. data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
  75. data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
  76. data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
  77. data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
  78. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
  80. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
  81. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
  82. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
  83. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
  84. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
  85. data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
  86. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
  87. data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
  88. data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
  89. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
  90. data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
  91. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
  92. data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
  93. data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
  94. data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
  95. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
  96. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
  97. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
  98. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
  99. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
  100. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
  101. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
  102. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
  103. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
  104. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
  105. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
  106. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
  107. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
  108. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
  109. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
  110. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
  111. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
  112. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
  113. data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
  114. data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
  115. data/src/core/filter/auth/server_auth_filter.cc +2 -3
  116. data/src/core/filter/composite/composite_filter.cc +45 -33
  117. data/src/core/filter/composite/composite_filter.h +5 -4
  118. data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
  119. data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
  120. data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
  121. data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
  122. data/src/core/filter/filter_args.h +13 -2
  123. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
  124. data/src/core/handshaker/security/security_handshaker.cc +9 -6
  125. data/src/core/lib/channel/channel_stack.cc +3 -0
  126. data/src/core/lib/channel/channel_stack.h +2 -0
  127. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
  128. data/src/core/lib/channel/promise_based_filter.cc +132 -20
  129. data/src/core/lib/channel/promise_based_filter.h +42 -12
  130. data/src/core/lib/compression/compression_internal.cc +4 -5
  131. data/src/core/lib/debug/trace_flags.cc +8 -0
  132. data/src/core/lib/debug/trace_flags.h +3 -0
  133. data/src/core/lib/event_engine/ares_resolver.cc +54 -50
  134. data/src/core/lib/event_engine/ares_resolver.h +3 -2
  135. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
  136. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
  137. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
  138. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
  139. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
  140. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
  141. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
  142. data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
  143. data/src/core/lib/experiments/experiments.cc +60 -96
  144. data/src/core/lib/experiments/experiments.h +34 -50
  145. data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
  146. data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
  147. data/src/core/lib/iomgr/error.cc +2 -6
  148. data/src/core/lib/iomgr/error_cfstream.cc +1 -1
  149. data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
  150. data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
  151. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
  152. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
  153. data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
  154. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
  155. data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
  156. data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
  157. data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
  158. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  159. data/src/core/lib/iomgr/systemd_utils.cc +0 -1
  160. data/src/core/lib/iomgr/tcp_client.h +1 -1
  161. data/src/core/lib/iomgr/tcp_posix.cc +23 -15
  162. data/src/core/lib/iomgr/tcp_server.h +1 -1
  163. data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
  165. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
  166. data/src/core/lib/iomgr/tcp_windows.cc +5 -10
  167. data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
  168. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
  169. data/src/core/lib/iomgr/vsock.h +3 -1
  170. data/src/core/lib/resource_quota/memory_quota.cc +1 -1
  171. data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
  172. data/src/core/lib/security/authorization/rbac_policy.h +21 -3
  173. data/src/core/lib/surface/call.cc +3 -9
  174. data/src/core/lib/surface/call_utils.h +113 -0
  175. data/src/core/lib/surface/channel_create.cc +1 -1
  176. data/src/core/lib/surface/channel_create.h +0 -2
  177. data/src/core/lib/surface/channel_init.cc +77 -38
  178. data/src/core/lib/surface/channel_init.h +30 -16
  179. data/src/core/lib/surface/filter_stack_call.cc +5 -10
  180. data/src/core/lib/surface/init.cc +13 -27
  181. data/src/core/lib/surface/version.cc +1 -1
  182. data/src/core/lib/transport/error_utils.cc +0 -27
  183. data/src/core/lib/transport/error_utils.h +0 -16
  184. data/src/core/lib/transport/transport.h +7 -5
  185. data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
  186. data/src/core/load_balancing/rls/rls.cc +28 -11
  187. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
  188. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
  189. data/src/core/load_balancing/xds/cds.cc +3 -1
  190. data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
  191. data/src/core/mitigation_engine/mitigation.h +14 -5
  192. data/src/core/mitigation_engine/mitigation_engine.h +7 -3
  193. data/src/core/mitigation_engine/mitigation_provider.h +2 -1
  194. data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
  195. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
  196. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
  197. data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
  198. data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
  199. data/src/core/resolver/endpoint_addresses.h +3 -0
  200. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
  201. data/src/core/resolver/xds/xds_resolver.cc +35 -9
  202. data/src/core/server/server.cc +2 -6
  203. data/src/core/server/server_config_selector.h +18 -3
  204. data/src/core/server/server_config_selector_filter.cc +178 -91
  205. data/src/core/server/server_config_selector_filter.h +58 -3
  206. data/src/core/server/xds_server_config_fetcher.cc +196 -129
  207. data/src/core/server/xds_server_config_fetcher.h +49 -0
  208. data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
  209. data/src/core/telemetry/histogram.h +94 -14
  210. data/src/core/telemetry/instrument.cc +179 -74
  211. data/src/core/telemetry/instrument.h +78 -30
  212. data/src/core/telemetry/metrics.h +5 -0
  213. data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
  214. data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
  215. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
  216. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
  217. data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
  218. data/src/core/tsi/ssl_telemetry_utils.h +12 -2
  219. data/src/core/tsi/ssl_transport_security.cc +238 -80
  220. data/src/core/tsi/ssl_transport_security.h +63 -33
  221. data/src/core/tsi/tls_telemetry.cc +31 -0
  222. data/src/core/tsi/tls_telemetry.h +47 -0
  223. data/src/core/tsi/transport_security.cc +2 -2
  224. data/src/core/tsi/transport_security.h +1 -1
  225. data/src/core/tsi/transport_security_interface.h +1 -1
  226. data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
  227. data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
  228. data/src/core/util/http_client/httpcli.cc +16 -53
  229. data/src/core/util/http_client/httpcli.h +0 -7
  230. data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
  231. data/src/core/util/linux/cpu.cc +1 -1
  232. data/src/core/util/load_file.cc +3 -9
  233. data/src/core/util/load_file.h +3 -4
  234. data/src/core/util/matchers.h +8 -0
  235. data/src/core/util/posix/cpu.cc +1 -1
  236. data/src/core/util/status_helper.cc +0 -20
  237. data/src/core/util/status_helper.h +3 -14
  238. data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
  239. data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
  240. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
  241. data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
  242. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
  243. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
  244. data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
  245. data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
  246. data/src/core/xds/grpc/xds_client_grpc.h +0 -4
  247. data/src/core/xds/grpc/xds_cluster.h +1 -0
  248. data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
  249. data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
  250. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
  251. data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
  252. data/src/core/xds/grpc/xds_common_types.cc +0 -91
  253. data/src/core/xds/grpc/xds_common_types.h +1 -47
  254. data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
  255. data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
  256. data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
  257. data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
  258. data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
  259. data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
  260. data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
  261. data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
  262. data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
  263. data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
  264. data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
  265. data/src/core/xds/grpc/xds_http_filter.cc +2 -1
  266. data/src/core/xds/grpc/xds_http_filter.h +6 -5
  267. data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
  268. data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
  269. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
  270. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
  271. data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
  272. data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
  273. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
  274. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
  275. data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
  276. data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
  277. data/src/core/xds/grpc/xds_listener.cc +2 -0
  278. data/src/core/xds/grpc/xds_listener.h +5 -0
  279. data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
  280. data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
  281. data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
  282. data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
  283. data/src/core/xds/grpc/xds_route_config.cc +2 -0
  284. data/src/core/xds/grpc/xds_route_config.h +3 -1
  285. data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
  286. data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
  287. data/src/core/xds/grpc/xds_routing.cc +116 -69
  288. data/src/core/xds/grpc/xds_routing.h +19 -8
  289. data/src/core/xds/grpc/xds_tls_context.cc +117 -0
  290. data/src/core/xds/grpc/xds_tls_context.h +76 -0
  291. data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
  292. data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
  293. data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
  294. data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
  295. data/src/ruby/ext/grpc/rb_call.c +26 -15
  296. data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
  297. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  298. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  299. data/src/ruby/lib/grpc/version.rb +1 -1
  300. data/src/ruby/pb/test/client.rb +5 -4
  301. data/src/ruby/spec/call_spec.rb +14 -0
  302. data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
  303. metadata +50 -35
  304. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
  305. data/src/core/lib/iomgr/resolve_address.cc +0 -59
  306. data/src/core/lib/iomgr/resolve_address.h +0 -125
  307. data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
  308. data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
  309. data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
  310. data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
  311. data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
  312. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
  313. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
  314. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
  315. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
  316. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
  317. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
  318. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
  319. data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
  320. data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
  321. data/src/core/util/json/json_util.cc +0 -101
  322. data/src/core/util/json/json_util.h +0 -163
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7cad78eb1a239fccff217f8dfda9db31f92a3f0f32b713a55cf26ebc782c5e3
4
- data.tar.gz: '039647b8a259b5e5c561efd5e23c0831d2caa17184ad92f4da26b8de00fe2594'
3
+ metadata.gz: 35881f9fa45f53a009e1c5c19eb30ac67664c53192ddb13b8d4275616c61a914
4
+ data.tar.gz: 1442944f8bb842300c090f16929fcd18509a1bca7ad564c54f78ca19b6233285
5
5
  SHA512:
6
- metadata.gz: a442ff623a15321dc764714d9389c6cf58db45b8d7f5a73d40161d9277f7ff34ea6796a8e07cc9eece2443a1f37f406bea2b6b19804311545c2ebb444fc1c8e2
7
- data.tar.gz: cc1c384f869bee5ff9336804619580ef647f0f9d3ce643a7b1494d41fa6da73511b8d74b30eabbb39f0a9baaa1ed3f806a51f44c42332395b2a3643d2963b7e6
6
+ metadata.gz: 19c07f8dc8aa885cbf116bbd8762c861705e6261b4cbaeedae0f309d712a5de6204c6239b80132554feff36131d9d299125607ff6df654ffe9e8b280689bec38
7
+ data.tar.gz: 2cef73246c7657d9608a9f2b95671c3c39c9caa6bf2b92d96dfbece9d61fc5aa02ed7db213d5cd542f33ab4a29ec45be67aacfbf656a9b3985443c9049377be2
data/Makefile CHANGED
@@ -368,7 +368,7 @@ Q = @
368
368
  endif
369
369
 
370
370
  CORE_VERSION = 56.0.0
371
- CPP_VERSION = 1.83.1
371
+ CPP_VERSION = 1.84.0-pre1
372
372
 
373
373
  CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
374
374
  CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@@ -708,6 +708,7 @@ LIBGRPC_SRC = \
708
708
  src/core/client_channel/retry_service_config.cc \
709
709
  src/core/client_channel/retry_throttle.cc \
710
710
  src/core/client_channel/subchannel.cc \
711
+ src/core/client_channel/subchannel_metrics.cc \
711
712
  src/core/client_channel/subchannel_pool_interface.cc \
712
713
  src/core/client_channel/subchannel_stream_client.cc \
713
714
  src/core/client_channel/subchannel_stream_limiter.cc \
@@ -725,6 +726,7 @@ LIBGRPC_SRC = \
725
726
  src/core/credentials/call/external/file_external_account_credentials.cc \
726
727
  src/core/credentials/call/external/url_external_account_credentials.cc \
727
728
  src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc \
729
+ src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc \
728
730
  src/core/credentials/call/iam/iam_credentials.cc \
729
731
  src/core/credentials/call/json_util.cc \
730
732
  src/core/credentials/call/jwt/json_token.cc \
@@ -910,6 +912,8 @@ LIBGRPC_SRC = \
910
912
  src/core/ext/upb-gen/envoy/extensions/filters/common/fault/v3/fault.upb_minitable.c \
911
913
  src/core/ext/upb-gen/envoy/extensions/filters/common/matcher/action/v3/skip_action.upb_minitable.c \
912
914
  src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.c \
915
+ src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c \
916
+ src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c \
913
917
  src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c \
914
918
  src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c \
915
919
  src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c \
@@ -934,6 +938,7 @@ LIBGRPC_SRC = \
934
938
  src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c \
935
939
  src/core/ext/upb-gen/envoy/service/discovery/v3/ads.upb_minitable.c \
936
940
  src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c \
941
+ src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c \
937
942
  src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb_minitable.c \
938
943
  src/core/ext/upb-gen/envoy/service/status/v3/csds.upb_minitable.c \
939
944
  src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c \
@@ -974,7 +979,7 @@ LIBGRPC_SRC = \
974
979
  src/core/ext/upb-gen/google/protobuf/timestamp.upb_minitable.c \
975
980
  src/core/ext/upb-gen/google/protobuf/wrappers.upb_minitable.c \
976
981
  src/core/ext/upb-gen/google/rpc/status.upb_minitable.c \
977
- src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.c \
982
+ src/core/ext/upb-gen/grpc/channelz/v1/channelz.upb_minitable.c \
978
983
  src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.c \
979
984
  src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c \
980
985
  src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c \
@@ -1092,6 +1097,8 @@ LIBGRPC_SRC = \
1092
1097
  src/core/ext/upbdefs-gen/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c \
1093
1098
  src/core/ext/upbdefs-gen/envoy/extensions/filters/common/matcher/action/v3/skip_action.upbdefs.c \
1094
1099
  src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.c \
1100
+ src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c \
1101
+ src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c \
1095
1102
  src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c \
1096
1103
  src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c \
1097
1104
  src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c \
@@ -1148,7 +1155,7 @@ LIBGRPC_SRC = \
1148
1155
  src/core/ext/upbdefs-gen/google/protobuf/timestamp.upbdefs.c \
1149
1156
  src/core/ext/upbdefs-gen/google/protobuf/wrappers.upbdefs.c \
1150
1157
  src/core/ext/upbdefs-gen/google/rpc/status.upbdefs.c \
1151
- src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c \
1158
+ src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c \
1152
1159
  src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c \
1153
1160
  src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c \
1154
1161
  src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c \
@@ -1187,6 +1194,8 @@ LIBGRPC_SRC = \
1187
1194
  src/core/filter/auth/client_auth_filter.cc \
1188
1195
  src/core/filter/auth/server_auth_filter.cc \
1189
1196
  src/core/filter/composite/composite_filter.cc \
1197
+ src/core/filter/ext_proc/ext_proc_filter.cc \
1198
+ src/core/filter/ext_proc/ext_proc_messages.cc \
1190
1199
  src/core/filter/fused_filters.cc \
1191
1200
  src/core/handshaker/endpoint_info/endpoint_info_handshaker.cc \
1192
1201
  src/core/handshaker/handshaker.cc \
@@ -1303,9 +1312,6 @@ LIBGRPC_SRC = \
1303
1312
  src/core/lib/iomgr/pollset_set.cc \
1304
1313
  src/core/lib/iomgr/pollset_set_windows.cc \
1305
1314
  src/core/lib/iomgr/pollset_windows.cc \
1306
- src/core/lib/iomgr/resolve_address.cc \
1307
- src/core/lib/iomgr/resolve_address_posix.cc \
1308
- src/core/lib/iomgr/resolve_address_windows.cc \
1309
1315
  src/core/lib/iomgr/sockaddr_utils_posix.cc \
1310
1316
  src/core/lib/iomgr/socket_factory_posix.cc \
1311
1317
  src/core/lib/iomgr/socket_mutator.cc \
@@ -1426,16 +1432,8 @@ LIBGRPC_SRC = \
1426
1432
  src/core/net/socket_mutator.cc \
1427
1433
  src/core/plugin_registry/grpc_plugin_registry.cc \
1428
1434
  src/core/plugin_registry/grpc_plugin_registry_extra.cc \
1429
- src/core/resolver/dns/c_ares/dns_resolver_ares.cc \
1430
- src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc \
1431
- src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc \
1432
- src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc \
1433
- src/core/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc \
1434
- src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc \
1435
- src/core/resolver/dns/dns_resolver_plugin.cc \
1436
- src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc \
1437
- src/core/resolver/dns/event_engine/service_config_helper.cc \
1438
- src/core/resolver/dns/native/dns_resolver.cc \
1435
+ src/core/resolver/dns/dns_resolver.cc \
1436
+ src/core/resolver/dns/service_config_helper.cc \
1439
1437
  src/core/resolver/endpoint_addresses.cc \
1440
1438
  src/core/resolver/fake/fake_resolver.cc \
1441
1439
  src/core/resolver/google_c2p/google_c2p_resolver.cc \
@@ -1497,8 +1495,10 @@ LIBGRPC_SRC = \
1497
1495
  src/core/tsi/ssl_telemetry_utils.cc \
1498
1496
  src/core/tsi/ssl_transport_security.cc \
1499
1497
  src/core/tsi/ssl_transport_security_utils.cc \
1498
+ src/core/tsi/tls_telemetry.cc \
1500
1499
  src/core/tsi/transport_security.cc \
1501
1500
  src/core/tsi/transport_security_grpc.cc \
1501
+ src/core/util/address_sorting_init.cc \
1502
1502
  src/core/util/alloc.cc \
1503
1503
  src/core/util/backoff.cc \
1504
1504
  src/core/util/crash.cc \
@@ -1523,7 +1523,6 @@ LIBGRPC_SRC = \
1523
1523
  src/core/util/iphone/cpu.cc \
1524
1524
  src/core/util/json/json_object_loader.cc \
1525
1525
  src/core/util/json/json_reader.cc \
1526
- src/core/util/json/json_util.cc \
1527
1526
  src/core/util/json/json_writer.cc \
1528
1527
  src/core/util/latent_see.cc \
1529
1528
  src/core/util/linux/cpu.cc \
@@ -1577,6 +1576,7 @@ LIBGRPC_SRC = \
1577
1576
  src/core/xds/grpc/file_watcher_certificate_provider_factory.cc \
1578
1577
  src/core/xds/grpc/xds_audit_logger_registry.cc \
1579
1578
  src/core/xds/grpc/xds_bootstrap_grpc.cc \
1579
+ src/core/xds/grpc/xds_bootstrap_grpc_builder.cc \
1580
1580
  src/core/xds/grpc/xds_certificate_provider.cc \
1581
1581
  src/core/xds/grpc/xds_client_grpc.cc \
1582
1582
  src/core/xds/grpc/xds_cluster.cc \
@@ -1586,8 +1586,10 @@ LIBGRPC_SRC = \
1586
1586
  src/core/xds/grpc/xds_common_types_parser.cc \
1587
1587
  src/core/xds/grpc/xds_endpoint.cc \
1588
1588
  src/core/xds/grpc/xds_endpoint_parser.cc \
1589
+ src/core/xds/grpc/xds_grpc_service_parser.cc \
1589
1590
  src/core/xds/grpc/xds_health_status.cc \
1590
1591
  src/core/xds/grpc/xds_http_composite_filter.cc \
1592
+ src/core/xds/grpc/xds_http_ext_proc_filter.cc \
1591
1593
  src/core/xds/grpc/xds_http_fault_filter.cc \
1592
1594
  src/core/xds/grpc/xds_http_filter.cc \
1593
1595
  src/core/xds/grpc/xds_http_filter_registry.cc \
@@ -1608,6 +1610,8 @@ LIBGRPC_SRC = \
1608
1610
  src/core/xds/grpc/xds_route_config_parser.cc \
1609
1611
  src/core/xds/grpc/xds_routing.cc \
1610
1612
  src/core/xds/grpc/xds_server_grpc.cc \
1613
+ src/core/xds/grpc/xds_tls_context.cc \
1614
+ src/core/xds/grpc/xds_tls_context_parser.cc \
1611
1615
  src/core/xds/grpc/xds_transport_grpc.cc \
1612
1616
  src/core/xds/xds_client/lrs_client.cc \
1613
1617
  src/core/xds/xds_client/xds_api.cc \
@@ -60,6 +60,14 @@ grpc_service_account_jwt_access_credentials_create(const char* json_key,
60
60
  GRPCAPI grpc_call_credentials* grpc_external_account_credentials_create(
61
61
  const char* json_string, const char* scopes_string);
62
62
 
63
+ /** Builds Google Distributed Cloud Hosting Service Account credentials.
64
+ - json_string is the JSON string containing the service account key.
65
+ - audience_string is the intended recipient or service.
66
+ This API is used for experimental purposes for now and may change in the
67
+ future. */
68
+ GRPCAPI grpc_call_credentials* grpc_gdch_service_account_credentials_create(
69
+ const char* json_string, const char* audience_string);
70
+
63
71
  /** Creates an Oauth2 Refresh Token credentials object for connecting to Google.
64
72
  May return NULL if the input is invalid.
65
73
  WARNING: Do NOT use this credentials to connect to a non-google service as
@@ -765,6 +773,8 @@ typedef struct grpc_tls_custom_verification_check_request {
765
773
  * This value will only be filled if the cryptographic peer certificate
766
774
  * verification was successful */
767
775
  const char* verified_root_cert_subject;
776
+ /* The negotiated key exchange group. */
777
+ const char* negotiated_key_exchange_group;
768
778
  } peer_info;
769
779
  } grpc_tls_custom_verification_check_request;
770
780
 
@@ -44,6 +44,8 @@ extern "C" {
44
44
  // https://www.openssl.org/docs/man1.1.0/man3/SSL_get_peer_cert_chain.html.
45
45
  #define GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME "x509_pem_cert_chain"
46
46
  #define GRPC_SSL_SESSION_REUSED_PROPERTY "ssl_session_reused"
47
+ #define GRPC_SSL_NEGOTIATED_KEY_EXCHANGE_GROUP_PROPERTY_NAME \
48
+ "ssl_negotiated_key_exchange_group"
47
49
  #define GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME "security_level"
48
50
  #define GRPC_PEER_DNS_PROPERTY_NAME "peer_dns"
49
51
  #define GRPC_PEER_SPIFFE_ID_PROPERTY_NAME "peer_spiffe_id"
@@ -286,6 +286,15 @@
286
286
  "grpc.experimental.tcp_min_read_chunk_size"
287
287
  #define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \
288
288
  "grpc.experimental.tcp_max_read_chunk_size"
289
+ /** Channel arg (integer) setting an opt-in upper bound, in bytes, on the
290
+ adaptive read buffer size that a single TCP endpoint may preallocate for
291
+ reads. When unset (the default) the read buffer target grows as before,
292
+ preserving historical behavior. When set, the adaptive read target is
293
+ clamped to this value so occasional large reads do not leave a permanently
294
+ high read-buffer high-watermark. Unlike GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE,
295
+ this does not change per-socket slice sizing. **/
296
+ #define GRPC_ARG_TCP_MAX_READ_BUFFER_SIZE \
297
+ "grpc.experimental.tcp_max_read_buffer_size"
289
298
  /* TCP TX Zerocopy enable state: zero is disabled, non-zero is enabled. By
290
299
  default, it is disabled. */
291
300
  #define GRPC_ARG_TCP_TX_ZEROCOPY_ENABLED \
@@ -89,7 +89,8 @@
89
89
  // failure (in which case the call will be aborted).
90
90
  // useful for cases where the exact metadata returned needs to be customized.
91
91
  // It's also acceptable to return a promise that resolves to the
92
- // relevant return type listed above.
92
+ // relevant return type listed above (except for OnClientToServerHalfClose
93
+ // and OnServerTrailingMetadata, which must be synchronous).
93
94
  //
94
95
  // OnFinalize is added to intercept call finalization.
95
96
  // It must have one of the signatures:
@@ -1983,7 +1984,8 @@ class CallFilters {
1983
1984
  return flag;
1984
1985
  }
1985
1986
  // Client: Fetch server initial metadata
1986
- // Returns a promise that resolves to ValueOrFailure<ServerMetadataHandle>
1987
+ // Returns a promise that resolves to
1988
+ // ValueOrFailure<std::optional<ServerMetadataHandle>>
1987
1989
  GRPC_MUST_USE_RESULT auto PullServerInitialMetadata() {
1988
1990
  return Seq(
1989
1991
  [this]() {
@@ -46,6 +46,7 @@
46
46
  #include "src/core/lib/promise/try_seq.h"
47
47
  #include "src/core/lib/resource_quota/arena.h"
48
48
  #include "src/core/lib/slice/slice_buffer.h"
49
+ #include "src/core/lib/surface/call_utils.h"
49
50
  #include "src/core/lib/surface/completion_queue.h"
50
51
  #include "src/core/telemetry/stats.h"
51
52
  #include "src/core/telemetry/stats_data.h"
@@ -62,7 +63,9 @@ namespace grpc_core {
62
63
 
63
64
  namespace {
64
65
 
65
- grpc_call_error ValidateClientBatch(const grpc_op* ops, size_t nops) {
66
+ grpc_call_error ValidateClientBatch(
67
+ const grpc_op* ops, size_t nops,
68
+ CallOpInvariantsValidator& call_op_invariants_validator) {
66
69
  BitSet<8> got_ops;
67
70
  for (size_t op_idx = 0; op_idx < nops; op_idx++) {
68
71
  const grpc_op& op = ops[op_idx];
@@ -94,7 +97,7 @@ grpc_call_error ValidateClientBatch(const grpc_op* ops, size_t nops) {
94
97
  if (got_ops.is_set(op.op)) return GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
95
98
  got_ops.set(op.op);
96
99
  }
97
- return GRPC_CALL_OK;
100
+ return call_op_invariants_validator.ValidateAndCommit(ops, nops);
98
101
  }
99
102
 
100
103
  } // namespace
@@ -161,7 +164,8 @@ grpc_call_error ClientCall::StartBatch(const grpc_op* ops, size_t nops,
161
164
  EndOpImmediately(cq_, notify_tag, is_notify_tag_closure);
162
165
  return GRPC_CALL_OK;
163
166
  }
164
- const grpc_call_error validation_result = ValidateClientBatch(ops, nops);
167
+ const grpc_call_error validation_result =
168
+ ValidateClientBatch(ops, nops, call_op_invariants_validator_);
165
169
  if (validation_result != GRPC_CALL_OK) {
166
170
  return validation_result;
167
171
  }
@@ -325,8 +329,12 @@ void ClientCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
325
329
  }
326
330
  if (!is_notify_tag_closure) grpc_cq_begin_op(cq_, notify_tag);
327
331
  BatchOpIndex op_index(ops, nops);
328
- auto send_message =
329
- op_index.OpHandler<GRPC_OP_SEND_MESSAGE>([this](const grpc_op& op) {
332
+ uint8_t concurrent_ops_to_reset = 0;
333
+
334
+ auto send_message = op_index.OpHandler<GRPC_OP_SEND_MESSAGE>(
335
+ [this, &concurrent_ops_to_reset](const grpc_op& op) {
336
+ concurrent_ops_to_reset |=
337
+ CallOpInvariantsValidator::OpBit(GRPC_OP_SEND_MESSAGE);
330
338
  SliceBuffer send;
331
339
  grpc_slice_buffer_swap(
332
340
  &op.data.send_message.send_message->data.raw.slice_buffer,
@@ -344,8 +352,10 @@ void ClientCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
344
352
  return Success{};
345
353
  };
346
354
  });
347
- auto recv_message =
348
- op_index.OpHandler<GRPC_OP_RECV_MESSAGE>([this](const grpc_op& op) {
355
+ auto recv_message = op_index.OpHandler<GRPC_OP_RECV_MESSAGE>(
356
+ [this, &concurrent_ops_to_reset](const grpc_op& op) {
357
+ concurrent_ops_to_reset |=
358
+ CallOpInvariantsValidator::OpBit(GRPC_OP_RECV_MESSAGE);
349
359
  return message_receiver_.MakeBatchOp(op, &started_call_initiator_);
350
360
  });
351
361
  auto recv_initial_metadata =
@@ -382,7 +392,9 @@ void ClientCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
382
392
  AllOk<StatusFlag>(
383
393
  TrySeq(std::move(send_message), std::move(send_close_from_client)),
384
394
  TrySeq(std::move(recv_initial_metadata), std::move(recv_message))),
385
- [self = WeakRef()](StatusFlag x) { return x; });
395
+ [guard = PrimaryOpsCleanup<ClientCall>(WeakRefAsSubclass<ClientCall>(),
396
+ concurrent_ops_to_reset)](
397
+ StatusFlag x) { return x; });
386
398
  Party::WakeupHold wakeup_hold;
387
399
  if (const grpc_op* op = op_index.op(GRPC_OP_SEND_INITIAL_METADATA)) {
388
400
  wakeup_hold = StartCall(*op);
@@ -133,6 +133,9 @@ class ClientCall final
133
133
  UnorderedStart* next;
134
134
  };
135
135
 
136
+ template <typename T>
137
+ friend class PrimaryOpsCleanup;
138
+
136
139
  void CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
137
140
  bool is_notify_tag_closure);
138
141
  template <typename Batch>
@@ -178,6 +181,7 @@ class ClientCall final
178
181
  // otherwise the server trailing metadata from started_call_initiator_ is
179
182
  // authoritative.
180
183
  SingleSetPtr<absl::Status> cancel_status_;
184
+ CallOpInvariantsValidator call_op_invariants_validator_;
181
185
  MessageReceiver message_receiver_;
182
186
  grpc_completion_queue* const cq_;
183
187
  const RefCountedPtr<UnstartedCallDestination> call_destination_;
@@ -146,9 +146,11 @@ InterceptionChainBuilder::Build(FinalDestination final_destination) {
146
146
  }
147
147
  Interceptor* previous = top_interceptor_.get();
148
148
  while (previous->wrapped_destination_ != nullptr) {
149
+ previous->Init(args_);
149
150
  previous = DownCast<Interceptor*>(previous->wrapped_destination_.get());
150
151
  }
151
152
  previous->wrapped_destination_ = std::move(terminator);
153
+ previous->Init(args_);
152
154
  return std::move(top_interceptor_);
153
155
  }
154
156
 
@@ -93,7 +93,6 @@ class HijackedCall final {
93
93
  // preceding filters. We don't actually have any use-case for seeing
94
94
  // the unprocessed initial metadata and deciding to do a PassThrough(),
95
95
  // and its presence in this API is confusing.
96
-
97
96
  class Interceptor : public UnstartedCallDestination {
98
97
  public:
99
98
  using UnstartedCallDestination::UnstartedCallDestination;
@@ -106,6 +105,11 @@ class Interceptor : public UnstartedCallDestination {
106
105
  }
107
106
 
108
107
  protected:
108
+ // Performs initialization steps after the interception chain has been
109
+ // constructed. In particular, wrapped_destination() may be called
110
+ // from inside this method.
111
+ virtual void Init(const ChannelArgs& args) {}
112
+
109
113
  virtual void InterceptCall(UnstartedCallHandler unstarted_call_handler) = 0;
110
114
 
111
115
  // Returns a promise that resolves to a HijackedCall instance.
@@ -141,6 +145,15 @@ class Interceptor : public UnstartedCallDestination {
141
145
  wrapped_destination_->StartCall(std::move(unstarted_call_handler));
142
146
  }
143
147
 
148
+ // The next call destination in the interception chain. To be used by
149
+ // interceptors that need to delegate to their own interception chains.
150
+ //
151
+ // Note: This will not return a useful value until Init() has been
152
+ // called -- do NOT call this from within the ctor.
153
+ RefCountedPtr<UnstartedCallDestination> wrapped_destination() const {
154
+ return wrapped_destination_;
155
+ }
156
+
144
157
  private:
145
158
  friend class InterceptionChainBuilder;
146
159
 
@@ -44,9 +44,7 @@ absl::Status ServerMetadataToStatus(ServerMetadata& md) {
44
44
  absl::string_view message = error_slice != nullptr
45
45
  ? error_slice->as_string_view()
46
46
  : absl::string_view();
47
- return grpc_error_set_int(
48
- absl::Status(static_cast<absl::StatusCode>(grpc_status), message),
49
- StatusIntProperty::kRpcStatus, grpc_status);
47
+ return absl::Status(static_cast<absl::StatusCode>(grpc_status), message);
50
48
  }
51
49
 
52
50
  void SetServerMetadataFromStatus(ServerMetadata& md,
@@ -594,6 +594,14 @@ struct GrpcStreamNetworkState {
594
594
  static std::string DisplayValue(ValueType x);
595
595
  };
596
596
 
597
+ // Annotation added to indicate that the LB policy dropped the call.
598
+ struct LbPolicyDrop {
599
+ static absl::string_view DebugKey() { return "LbPolicyDrop"; }
600
+ static constexpr bool kRepeatable = false;
601
+ using ValueType = bool;
602
+ static absl::string_view DisplayValue(bool x) { return x ? "true" : "false"; }
603
+ };
604
+
597
605
  // Annotation added by a server transport to note the peer making a request.
598
606
  struct PeerString {
599
607
  static absl::string_view DebugKey() { return "PeerString"; }
@@ -1752,11 +1760,11 @@ using grpc_metadata_batch_base = grpc_core::MetadataMap<
1752
1760
  grpc_core::XEnvoyPeerMetadata, grpc_core::XForwardedForMetadata,
1753
1761
  grpc_core::XForwardedHostMetadata, grpc_core::W3CTraceParentMetadata,
1754
1762
  // Non-encodable things
1755
- grpc_core::GrpcStreamNetworkState, grpc_core::PeerString,
1756
- grpc_core::GrpcStatusContext, grpc_core::GrpcStatusFromWire,
1757
- grpc_core::GrpcCallWasCancelled, grpc_core::WaitForReady,
1758
- grpc_core::IsTransparentRetry, grpc_core::GrpcTrailersOnly,
1759
- grpc_core::GrpcTarPit,
1763
+ grpc_core::GrpcStreamNetworkState, grpc_core::LbPolicyDrop,
1764
+ grpc_core::PeerString, grpc_core::GrpcStatusContext,
1765
+ grpc_core::GrpcStatusFromWire, grpc_core::GrpcCallWasCancelled,
1766
+ grpc_core::WaitForReady, grpc_core::IsTransparentRetry,
1767
+ grpc_core::GrpcTrailersOnly, grpc_core::GrpcTarPit,
1760
1768
  grpc_core::GrpcRegisteredMethod GRPC_CUSTOM_CLIENT_METADATA
1761
1769
  GRPC_CUSTOM_SERVER_METADATA>;
1762
1770
 
@@ -33,6 +33,7 @@
33
33
  #include <string.h>
34
34
 
35
35
  #include <atomic>
36
+ #include <cstdint>
36
37
  #include <memory>
37
38
  #include <string>
38
39
  #include <utility>
@@ -46,6 +47,7 @@
46
47
  #include "src/core/lib/promise/try_seq.h"
47
48
  #include "src/core/lib/resource_quota/arena.h"
48
49
  #include "src/core/lib/slice/slice_buffer.h"
50
+ #include "src/core/lib/surface/call_utils.h"
49
51
  #include "src/core/lib/surface/completion_queue.h"
50
52
  #include "src/core/server/server_interface.h"
51
53
  #include "src/core/util/bitset.h"
@@ -57,7 +59,9 @@ namespace grpc_core {
57
59
 
58
60
  namespace {
59
61
 
60
- grpc_call_error ValidateServerBatch(const grpc_op* ops, size_t nops) {
62
+ grpc_call_error ValidateServerBatch(
63
+ const grpc_op* ops, size_t nops,
64
+ CallOpInvariantsValidator& call_op_invariants_validator) {
61
65
  BitSet<8> got_ops;
62
66
  for (size_t op_idx = 0; op_idx < nops; op_idx++) {
63
67
  const grpc_op& op = ops[op_idx];
@@ -96,7 +100,7 @@ grpc_call_error ValidateServerBatch(const grpc_op* ops, size_t nops) {
96
100
  if (got_ops.is_set(op.op)) return GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
97
101
  got_ops.set(op.op);
98
102
  }
99
- return GRPC_CALL_OK;
103
+ return call_op_invariants_validator.ValidateAndCommit(ops, nops);
100
104
  }
101
105
 
102
106
  } // namespace
@@ -120,7 +124,8 @@ grpc_call_error ServerCall::StartBatch(const grpc_op* ops, size_t nops,
120
124
  EndOpImmediately(cq_, notify_tag, is_notify_tag_closure);
121
125
  return GRPC_CALL_OK;
122
126
  }
123
- const grpc_call_error validation_result = ValidateServerBatch(ops, nops);
127
+ const grpc_call_error validation_result =
128
+ ValidateServerBatch(ops, nops, call_op_invariants_validator_);
124
129
  if (validation_result != GRPC_CALL_OK) {
125
130
  return validation_result;
126
131
  }
@@ -131,23 +136,33 @@ grpc_call_error ServerCall::StartBatch(const grpc_op* ops, size_t nops,
131
136
  void ServerCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
132
137
  bool is_notify_tag_closure) {
133
138
  BatchOpIndex op_index(ops, nops);
139
+ uint8_t concurrent_ops_to_reset = 0;
134
140
  if (!is_notify_tag_closure) grpc_cq_begin_op(cq_, notify_tag);
135
141
 
136
142
  auto commit_with_send_ops = [&](auto send_ops) {
137
- auto recv_message =
138
- op_index.OpHandler<GRPC_OP_RECV_MESSAGE>([this](const grpc_op& op) {
143
+ auto recv_message = op_index.OpHandler<GRPC_OP_RECV_MESSAGE>(
144
+ [this, &concurrent_ops_to_reset](const grpc_op& op) {
145
+ concurrent_ops_to_reset |=
146
+ CallOpInvariantsValidator::OpBit(GRPC_OP_RECV_MESSAGE);
139
147
  return message_receiver_.MakeBatchOp(op, &call_handler_);
140
148
  });
149
+ auto self = this->template WeakRefAsSubclass<ServerCall>();
141
150
  auto primary_ops =
142
- AllOk<StatusFlag>(std::move(send_ops), std::move(recv_message));
151
+ Map(AllOk<StatusFlag>(std::move(send_ops), std::move(recv_message)),
152
+ [guard = PrimaryOpsCleanup<ServerCall>(
153
+ std::move(self), concurrent_ops_to_reset)](StatusFlag x) {
154
+ return x;
155
+ });
156
+
143
157
  if (auto* op = op_index.op(GRPC_OP_RECV_CLOSE_ON_SERVER)) {
144
158
  auto recv_trailing_metadata = OpHandler<GRPC_OP_RECV_CLOSE_ON_SERVER>(
145
- [this, cancelled = op->data.recv_close_on_server.cancelled]() {
146
- return Map(call_handler_.WasCancelled(),
147
- [cancelled, this](bool result) -> Success {
148
- saw_was_cancelled_.store(true,
149
- std::memory_order_relaxed);
150
- ResetDeadline();
159
+ [self = WeakRef(),
160
+ cancelled = op->data.recv_close_on_server.cancelled]() {
161
+ return Map(self->call_handler_.WasCancelled(),
162
+ [cancelled, self](bool result) -> Success {
163
+ self->saw_was_cancelled_.store(
164
+ true, std::memory_order_relaxed);
165
+ self->ResetDeadline();
151
166
  *cancelled = result ? 1 : 0;
152
167
  return Success{};
153
168
  });
@@ -232,8 +247,10 @@ void ServerCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
232
247
  std::move(metadata));
233
248
  };
234
249
  });
235
- auto send_message =
236
- op_index.OpHandler<GRPC_OP_SEND_MESSAGE>([this](const grpc_op& op) {
250
+ auto send_message = op_index.OpHandler<GRPC_OP_SEND_MESSAGE>(
251
+ [this, &concurrent_ops_to_reset](const grpc_op& op) {
252
+ concurrent_ops_to_reset |=
253
+ CallOpInvariantsValidator::OpBit(GRPC_OP_SEND_MESSAGE);
237
254
  SliceBuffer send;
238
255
  grpc_slice_buffer_swap(
239
256
  &op.data.send_message.send_message->data.raw.slice_buffer,
@@ -158,12 +158,16 @@ class ServerCall final : public Call, public DualRefCounted<ServerCall> {
158
158
  }
159
159
 
160
160
  private:
161
+ template <typename T>
162
+ friend class PrimaryOpsCleanup;
163
+
161
164
  void CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
162
165
  bool is_notify_tag_closure);
163
166
 
164
167
  std::string DebugTag() { return absl::StrFormat("SERVER_CALL[%p]: ", this); }
165
168
 
166
169
  CallHandler call_handler_;
170
+ CallOpInvariantsValidator call_op_invariants_validator_;
167
171
  std::atomic<bool> sent_server_initial_metadata_batch_{false};
168
172
  Latch<void> server_initial_metadata_scheduled_;
169
173
  MessageReceiver message_receiver_;
@@ -56,10 +56,15 @@ std::string TextEncode(upb_Message* message,
56
56
  auto* def = getmsgdef(def_pool);
57
57
  size_t size = upb_TextEncode(message, def, def_pool, 0, buf, sizeof(buf));
58
58
  if (size < sizeof(buf)) return std::string(buf, size);
59
- char* new_buf = new char[size];
60
- upb_TextEncode(message, def, def_pool, 0, new_buf, size);
61
- std::string result(new_buf, size);
62
- delete[] new_buf;
59
+ // upb_TextEncode has snprintf() semantics: it always NUL-terminates
60
+ // within the given capacity, so writing size content bytes requires
61
+ // a capacity of size + 1. We allocate size + 1 bytes in the string,
62
+ // let upb_TextEncode write the content and the NUL terminator, and then
63
+ // resize the string back to size to remove the NUL terminator from the
64
+ // string's active length.
65
+ std::string result(size + 1, '\0');
66
+ upb_TextEncode(message, def, def_pool, 0, result.data(), result.size());
67
+ result.resize(size);
63
68
  return result;
64
69
  }
65
70
 
@@ -22,6 +22,8 @@
22
22
  #include "google/protobuf/duration.upb.h"
23
23
  #include "google/protobuf/timestamp.upb.h"
24
24
  #include "google/protobuf/wrappers.upb.h"
25
+ #include "grpc/channelz/v1/channelz.upb.h"
26
+ #include "grpc/channelz/v1/channelz.upbdefs.h"
25
27
  #include "src/core/channelz/v2tov1/property_list.h"
26
28
  #include "src/core/lib/address_utils/parse_address.h"
27
29
  #include "src/core/lib/address_utils/sockaddr_utils.h"
@@ -29,8 +31,6 @@
29
31
  #include "src/core/util/json/json_writer.h"
30
32
  #include "src/core/util/upb_utils.h"
31
33
  #include "src/core/util/uri.h"
32
- #include "src/proto/grpc/channelz/channelz.upb.h"
33
- #include "src/proto/grpc/channelz/channelz.upbdefs.h"
34
34
  #include "src/proto/grpc/channelz/v2/channelz.upb.h"
35
35
  #include "src/proto/grpc/channelz/v2/property_list.upb.h"
36
36
  #include "upb/base/status.h"
@@ -63,8 +63,7 @@ static bool g_backup_polling_disabled;
63
63
 
64
64
  void grpc_client_channel_global_init_backup_polling() {
65
65
  g_backup_polling_disabled = grpc_core::IsEventEngineClientEnabled() &&
66
- grpc_core::IsEventEngineListenerEnabled() &&
67
- grpc_core::IsEventEngineDnsEnabled();
66
+ grpc_core::IsEventEngineListenerEnabled();
68
67
  if (g_backup_polling_disabled) {
69
68
  return;
70
69
  }
@@ -275,39 +275,6 @@ class ClientChannel::SubchannelWrapper::WatcherWrapper
275
275
  << subchannel_wrapper_->subchannel_.get()
276
276
  << " watcher=" << watcher_.get()
277
277
  << " state=" << ConnectivityStateName(state) << " status=" << status;
278
- if (!IsSubchannelConnectionScalingEnabled()) {
279
- auto keepalive_throttling = status.GetPayload(kKeepaliveThrottlingKey);
280
- if (keepalive_throttling.has_value()) {
281
- int new_keepalive_time_ms = -1;
282
- if (absl::SimpleAtoi(std::string(keepalive_throttling.value()),
283
- &new_keepalive_time_ms)) {
284
- Duration new_keepalive_time =
285
- Duration::Milliseconds(new_keepalive_time_ms);
286
- if (new_keepalive_time >
287
- subchannel_wrapper_->client_channel_->keepalive_time_) {
288
- subchannel_wrapper_->client_channel_->keepalive_time_ =
289
- new_keepalive_time;
290
- GRPC_TRACE_LOG(client_channel, INFO)
291
- << "client_channel="
292
- << subchannel_wrapper_->client_channel_.get()
293
- << ": throttling keepalive time to "
294
- << subchannel_wrapper_->client_channel_->keepalive_time_;
295
- // Propagate the new keepalive time to all subchannels. This is so
296
- // that new transports created by any subchannel (and not just the
297
- // subchannel that received the GOAWAY), use the new keepalive time.
298
- for (auto& [subchannel, _] :
299
- subchannel_wrapper_->client_channel_->subchannel_map_) {
300
- subchannel->ThrottleKeepaliveTime(new_keepalive_time);
301
- }
302
- }
303
- } else {
304
- LOG(ERROR) << "client_channel="
305
- << subchannel_wrapper_->client_channel_.get()
306
- << ": Illegal keepalive throttling value "
307
- << std::string(keepalive_throttling.value());
308
- }
309
- }
310
- }
311
278
  // Propagate status only in state TF.
312
279
  // We specifically want to avoid propagating the status for
313
280
  // state IDLE that the real subchannel gave us only for the
@@ -586,6 +553,12 @@ absl::StatusOr<RefCountedPtr<Channel>> ClientChannel::Create(
586
553
  if (target.empty()) {
587
554
  return absl::InternalError("target URI is empty in client channel");
588
555
  }
556
+ auto channel_args_mutator =
557
+ grpc_channel_args_get_client_channel_creation_mutator();
558
+ if (channel_args_mutator != nullptr) {
559
+ channel_args =
560
+ channel_args_mutator(target.c_str(), channel_args, GRPC_CLIENT_CHANNEL);
561
+ }
589
562
  std::string uri_to_resolve = CoreConfiguration::Get()
590
563
  .proxy_mapper_registry()
591
564
  .MapName(target, &channel_args)