grpc 1.83.1 → 1.84.0

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
@@ -263,11 +263,7 @@ void PollEventHandle::OrphanHandle(PosixEngineClosure* on_done,
263
263
  // Perform shutdown operations if not already done so.
264
264
  if (!is_shutdown_) {
265
265
  is_shutdown_ = true;
266
- shutdown_error_ =
267
- absl::Status(absl::StatusCode::kInternal, "FD Orphaned");
268
- grpc_core::StatusSetInt(&shutdown_error_,
269
- grpc_core::StatusIntProperty::kRpcStatus,
270
- GRPC_STATUS_UNAVAILABLE);
266
+ shutdown_error_ = absl::UnavailableError("FD Orphaned");
271
267
  SetReadyLocked(&read_closure_);
272
268
  SetReadyLocked(&write_closure_);
273
269
  }
@@ -341,11 +337,9 @@ void PollEventHandle::ShutdownHandle(absl::Status why) {
341
337
  // only shutdown once
342
338
  if (!is_shutdown_) {
343
339
  is_shutdown_ = true;
344
- shutdown_error_ = std::move(why);
345
- grpc_core::StatusSetInt(
346
- &shutdown_error_, grpc_core::StatusIntProperty::kRpcStatus,
347
- absl::IsCancelled(shutdown_error_) ? GRPC_STATUS_CANCELLED
348
- : GRPC_STATUS_UNAVAILABLE);
340
+ shutdown_error_ = absl::IsCancelled(why)
341
+ ? std::move(why)
342
+ : absl::UnavailableError(why.message());
349
343
  SetReadyLocked(&read_closure_);
350
344
  SetReadyLocked(&write_closure_);
351
345
  }
@@ -124,7 +124,7 @@ void rtrim(std::string& s) {
124
124
 
125
125
  uint64_t ParseUlimitMemLockFromFile(std::string file_name) {
126
126
  static std::string kHardMemlockPrefix = "* hard memlock";
127
- auto result = grpc_core::LoadFile(file_name, false);
127
+ auto result = grpc_core::LoadFile(file_name);
128
128
  if (!result.ok()) {
129
129
  return 0;
130
130
  }
@@ -216,10 +216,10 @@ bool CmsgIsZeroCopy(const cmsghdr& cmsg) {
216
216
  absl::Status PosixOSError(const PosixErrorOr<int64_t>& error_no,
217
217
  absl::string_view call_name) {
218
218
  if (error_no.IsPosixError()) {
219
- return absl::UnknownError(
219
+ return absl::UnavailableError(
220
220
  absl::StrCat(call_name, ": ", error_no.StrError()));
221
221
  }
222
- return absl::UnknownError(
222
+ return absl::UnavailableError(
223
223
  absl::StrCat(call_name, ": Wrong file descriptor generation"));
224
224
  }
225
225
 
@@ -280,15 +280,17 @@ void PosixEndpointImpl::FinishEstimate() {
280
280
  } else {
281
281
  target_length_ = 0.99 * target_length_ + 0.01 * bytes_read_this_round_;
282
282
  }
283
+ // Opt-in: if a maximum read buffer size has been configured, clamp the
284
+ // adaptive target so that occasional large reads do not leave a permanently
285
+ // high read-buffer high-watermark. When unset (max_read_buffer_size_ < 0)
286
+ // the behavior is unchanged.
287
+ if (max_read_buffer_size_ >= 0 &&
288
+ target_length_ > static_cast<double>(max_read_buffer_size_)) {
289
+ target_length_ = static_cast<double>(max_read_buffer_size_);
290
+ }
283
291
  bytes_read_this_round_ = 0;
284
292
  }
285
293
 
286
- absl::Status PosixEndpointImpl::TcpAnnotateError(absl::Status src_error) const {
287
- grpc_core::StatusSetInt(&src_error, grpc_core::StatusIntProperty::kRpcStatus,
288
- GRPC_STATUS_UNAVAILABLE);
289
- return src_error;
290
- }
291
-
292
294
  // Returns true if data available to read or error other than EAGAIN.
293
295
  bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
294
296
  GRPC_LATENT_SEE_ALWAYS_ON_SCOPE("TcpDoRead");
@@ -297,6 +299,7 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
297
299
  struct iovec iov[MAX_READ_IOVEC];
298
300
  size_t total_read_bytes = 0;
299
301
  size_t iov_len = std::min<size_t>(MAX_READ_IOVEC, incoming_buffer_->Count());
302
+ size_t slice_idx = iov_len;
300
303
  #ifdef GRPC_LINUX_ERRQUEUE
301
304
  constexpr size_t cmsg_alloc_space =
302
305
  CMSG_SPACE(sizeof(scm_timestamping)) + CMSG_SPACE(sizeof(int));
@@ -365,14 +368,11 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
365
368
  incoming_buffer_->Clear();
366
369
  if (res.IsWrongGenerationError()) {
367
370
  status = absl::CancelledError("Closed on fork");
368
- grpc_core::StatusSetInt(&status,
369
- grpc_core::StatusIntProperty::kRpcStatus,
370
- GRPC_STATUS_CANCELLED);
371
371
  } else if (read_bytes == 0) {
372
- status = TcpAnnotateError(absl::InternalError("Socket closed"));
372
+ status = absl::UnavailableError("Socket closed");
373
373
  } else {
374
- status = TcpAnnotateError(
375
- absl::InternalError(absl::StrCat("recvmsg:", res.StrError())));
374
+ status =
375
+ absl::UnavailableError(absl::StrCat("recvmsg:", res.StrError()));
376
376
  }
377
377
  return true;
378
378
  }
@@ -420,6 +420,19 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
420
420
  ++j;
421
421
  }
422
422
  iov_len = j;
423
+ // For cases where incoming_buffer_->Count() > MAX_READ_IOVEC, if the
424
+ // previous read resulted in a partial read, the previous loop remaining -=
425
+ // iov[i].iov_len; may execute for all of the IOVs. In that case iov_len
426
+ // would be 0. For this case, we need to add ptrs to the remaining
427
+ // slices in incoming_buffer_ to the IOV entries.
428
+ while (iov_len < MAX_READ_IOVEC && slice_idx < incoming_buffer_->Count()) {
429
+ MutableSlice& slice = internal::SliceCast<MutableSlice>(
430
+ incoming_buffer_->MutableSliceAt(slice_idx));
431
+ iov[iov_len].iov_base = slice.begin();
432
+ iov[iov_len].iov_len = slice.length();
433
+ iov_len++;
434
+ slice_idx++;
435
+ }
423
436
  } while (true);
424
437
 
425
438
  if (inq_ == 0) {
@@ -496,21 +509,18 @@ void PosixEndpointImpl::UpdateRcvLowat() {
496
509
  // TODO(ctiller): Check if supported by OS.
497
510
  // TODO(ctiller): Allow some adjustments instead of hardcoding things.
498
511
 
499
- static constexpr int kRcvLowatMax = 16 * 1024 * 1024;
500
512
  static constexpr int kRcvLowatThreshold = 16 * 1024;
501
513
 
502
514
  int remaining = std::min({static_cast<int>(incoming_buffer_->Length()),
503
- kRcvLowatMax, min_progress_size_});
515
+ rcv_lowat_max_, min_progress_size_});
504
516
 
505
517
  // Setting SO_RCVLOWAT for small quantities does not save on CPU.
506
- if (remaining < kRcvLowatThreshold) {
507
- remaining = 0;
508
- }
509
-
510
- // If zerocopy is off, wake shortly before the full RPC is here. More can
511
- // show up partway through recvmsg() since it takes a while to copy data.
512
- // So an early wakeup aids latency.
513
- if (!tcp_zerocopy_send_ctx_->Enabled() && remaining > 0) {
518
+ if (remaining < 2 * kRcvLowatThreshold) {
519
+ remaining = 1;
520
+ } else {
521
+ // Decrement remaining by kRcvLowatThreshold. This would have the effect of
522
+ // waking up a little early. It would help with latency because some bytes
523
+ // may arrive while we execute the recvmsg syscall after waking up.
514
524
  remaining -= kRcvLowatThreshold;
515
525
  }
516
526
 
@@ -579,11 +589,17 @@ bool PosixEndpointImpl::HandleReadLocked(absl::Status& status) {
579
589
  }
580
590
  } else {
581
591
  if (!memory_owner_.is_valid() && status.ok()) {
582
- status = TcpAnnotateError(absl::UnknownError("Shutting down endpoint"));
592
+ status = absl::UnavailableError("Shutting down endpoint");
583
593
  }
584
594
  incoming_buffer_->Clear();
585
595
  last_read_buffer_.Clear();
586
596
  }
597
+ // Update rcv lowat needs to be called at the end of the current read
598
+ // operation to ensure the right SO_RCVLOWAT value is set for the next read.
599
+ // Otherwise the next endpoint read operation may get stuck indefinitely
600
+ // because the previously set rcv lowat value will persist and the socket may
601
+ // erroneously considered to not be ready for read.
602
+ UpdateRcvLowat();
587
603
  return true;
588
604
  }
589
605
 
@@ -627,7 +643,6 @@ bool PosixEndpointImpl::Read(absl::AnyInvocable<void(absl::Status)> on_read,
627
643
  Ref().release();
628
644
  if (is_first_read_) {
629
645
  read_cb_ = std::move(on_read);
630
- UpdateRcvLowat();
631
646
  // Endpoint read called for the very first time. Register read callback
632
647
  // with the polling engine.
633
648
  is_first_read_ = false;
@@ -635,7 +650,6 @@ bool PosixEndpointImpl::Read(absl::AnyInvocable<void(absl::Status)> on_read,
635
650
  handle_->NotifyOnRead(on_read_);
636
651
  } else if (inq_ == 0) {
637
652
  read_cb_ = std::move(on_read);
638
- UpdateRcvLowat();
639
653
  lock.Release();
640
654
  // Upper layer asked to read more but we know there is no pending data to
641
655
  // read from previous reads. So, wait for POLLIN.
@@ -663,6 +677,12 @@ bool PosixEndpointImpl::Read(absl::AnyInvocable<void(absl::Status)> on_read,
663
677
  Unref();
664
678
  return false;
665
679
  }
680
+ // Update rcv lowat needs to be called at the end of the current read
681
+ // operation to ensure the right SO_RCVLOWAT value is set for the next read.
682
+ // Otherwise the next endpoint read operation may get stuck indefinitely
683
+ // because the previously set rcv lowat value will persist and the socket
684
+ // may erroneously considered to not be ready for read.
685
+ UpdateRcvLowat();
666
686
  // Read succeeded immediately. Return true and don't run the on_read
667
687
  // callback.
668
688
  incoming_buffer_ = nullptr;
@@ -1033,7 +1053,7 @@ bool PosixEndpointImpl::DoFlushZerocopy(TcpZerocopySendRecord* record,
1033
1053
  record->UnwindIfThrottled(unwind_slice_idx, unwind_byte_idx);
1034
1054
  return false;
1035
1055
  } else {
1036
- status = TcpAnnotateError(PosixOSError(send_status, "sendmsg"));
1056
+ status = PosixOSError(send_status, "sendmsg");
1037
1057
  return true;
1038
1058
  }
1039
1059
  }
@@ -1129,7 +1149,7 @@ bool PosixEndpointImpl::TcpFlush(absl::Status& status) {
1129
1149
  }
1130
1150
  return false;
1131
1151
  } else {
1132
- status = TcpAnnotateError(PosixOSError(send_result, "sendmsg"));
1152
+ status = PosixOSError(send_result, "sendmsg");
1133
1153
  outgoing_buffer_->Clear();
1134
1154
  return true;
1135
1155
  }
@@ -1205,7 +1225,7 @@ bool PosixEndpointImpl::Write(
1205
1225
  GRPC_TRACE_LOG(event_engine_endpoint, INFO)
1206
1226
  << "Endpoint[" << this << "]: Write skipped";
1207
1227
  if (handle_->IsHandleShutdown()) {
1208
- status = TcpAnnotateError(absl::InternalError("EOF"));
1228
+ status = absl::UnavailableError("EOF");
1209
1229
  engine_->Run(
1210
1230
  [on_writable = std::move(on_writable), status, this]() mutable {
1211
1231
  GRPC_TRACE_LOG(event_engine_endpoint, INFO)
@@ -1264,8 +1284,6 @@ void PosixEndpointImpl::MaybeShutdown(
1264
1284
  handle_->SetHasError();
1265
1285
  }
1266
1286
  on_release_fd_ = std::move(on_release_fd);
1267
- grpc_core::StatusSetInt(&why, grpc_core::StatusIntProperty::kRpcStatus,
1268
- GRPC_STATUS_UNAVAILABLE);
1269
1287
  handle_->ShutdownHandle(why);
1270
1288
  read_mu_.Lock();
1271
1289
  memory_owner_.Reset();
@@ -1299,6 +1317,28 @@ PosixEndpointImpl::PosixEndpointImpl(EventHandle* handle,
1299
1317
  FileDescriptor fd = handle_->WrappedFd();
1300
1318
  GRPC_CHECK(options.resource_quota != nullptr);
1301
1319
  auto& posix_interface = poller_->posix_interface();
1320
+ int rcvbuf_size = 0;
1321
+ socklen_t len = sizeof(rcvbuf_size);
1322
+ auto err =
1323
+ posix_interface.GetSockOpt(fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size, &len);
1324
+ if (err.ok()) {
1325
+ rcv_lowat_max_ = rcvbuf_size / 2;
1326
+ } else {
1327
+ rcv_lowat_max_ = 512 * 1024;
1328
+ LOG(ERROR) << "getsockopt(SO_RCVBUF) failed: " << err.StrError()
1329
+ << ", defaulting rcv_lowat_max_ to " << rcv_lowat_max_;
1330
+ }
1331
+ int rcvlowat_default = 0;
1332
+ socklen_t rcvlowat_len = sizeof(rcvlowat_default);
1333
+ auto rcvlowat_err = posix_interface.GetSockOpt(
1334
+ fd, SOL_SOCKET, SO_RCVLOWAT, &rcvlowat_default, &rcvlowat_len);
1335
+ if (rcvlowat_err.ok()) {
1336
+ set_rcvlowat_ = rcvlowat_default;
1337
+ } else {
1338
+ set_rcvlowat_ = 1;
1339
+ LOG(ERROR) << "getsockopt(SO_RCVLOWAT) failed: " << rcvlowat_err.StrError()
1340
+ << ", defaulting set_rcvlowat_ to " << set_rcvlowat_;
1341
+ }
1302
1342
  auto peer_addr_string = posix_interface.PeerAddressString(fd);
1303
1343
  mem_quota_ = options.resource_quota->memory_quota();
1304
1344
  memory_owner_ = mem_quota_->CreateMemoryOwner();
@@ -1315,6 +1355,7 @@ PosixEndpointImpl::PosixEndpointImpl(EventHandle* handle,
1315
1355
  bytes_read_this_round_ = 0;
1316
1356
  min_read_chunk_size_ = options.tcp_min_read_chunk_size;
1317
1357
  max_read_chunk_size_ = options.tcp_max_read_chunk_size;
1358
+ max_read_buffer_size_ = options.tcp_max_read_buffer_size;
1318
1359
  bool zerocopy_enabled =
1319
1360
  options.tcp_tx_zero_copy_enabled && poller_->CanTrackErrors();
1320
1361
  #ifdef GRPC_LINUX_ERRQUEUE
@@ -517,7 +517,6 @@ class PosixEndpointImpl : public grpc_core::RefCounted<PosixEndpointImpl> {
517
517
  bool WriteWithTimestamps(struct msghdr* msg, size_t sending_length,
518
518
  PosixErrorOr<int64_t>* sent_length, int* saved_errno,
519
519
  int additional_flags);
520
- absl::Status TcpAnnotateError(absl::Status src_error) const;
521
520
  #ifdef GRPC_LINUX_ERRQUEUE
522
521
  bool ProcessErrors();
523
522
  // Reads a cmsg to process zerocopy control messages.
@@ -531,6 +530,8 @@ class PosixEndpointImpl : public grpc_core::RefCounted<PosixEndpointImpl> {
531
530
  double target_length_;
532
531
  int min_read_chunk_size_;
533
532
  int max_read_chunk_size_;
533
+ int rcv_lowat_max_;
534
+ int max_read_buffer_size_;
534
535
  int64_t set_rcvlowat_ = 0;
535
536
  double bytes_read_this_round_ = 0;
536
537
 
@@ -637,15 +638,14 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
637
638
  void Shutdown(absl::AnyInvocable<void(absl::StatusOr<int> release_fd)>
638
639
  on_release_fd) override {
639
640
  if (!shutdown_.exchange(true, std::memory_order_acq_rel)) {
640
- impl_->MaybeShutdown(absl::FailedPreconditionError("Endpoint closing"),
641
+ impl_->MaybeShutdown(absl::UnavailableError("Endpoint closing"),
641
642
  std::move(on_release_fd));
642
643
  }
643
644
  }
644
645
 
645
646
  ~PosixEndpoint() override {
646
647
  if (!shutdown_.exchange(true, std::memory_order_acq_rel)) {
647
- impl_->MaybeShutdown(absl::FailedPreconditionError("Endpoint closing"),
648
- nullptr);
648
+ impl_->MaybeShutdown(absl::UnavailableError("Endpoint closing"), nullptr);
649
649
  }
650
650
  }
651
651
 
@@ -466,13 +466,17 @@ void PosixEventEngine::CancelAllPendingTimers() {
466
466
  PosixEventEngine::~PosixEventEngine() {
467
467
  {
468
468
  grpc_core::MutexLock lock(&mu_);
469
- if (GRPC_TRACE_FLAG_ENABLED(event_engine)) {
470
- for (auto handle : known_handles_) {
469
+ auto pending_handles = known_handles_;
470
+ for (auto handle : pending_handles) {
471
+ if (GRPC_TRACE_FLAG_ENABLED(event_engine)) {
471
472
  LOG(ERROR) << "(event_engine) PosixEventEngine:" << this
472
473
  << " uncleared TaskHandle at shutdown:"
473
474
  << HandleToString(handle);
474
475
  }
476
+ CancelInternal(handle);
475
477
  }
478
+ // Prevent new timers from being scheduled on this EventEngine.
479
+ disallow_new_timers_ = true;
476
480
  GRPC_CHECK(GPR_LIKELY(known_handles_.empty()));
477
481
  }
478
482
  #if defined(GRPC_POSIX_SOCKET_TCP)
@@ -84,6 +84,9 @@ PosixTcpOptions TcpOptionsFromEndpointConfig(const EndpointConfig& config) {
84
84
  AdjustValue(PosixTcpOptions::kDefaultMaxReadChunksize, 1,
85
85
  PosixTcpOptions::kMaxChunkSize,
86
86
  config.GetInt(GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE));
87
+ options.tcp_max_read_buffer_size =
88
+ AdjustValue(PosixTcpOptions::kMaxReadBufferSizeUnset, 1, INT_MAX,
89
+ config.GetInt(GRPC_ARG_TCP_MAX_READ_BUFFER_SIZE));
87
90
  options.tcp_tx_zerocopy_send_bytes_threshold =
88
91
  AdjustValue(PosixTcpOptions::kDefaultSendBytesThreshold, 0, INT_MAX,
89
92
  config.GetInt(GRPC_ARG_TCP_TX_ZEROCOPY_SEND_BYTES_THRESHOLD));
@@ -49,6 +49,7 @@ struct PosixTcpOptions {
49
49
  static constexpr int kDefaultMaxReadChunksize = 64 * 1024;
50
50
  static constexpr int kZerocpTxEnabledDefault = 0;
51
51
  static constexpr int kMaxChunkSize = 32 * 1024 * 1024;
52
+ static constexpr int kMaxReadBufferSizeUnset = -1;
52
53
  static constexpr int kDefaultMaxSends = 4;
53
54
  static constexpr size_t kDefaultSendBytesThreshold = 16 * 1024;
54
55
  // Let the system decide the proper buffer size.
@@ -57,6 +58,7 @@ struct PosixTcpOptions {
57
58
  int tcp_read_chunk_size = kDefaultReadChunkSize;
58
59
  int tcp_min_read_chunk_size = kDefaultMinReadChunksize;
59
60
  int tcp_max_read_chunk_size = kDefaultMaxReadChunksize;
61
+ int tcp_max_read_buffer_size = kMaxReadBufferSizeUnset;
60
62
  int tcp_tx_zerocopy_send_bytes_threshold = kDefaultSendBytesThreshold;
61
63
  int tcp_tx_zerocopy_max_simultaneous_sends = kDefaultMaxSends;
62
64
  int tcp_receive_buffer_size = kReadBufferSizeUnset;
@@ -127,6 +129,7 @@ struct PosixTcpOptions {
127
129
  tcp_read_chunk_size = other.tcp_read_chunk_size;
128
130
  tcp_min_read_chunk_size = other.tcp_min_read_chunk_size;
129
131
  tcp_max_read_chunk_size = other.tcp_max_read_chunk_size;
132
+ tcp_max_read_buffer_size = other.tcp_max_read_buffer_size;
130
133
  tcp_tx_zerocopy_send_bytes_threshold =
131
134
  other.tcp_tx_zerocopy_send_bytes_threshold;
132
135
  tcp_tx_zerocopy_max_simultaneous_sends =
@@ -302,9 +302,7 @@ void WindowsEndpoint::HandleReadClosure::Run() {
302
302
  if (buffer_->Length() == 0) {
303
303
  // Only send an error if there is no more data to consume. If the endpoint
304
304
  // or socket is shut down, the next read will discover that.
305
- status = absl::InternalError("End of TCP stream");
306
- grpc_core::StatusSetInt(&status, grpc_core::StatusIntProperty::kRpcStatus,
307
- GRPC_STATUS_UNAVAILABLE);
305
+ status = absl::UnavailableError("End of TCP stream");
308
306
  }
309
307
  return ResetAndReturnCallback()(status);
310
308
  }