grpc 1.74.1 → 1.75.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 (368) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +83 -41
  3. data/include/grpc/credentials.h +7 -1
  4. data/src/core/call/client_call.cc +4 -4
  5. data/src/core/call/filter_fusion.h +1230 -0
  6. data/src/core/call/metadata.cc +22 -0
  7. data/src/core/call/metadata.h +24 -2
  8. data/src/core/channelz/channelz.cc +10 -17
  9. data/src/core/channelz/channelz.h +58 -19
  10. data/src/core/channelz/channelz_registry.cc +0 -162
  11. data/src/core/channelz/channelz_registry.h +14 -7
  12. data/src/core/channelz/property_list.cc +19 -23
  13. data/src/core/channelz/property_list.h +3 -1
  14. data/src/core/channelz/v2tov1/convert.cc +683 -0
  15. data/src/core/channelz/v2tov1/convert.h +58 -0
  16. data/src/core/channelz/v2tov1/legacy_api.cc +425 -0
  17. data/src/core/channelz/v2tov1/legacy_api.h +32 -0
  18. data/src/core/channelz/v2tov1/property_list.cc +118 -0
  19. data/src/core/channelz/v2tov1/property_list.h +52 -0
  20. data/src/core/client_channel/client_channel_filter.cc +5 -4
  21. data/src/core/client_channel/client_channel_filter.h +2 -2
  22. data/src/core/client_channel/client_channel_internal.h +2 -1
  23. data/src/core/client_channel/load_balanced_call_destination.cc +6 -5
  24. data/src/core/client_channel/subchannel.cc +14 -6
  25. data/src/core/client_channel/subchannel.h +2 -0
  26. data/src/core/config/core_configuration.cc +3 -1
  27. data/src/core/config/core_configuration.h +12 -0
  28. data/src/core/credentials/transport/alts/alts_credentials.cc +5 -0
  29. data/src/core/credentials/transport/alts/check_gcp_environment_windows.cc +2 -0
  30. data/src/core/credentials/transport/channel_creds_registry_init.cc +3 -1
  31. data/src/core/credentials/transport/ssl/ssl_credentials.cc +1 -1
  32. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +8 -3
  33. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -24
  34. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +19 -8
  35. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +96 -54
  36. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +15 -2
  37. data/src/core/credentials/transport/tls/spiffe_utils.cc +371 -0
  38. data/src/core/credentials/transport/tls/spiffe_utils.h +171 -0
  39. data/src/core/credentials/transport/tls/ssl_utils.cc +11 -10
  40. data/src/core/credentials/transport/tls/ssl_utils.h +4 -2
  41. data/src/core/credentials/transport/tls/tls_credentials.cc +2 -0
  42. data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -26
  43. data/src/core/credentials/transport/tls/tls_security_connector.h +12 -12
  44. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -2
  45. data/src/core/ext/filters/http/client/http_client_filter.cc +3 -6
  46. data/src/core/ext/filters/http/client_authority_filter.cc +1 -2
  47. data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
  48. data/src/core/ext/filters/http/server/http_server_filter.cc +3 -6
  49. data/src/core/ext/filters/message_size/message_size_filter.cc +4 -4
  50. data/src/core/ext/filters/rbac/rbac_filter.cc +1 -1
  51. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -5
  52. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +3 -2
  53. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
  54. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -0
  55. data/src/core/ext/transport/chttp2/transport/frame.cc +89 -6
  56. data/src/core/ext/transport/chttp2/transport/frame.h +38 -0
  57. data/src/core/ext/transport/chttp2/transport/header_assembler.h +5 -14
  58. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -1
  59. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +294 -78
  60. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +128 -9
  61. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +11 -38
  62. data/src/core/ext/transport/chttp2/transport/http2_settings.h +52 -35
  63. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +61 -0
  64. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +142 -0
  65. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +81 -3
  66. data/src/core/ext/transport/chttp2/transport/http2_transport.h +12 -1
  67. data/src/core/ext/transport/chttp2/transport/message_assembler.h +2 -2
  68. data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -1
  69. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +2 -1
  70. data/src/core/ext/transport/chttp2/transport/ping_promise.h +22 -5
  71. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +607 -0
  72. data/src/core/ext/transport/chttp2/transport/writable_streams.h +254 -0
  73. data/src/core/ext/transport/chttp2/transport/writing.cc +6 -4
  74. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb.h +4959 -0
  75. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.c +1111 -0
  76. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.h +108 -0
  77. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +142 -54
  78. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +18 -14
  79. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +2 -2
  80. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +716 -0
  81. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.h +227 -0
  82. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c +86 -88
  83. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.h +2 -2
  84. data/src/core/filter/auth/auth_filters.h +2 -2
  85. data/src/core/filter/fused_filters.cc +154 -0
  86. data/src/core/handshaker/security/legacy_secure_endpoint.cc +1 -1
  87. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +965 -0
  88. data/src/core/handshaker/security/secure_endpoint.cc +28 -13
  89. data/src/core/handshaker/security/secure_endpoint.h +8 -0
  90. data/src/core/lib/channel/promise_based_filter.cc +15 -25
  91. data/src/core/lib/channel/promise_based_filter.h +6 -5
  92. data/src/core/lib/event_engine/ares_resolver.h +3 -1
  93. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +9 -5
  94. data/src/core/lib/event_engine/cf_engine/cf_engine.h +2 -1
  95. data/src/core/lib/event_engine/cf_engine/cfsocket_listener.cc +263 -0
  96. data/src/core/lib/event_engine/cf_engine/cfsocket_listener.h +107 -0
  97. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +31 -3
  98. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +12 -0
  99. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +12 -10
  100. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +6 -4
  101. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +15 -14
  102. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +7 -5
  103. data/src/core/lib/event_engine/posix_engine/event_poller.h +0 -8
  104. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +11 -5
  105. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -2
  106. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +1 -0
  107. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +4 -4
  108. data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -4
  109. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +2 -2
  110. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +188 -199
  111. data/src/core/lib/event_engine/posix_engine/posix_engine.h +30 -45
  112. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -1
  113. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +1 -1
  114. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +2 -1
  115. data/src/core/lib/experiments/experiments.cc +120 -6
  116. data/src/core/lib/experiments/experiments.h +46 -3
  117. data/src/core/lib/iomgr/combiner.cc +1 -1
  118. data/src/core/lib/iomgr/exec_ctx.h +3 -9
  119. data/src/core/lib/iomgr/socket_mutator.cc +1 -1
  120. data/src/core/lib/iomgr/socket_utils_posix.cc +1 -1
  121. data/src/core/lib/iomgr/socket_utils_posix.h +1 -1
  122. data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
  123. data/src/core/lib/iomgr/tcp_posix.cc +3 -3
  124. data/src/core/lib/promise/activity.h +2 -2
  125. data/src/core/lib/promise/mpsc.cc +8 -8
  126. data/src/core/lib/promise/party.cc +7 -7
  127. data/src/core/lib/promise/party.h +4 -4
  128. data/src/core/lib/promise/poll.h +10 -0
  129. data/src/core/lib/resource_quota/memory_quota.cc +90 -3
  130. data/src/core/lib/resource_quota/memory_quota.h +20 -9
  131. data/src/core/lib/resource_quota/periodic_update.cc +14 -0
  132. data/src/core/lib/resource_quota/periodic_update.h +8 -0
  133. data/src/core/lib/resource_quota/resource_quota.cc +15 -4
  134. data/src/core/lib/resource_quota/resource_quota.h +3 -0
  135. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -2
  136. data/src/core/lib/surface/call.cc +5 -5
  137. data/src/core/lib/surface/call.h +6 -5
  138. data/src/core/lib/surface/completion_queue.cc +2 -4
  139. data/src/core/lib/surface/filter_stack_call.cc +1 -1
  140. data/src/core/lib/surface/version.cc +2 -2
  141. data/src/core/lib/transport/promise_endpoint.cc +2 -2
  142. data/src/core/lib/transport/promise_endpoint.h +3 -3
  143. data/src/core/load_balancing/endpoint_list.cc +29 -2
  144. data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +3 -3
  145. data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +1 -1
  146. data/src/core/load_balancing/pick_first/pick_first.cc +12 -5
  147. data/src/core/load_balancing/xds/xds_cluster_impl.cc +5 -3
  148. data/src/core/net/socket_mutator.cc +19 -0
  149. data/src/core/net/socket_mutator.h +25 -0
  150. data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
  151. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +6 -1
  152. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +2 -1
  153. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +8 -5
  154. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -1
  155. data/src/core/resolver/xds/xds_dependency_manager.cc +1 -1
  156. data/src/core/server/server.cc +1 -1
  157. data/src/core/server/server_call_tracer_filter.cc +0 -66
  158. data/src/core/server/server_call_tracer_filter.h +64 -0
  159. data/src/core/server/server_config_selector_filter.cc +1 -1
  160. data/src/core/service_config/service_config_channel_arg_filter.cc +3 -60
  161. data/src/core/service_config/service_config_channel_arg_filter.h +82 -0
  162. data/src/core/telemetry/call_tracer.cc +20 -14
  163. data/src/core/telemetry/call_tracer.h +22 -17
  164. data/src/core/telemetry/metrics.h +8 -8
  165. data/src/core/telemetry/stats_data.cc +151 -151
  166. data/src/core/telemetry/stats_data.h +87 -87
  167. data/src/core/transport/auth_context.cc +20 -0
  168. data/src/core/transport/auth_context.h +4 -0
  169. data/src/core/transport/auth_context_comparator_registry.h +69 -0
  170. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +2 -3
  171. data/src/core/tsi/ssl_transport_security.cc +202 -32
  172. data/src/core/tsi/ssl_transport_security.h +19 -10
  173. data/src/core/tsi/ssl_transport_security_utils.cc +21 -0
  174. data/src/core/tsi/ssl_transport_security_utils.h +4 -0
  175. data/src/core/util/http_client/httpcli_security_connector.cc +3 -1
  176. data/src/core/util/latent_see.cc +178 -146
  177. data/src/core/util/latent_see.h +245 -188
  178. data/src/core/util/single_set_ptr.h +5 -2
  179. data/src/core/util/useful.h +91 -0
  180. data/src/core/util/windows/directory_reader.cc +1 -0
  181. data/src/core/util/windows/thd.cc +1 -3
  182. data/src/core/util/work_serializer.cc +1 -1
  183. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +32 -5
  184. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +5 -0
  185. data/src/core/xds/grpc/xds_certificate_provider.cc +5 -6
  186. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
  187. data/src/ruby/lib/grpc/version.rb +1 -1
  188. data/third_party/cares/cares/include/ares.h +925 -460
  189. data/third_party/cares/cares/include/ares_dns.h +86 -71
  190. data/third_party/cares/cares/include/ares_dns_record.h +1118 -0
  191. data/third_party/cares/cares/include/ares_nameser.h +215 -189
  192. data/third_party/cares/cares/include/ares_version.h +37 -14
  193. data/third_party/cares/cares/src/lib/ares_addrinfo2hostent.c +305 -0
  194. data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +245 -0
  195. data/third_party/cares/cares/src/lib/ares_android.c +216 -164
  196. data/third_party/cares/cares/src/lib/ares_android.h +25 -14
  197. data/third_party/cares/cares/src/lib/ares_cancel.c +68 -44
  198. data/third_party/cares/cares/src/lib/ares_close_sockets.c +137 -0
  199. data/third_party/cares/cares/src/lib/ares_conn.c +511 -0
  200. data/third_party/cares/cares/src/lib/ares_conn.h +196 -0
  201. data/third_party/cares/cares/src/lib/ares_cookie.c +461 -0
  202. data/third_party/cares/cares/src/lib/ares_data.c +93 -181
  203. data/third_party/cares/cares/src/lib/ares_data.h +50 -39
  204. data/third_party/cares/cares/src/lib/ares_destroy.c +127 -89
  205. data/third_party/cares/cares/src/lib/ares_free_hostent.c +35 -24
  206. data/third_party/cares/cares/src/lib/ares_free_string.c +24 -16
  207. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +45 -38
  208. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +549 -663
  209. data/third_party/cares/cares/src/lib/ares_getenv.c +25 -15
  210. data/third_party/cares/cares/src/lib/ares_getenv.h +26 -18
  211. data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +163 -221
  212. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +222 -223
  213. data/third_party/cares/cares/src/lib/ares_getnameinfo.c +328 -338
  214. data/third_party/cares/cares/src/lib/ares_hosts_file.c +952 -0
  215. data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +25 -19
  216. data/third_party/cares/cares/src/lib/ares_init.c +425 -2091
  217. data/third_party/cares/cares/src/lib/ares_ipv6.h +63 -33
  218. data/third_party/cares/cares/src/lib/ares_library_init.c +110 -54
  219. data/third_party/cares/cares/src/lib/ares_metrics.c +261 -0
  220. data/third_party/cares/cares/src/lib/ares_options.c +418 -332
  221. data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +179 -0
  222. data/third_party/cares/cares/src/lib/ares_private.h +558 -356
  223. data/third_party/cares/cares/src/lib/ares_process.c +1224 -1369
  224. data/third_party/cares/cares/src/lib/ares_qcache.c +430 -0
  225. data/third_party/cares/cares/src/lib/ares_query.c +126 -121
  226. data/third_party/cares/cares/src/lib/ares_search.c +564 -262
  227. data/third_party/cares/cares/src/lib/ares_send.c +264 -93
  228. data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +588 -0
  229. data/third_party/cares/cares/src/lib/ares_setup.h +115 -111
  230. data/third_party/cares/cares/src/lib/ares_socket.c +425 -0
  231. data/third_party/cares/cares/src/lib/ares_socket.h +163 -0
  232. data/third_party/cares/cares/src/lib/ares_sortaddrinfo.c +447 -0
  233. data/third_party/cares/cares/src/lib/ares_strerror.c +83 -48
  234. data/third_party/cares/cares/src/lib/ares_sysconfig.c +639 -0
  235. data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +839 -0
  236. data/third_party/cares/cares/src/lib/ares_sysconfig_mac.c +373 -0
  237. data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +621 -0
  238. data/third_party/cares/cares/src/lib/ares_timeout.c +136 -73
  239. data/third_party/cares/cares/src/lib/ares_update_servers.c +1362 -0
  240. data/third_party/cares/cares/src/lib/ares_version.c +29 -4
  241. data/third_party/cares/cares/src/lib/config-dos.h +88 -89
  242. data/third_party/cares/cares/src/lib/config-win32.h +122 -77
  243. data/third_party/cares/cares/src/lib/dsa/ares_array.c +394 -0
  244. data/third_party/cares/cares/src/lib/dsa/ares_htable.c +447 -0
  245. data/third_party/cares/cares/src/lib/dsa/ares_htable.h +174 -0
  246. data/third_party/cares/cares/src/lib/dsa/ares_htable_asvp.c +224 -0
  247. data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +228 -0
  248. data/third_party/cares/cares/src/lib/dsa/ares_htable_strvp.c +210 -0
  249. data/third_party/cares/cares/src/lib/dsa/ares_htable_szvp.c +188 -0
  250. data/third_party/cares/cares/src/lib/dsa/ares_htable_vpstr.c +186 -0
  251. data/third_party/cares/cares/src/lib/dsa/ares_htable_vpvp.c +194 -0
  252. data/third_party/cares/cares/src/lib/dsa/ares_llist.c +382 -0
  253. data/third_party/cares/cares/src/lib/dsa/ares_slist.c +479 -0
  254. data/third_party/cares/cares/src/lib/dsa/ares_slist.h +207 -0
  255. data/third_party/cares/cares/src/lib/event/ares_event.h +191 -0
  256. data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +743 -0
  257. data/third_party/cares/cares/src/lib/event/ares_event_epoll.c +192 -0
  258. data/third_party/cares/cares/src/lib/event/ares_event_kqueue.c +248 -0
  259. data/third_party/cares/cares/src/lib/event/ares_event_poll.c +140 -0
  260. data/third_party/cares/cares/src/lib/event/ares_event_select.c +159 -0
  261. data/third_party/cares/cares/src/lib/event/ares_event_thread.c +567 -0
  262. data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +166 -0
  263. data/third_party/cares/cares/src/lib/event/ares_event_win32.c +978 -0
  264. data/third_party/cares/cares/src/lib/event/ares_event_win32.h +161 -0
  265. data/third_party/cares/cares/src/lib/include/ares_array.h +276 -0
  266. data/third_party/cares/cares/src/lib/include/ares_buf.h +732 -0
  267. data/third_party/cares/cares/src/lib/include/ares_htable_asvp.h +130 -0
  268. data/third_party/cares/cares/src/lib/include/ares_htable_dict.h +123 -0
  269. data/third_party/cares/cares/src/lib/include/ares_htable_strvp.h +130 -0
  270. data/third_party/cares/cares/src/lib/include/ares_htable_szvp.h +118 -0
  271. data/third_party/cares/cares/src/lib/include/ares_htable_vpstr.h +111 -0
  272. data/third_party/cares/cares/src/lib/include/ares_htable_vpvp.h +128 -0
  273. data/third_party/cares/cares/src/lib/include/ares_llist.h +239 -0
  274. data/third_party/cares/cares/src/lib/include/ares_mem.h +38 -0
  275. data/third_party/cares/cares/src/lib/include/ares_str.h +244 -0
  276. data/third_party/cares/cares/src/lib/inet_net_pton.c +202 -157
  277. data/third_party/cares/cares/src/lib/inet_ntop.c +87 -69
  278. data/third_party/cares/cares/src/lib/legacy/ares_create_query.c +78 -0
  279. data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +99 -0
  280. data/third_party/cares/cares/src/lib/legacy/ares_expand_string.c +107 -0
  281. data/third_party/cares/cares/src/lib/legacy/ares_fds.c +80 -0
  282. data/third_party/cares/cares/src/lib/legacy/ares_getsock.c +85 -0
  283. data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +107 -0
  284. data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +109 -0
  285. data/third_party/cares/cares/src/lib/legacy/ares_parse_caa_reply.c +137 -0
  286. data/third_party/cares/cares/src/lib/legacy/ares_parse_mx_reply.c +110 -0
  287. data/third_party/cares/cares/src/lib/legacy/ares_parse_naptr_reply.c +132 -0
  288. data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +154 -0
  289. data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +213 -0
  290. data/third_party/cares/cares/src/lib/legacy/ares_parse_soa_reply.c +115 -0
  291. data/third_party/cares/cares/src/lib/legacy/ares_parse_srv_reply.c +114 -0
  292. data/third_party/cares/cares/src/lib/legacy/ares_parse_txt_reply.c +144 -0
  293. data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +113 -0
  294. data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +982 -0
  295. data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +307 -0
  296. data/third_party/cares/cares/src/lib/record/ares_dns_multistring.h +72 -0
  297. data/third_party/cares/cares/src/lib/record/ares_dns_name.c +673 -0
  298. data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +1329 -0
  299. data/third_party/cares/cares/src/lib/record/ares_dns_private.h +273 -0
  300. data/third_party/cares/cares/src/lib/record/ares_dns_record.c +1661 -0
  301. data/third_party/cares/cares/src/lib/record/ares_dns_write.c +1229 -0
  302. data/third_party/cares/cares/src/lib/str/ares_buf.c +1498 -0
  303. data/third_party/cares/cares/src/lib/str/ares_str.c +508 -0
  304. data/third_party/cares/cares/src/lib/str/ares_strsplit.c +90 -0
  305. data/third_party/cares/cares/src/lib/str/ares_strsplit.h +51 -0
  306. data/third_party/cares/cares/src/lib/thirdparty/apple/dnsinfo.h +122 -0
  307. data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +628 -0
  308. data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +139 -0
  309. data/third_party/cares/cares/src/lib/util/ares_math.c +158 -0
  310. data/third_party/cares/cares/src/lib/util/ares_math.h +45 -0
  311. data/third_party/cares/cares/src/lib/util/ares_rand.c +389 -0
  312. data/third_party/cares/cares/src/lib/util/ares_rand.h +36 -0
  313. data/third_party/cares/cares/src/lib/util/ares_threads.c +614 -0
  314. data/third_party/cares/cares/src/lib/util/ares_threads.h +60 -0
  315. data/third_party/cares/cares/src/lib/util/ares_time.h +48 -0
  316. data/third_party/cares/cares/src/lib/util/ares_timeval.c +95 -0
  317. data/third_party/cares/cares/src/lib/util/ares_uri.c +1626 -0
  318. data/third_party/cares/cares/src/lib/util/ares_uri.h +252 -0
  319. data/third_party/cares/cares/src/lib/windows_port.c +16 -9
  320. metadata +121 -49
  321. data/src/core/util/ring_buffer.h +0 -122
  322. data/third_party/cares/cares/include/ares_rules.h +0 -125
  323. data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +0 -266
  324. data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +0 -240
  325. data/third_party/cares/cares/src/lib/ares__close_sockets.c +0 -61
  326. data/third_party/cares/cares/src/lib/ares__get_hostent.c +0 -260
  327. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +0 -229
  328. data/third_party/cares/cares/src/lib/ares__read_line.c +0 -73
  329. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +0 -258
  330. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +0 -507
  331. data/third_party/cares/cares/src/lib/ares__timeval.c +0 -111
  332. data/third_party/cares/cares/src/lib/ares_create_query.c +0 -197
  333. data/third_party/cares/cares/src/lib/ares_expand_name.c +0 -311
  334. data/third_party/cares/cares/src/lib/ares_expand_string.c +0 -67
  335. data/third_party/cares/cares/src/lib/ares_fds.c +0 -59
  336. data/third_party/cares/cares/src/lib/ares_getsock.c +0 -66
  337. data/third_party/cares/cares/src/lib/ares_iphlpapi.h +0 -221
  338. data/third_party/cares/cares/src/lib/ares_llist.c +0 -63
  339. data/third_party/cares/cares/src/lib/ares_llist.h +0 -39
  340. data/third_party/cares/cares/src/lib/ares_mkquery.c +0 -24
  341. data/third_party/cares/cares/src/lib/ares_nowarn.c +0 -260
  342. data/third_party/cares/cares/src/lib/ares_nowarn.h +0 -61
  343. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +0 -90
  344. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +0 -92
  345. data/third_party/cares/cares/src/lib/ares_parse_caa_reply.c +0 -199
  346. data/third_party/cares/cares/src/lib/ares_parse_mx_reply.c +0 -164
  347. data/third_party/cares/cares/src/lib/ares_parse_naptr_reply.c +0 -183
  348. data/third_party/cares/cares/src/lib/ares_parse_ns_reply.c +0 -177
  349. data/third_party/cares/cares/src/lib/ares_parse_ptr_reply.c +0 -228
  350. data/third_party/cares/cares/src/lib/ares_parse_soa_reply.c +0 -179
  351. data/third_party/cares/cares/src/lib/ares_parse_srv_reply.c +0 -168
  352. data/third_party/cares/cares/src/lib/ares_parse_txt_reply.c +0 -214
  353. data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +0 -184
  354. data/third_party/cares/cares/src/lib/ares_platform.c +0 -11042
  355. data/third_party/cares/cares/src/lib/ares_platform.h +0 -43
  356. data/third_party/cares/cares/src/lib/ares_rand.c +0 -279
  357. data/third_party/cares/cares/src/lib/ares_strcasecmp.c +0 -66
  358. data/third_party/cares/cares/src/lib/ares_strcasecmp.h +0 -30
  359. data/third_party/cares/cares/src/lib/ares_strdup.c +0 -42
  360. data/third_party/cares/cares/src/lib/ares_strdup.h +0 -24
  361. data/third_party/cares/cares/src/lib/ares_strsplit.c +0 -94
  362. data/third_party/cares/cares/src/lib/ares_strsplit.h +0 -42
  363. data/third_party/cares/cares/src/lib/ares_writev.c +0 -79
  364. data/third_party/cares/cares/src/lib/ares_writev.h +0 -36
  365. data/third_party/cares/cares/src/lib/bitncmp.c +0 -59
  366. data/third_party/cares/cares/src/lib/bitncmp.h +0 -26
  367. data/third_party/cares/cares/src/lib/setup_once.h +0 -554
  368. data/third_party/cares/cares/src/tools/ares_getopt.h +0 -53
@@ -35,6 +35,7 @@
35
35
  #include "absl/log/check.h"
36
36
  #include "absl/log/log.h"
37
37
  #include "absl/strings/string_view.h"
38
+ #include "src/core/channelz/channelz.h"
38
39
  #include "src/core/lib/debug/trace.h"
39
40
  #include "src/core/lib/experiments/experiments.h"
40
41
  #include "src/core/lib/promise/activity.h"
@@ -233,6 +234,7 @@ class PressureController {
233
234
  double Update(double error);
234
235
  // Textual representation of the controller.
235
236
  std::string DebugString() const;
237
+ channelz::PropertyList ChannelzProperties() const;
236
238
 
237
239
  private:
238
240
  // How many update periods have we reached the same decision in a row?
@@ -264,6 +266,8 @@ class PressureTracker {
264
266
  public:
265
267
  double AddSampleAndGetControlValue(double sample);
266
268
 
269
+ channelz::PropertyList ChannelzProperties();
270
+
267
271
  private:
268
272
  std::atomic<double> max_this_round_{0.0};
269
273
  std::atomic<double> report_{0.0};
@@ -279,7 +283,8 @@ static constexpr size_t kBigAllocatorThreshold = 0.5 * 1024 * 1024;
279
283
  static constexpr size_t kSmallAllocatorThreshold = 0.1 * 1024 * 1024;
280
284
 
281
285
  class BasicMemoryQuota final
282
- : public std::enable_shared_from_this<BasicMemoryQuota> {
286
+ : public std::enable_shared_from_this<BasicMemoryQuota>,
287
+ public channelz::DataSource {
283
288
  public:
284
289
  // Data about current memory pressure.
285
290
  struct PressureInfo {
@@ -292,7 +297,9 @@ class BasicMemoryQuota final
292
297
  size_t max_recommended_allocation_size = 0;
293
298
  };
294
299
 
295
- explicit BasicMemoryQuota(std::string name);
300
+ explicit BasicMemoryQuota(
301
+ RefCountedPtr<channelz::ResourceQuotaNode> channelz_node);
302
+ ~BasicMemoryQuota() { channelz::DataSource::SourceDestructing(); }
296
303
 
297
304
  // Start the reclamation activity.
298
305
  void Start();
@@ -324,7 +331,9 @@ class BasicMemoryQuota final
324
331
  ReclaimerQueue* reclaimer_queue(size_t i) { return &reclaimers_[i]; }
325
332
 
326
333
  // The name of this quota
327
- absl::string_view name() const { return name_; }
334
+ absl::string_view name() const { return channelz_node()->name(); }
335
+
336
+ void AddData(channelz::DataSink sink) override;
328
337
 
329
338
  private:
330
339
  friend class ReclamationSweep;
@@ -378,8 +387,6 @@ class BasicMemoryQuota final
378
387
  std::atomic<uint64_t> reclamation_counter_{0};
379
388
  // Memory pressure smoothing
380
389
  memory_quota_detail::PressureTracker pressure_tracker_;
381
- // The name of this quota - used for debugging/tracing/etc..
382
- std::string name_;
383
390
  };
384
391
 
385
392
  // MemoryAllocatorImpl grants the owner the ability to allocate memory from an
@@ -453,6 +460,8 @@ class GrpcMemoryAllocatorImpl final : public EventEngineMemoryAllocatorImpl {
453
460
  return chosen_shard_idx_.fetch_add(1, std::memory_order_relaxed);
454
461
  }
455
462
 
463
+ void FillChannelzProperties(channelz::PropertyList& list);
464
+
456
465
  private:
457
466
  static constexpr size_t kMaxQuotaBufferSize = 1024 * 1024;
458
467
 
@@ -550,8 +559,9 @@ class MemoryOwner final : public MemoryAllocator {
550
559
  class MemoryQuota final
551
560
  : public grpc_event_engine::experimental::MemoryAllocatorFactory {
552
561
  public:
553
- explicit MemoryQuota(std::string name)
554
- : memory_quota_(std::make_shared<BasicMemoryQuota>(std::move(name))) {
562
+ explicit MemoryQuota(RefCountedPtr<channelz::ResourceQuotaNode> channelz_node)
563
+ : memory_quota_(
564
+ std::make_shared<BasicMemoryQuota>(std::move(channelz_node))) {
555
565
  memory_quota_->Start();
556
566
  }
557
567
  ~MemoryQuota() override {
@@ -580,8 +590,9 @@ class MemoryQuota final
580
590
  };
581
591
 
582
592
  using MemoryQuotaRefPtr = std::shared_ptr<MemoryQuota>;
583
- inline MemoryQuotaRefPtr MakeMemoryQuota(std::string name) {
584
- return std::make_shared<MemoryQuota>(std::move(name));
593
+ inline MemoryQuotaRefPtr MakeMemoryQuota(
594
+ RefCountedPtr<channelz::ResourceQuotaNode> channelz_node) {
595
+ return std::make_shared<MemoryQuota>(std::move(channelz_node));
585
596
  }
586
597
 
587
598
  std::vector<std::shared_ptr<BasicMemoryQuota>> AllMemoryQuotas();
@@ -22,6 +22,20 @@
22
22
 
23
23
  namespace grpc_core {
24
24
 
25
+ bool PeriodicUpdate::Interrupt(absl::FunctionRef<void(Duration)> f) {
26
+ int64_t old_value = updates_remaining_.load(std::memory_order_acquire);
27
+ while (true) {
28
+ if (old_value <= 1) return false;
29
+ if (!updates_remaining_.compare_exchange_weak(old_value, 0,
30
+ std::memory_order_acquire)) {
31
+ continue;
32
+ }
33
+ f(Timestamp::Now() - period_start_);
34
+ updates_remaining_.store(old_value, std::memory_order_release);
35
+ return true;
36
+ }
37
+ }
38
+
25
39
  bool PeriodicUpdate::MaybeEndPeriod(absl::FunctionRef<void(Duration)> f) {
26
40
  if (period_start_ == Timestamp::ProcessEpoch()) {
27
41
  period_start_ = Timestamp::Now();
@@ -48,6 +48,14 @@ class PeriodicUpdate {
48
48
  return false;
49
49
  }
50
50
 
51
+ // Interrupt execution: call f as if the period expired, and then continue
52
+ // from where we left off.
53
+ // Returns false if this was not possible (eg we were at the end of a tick)
54
+ // Argument to the callback is the amount of time expired so far.
55
+ bool Interrupt(absl::FunctionRef<void(Duration)> f);
56
+
57
+ Duration period() const { return period_; }
58
+
51
59
  private:
52
60
  bool MaybeEndPeriod(absl::FunctionRef<void(Duration)> f);
53
61
 
@@ -16,18 +16,29 @@
16
16
 
17
17
  #include <grpc/support/port_platform.h>
18
18
 
19
+ #include "src/core/util/no_destruct.h"
20
+ #include "src/core/util/single_set_ptr.h"
21
+
19
22
  namespace grpc_core {
20
23
 
21
24
  ResourceQuota::ResourceQuota(std::string name)
22
- : memory_quota_(MakeMemoryQuota(std::move(name))),
25
+ : channelz_node_(
26
+ MakeRefCounted<channelz::ResourceQuotaNode>(std::move(name))),
27
+ memory_quota_(MakeMemoryQuota(channelz_node_)),
23
28
  thread_quota_(MakeRefCounted<ThreadQuota>()) {}
24
29
 
25
30
  ResourceQuota::~ResourceQuota() = default;
26
31
 
32
+ namespace {
33
+ NoDestruct<SingleSetRefCountedPtr<ResourceQuota>> default_resource_quota{};
34
+ } // namespace
35
+
27
36
  ResourceQuotaRefPtr ResourceQuota::Default() {
28
- static auto default_resource_quota =
29
- MakeResourceQuota("default_resource_quota").release();
30
- return default_resource_quota->Ref();
37
+ return default_resource_quota->GetOrCreate("default_resource_quota");
38
+ }
39
+
40
+ void ResourceQuota::TestOnlyResetDefaultResourceQuota() {
41
+ default_resource_quota->Reset();
31
42
  }
32
43
 
33
44
  } // namespace grpc_core
@@ -23,6 +23,7 @@
23
23
  #include <utility>
24
24
 
25
25
  #include "absl/strings/string_view.h"
26
+ #include "src/core/channelz/channelz.h"
26
27
  #include "src/core/lib/resource_quota/memory_quota.h"
27
28
  #include "src/core/lib/resource_quota/thread_quota.h"
28
29
  #include "src/core/util/cpp_impl_of.h"
@@ -53,6 +54,7 @@ class ResourceQuota : public RefCounted<ResourceQuota>,
53
54
 
54
55
  // The default global resource quota
55
56
  static ResourceQuotaRefPtr Default();
57
+ static void TestOnlyResetDefaultResourceQuota();
56
58
 
57
59
  static int ChannelArgsCompare(const ResourceQuota* a,
58
60
  const ResourceQuota* b) {
@@ -60,6 +62,7 @@ class ResourceQuota : public RefCounted<ResourceQuota>,
60
62
  }
61
63
 
62
64
  private:
65
+ RefCountedPtr<channelz::ResourceQuotaNode> channelz_node_;
63
66
  MemoryQuotaRefPtr memory_quota_;
64
67
  RefCountedPtr<ThreadQuota> thread_quota_;
65
68
  };
@@ -92,8 +92,7 @@ bool GrpcServerAuthzFilter::IsAuthorized(ClientMetadata& initial_metadata) {
92
92
 
93
93
  absl::Status GrpcServerAuthzFilter::Call::OnClientInitialMetadata(
94
94
  ClientMetadata& md, GrpcServerAuthzFilter* filter) {
95
- GRPC_LATENT_SEE_INNER_SCOPE(
96
- "GrpcServerAuthzFilter::Call::OnClientInitialMetadata");
95
+ GRPC_LATENT_SEE_SCOPE("GrpcServerAuthzFilter::Call::OnClientInitialMetadata");
97
96
  if (!filter->IsAuthorized(md)) {
98
97
  return absl::PermissionDeniedError("Unauthorized RPC request rejected.");
99
98
  }
@@ -490,13 +490,13 @@ grpc_call_error grpc_call_start_batch_and_execute(grpc_call* call,
490
490
  }
491
491
 
492
492
  void grpc_call_tracer_set(grpc_call* call,
493
- grpc_core::ClientCallTracer* tracer) {
494
- grpc_core::Arena* arena = grpc_call_get_arena(call);
495
- return arena->SetContext<grpc_core::CallTracerAnnotationInterface>(tracer);
493
+ grpc_core::ClientCallTracerInterface* tracer) {
494
+ grpc_call_get_arena(call)
495
+ ->SetContext<grpc_core::CallTracerAnnotationInterface>(tracer);
496
496
  }
497
497
 
498
- void grpc_call_tracer_set_and_manage(grpc_call* call,
499
- grpc_core::ClientCallTracer* tracer) {
498
+ void grpc_call_tracer_set_and_manage(
499
+ grpc_call* call, grpc_core::ClientCallTracerInterface* tracer) {
500
500
  grpc_core::Arena* arena = grpc_call_get_arena(call);
501
501
  arena->ManagedNew<ClientCallTracerWrapper>(tracer);
502
502
  return arena->SetContext<grpc_core::CallTracerAnnotationInterface>(tracer);
@@ -262,7 +262,8 @@ grpc_call* grpc_call_from_top_element(grpc_call_element* surface_element);
262
262
  void grpc_call_log_batch(const char* file, int line, const grpc_op* ops,
263
263
  size_t nops);
264
264
 
265
- void grpc_call_tracer_set(grpc_call* call, grpc_core::ClientCallTracer* tracer);
265
+ void grpc_call_tracer_set(grpc_call* call,
266
+ grpc_core::ClientCallTracerInterface* tracer);
266
267
 
267
268
  // Sets call tracer on the call and manages its life by using the call's arena.
268
269
  // When using this API, the tracer will be destroyed by grpc_call arena when
@@ -271,8 +272,8 @@ void grpc_call_tracer_set(grpc_call* call, grpc_core::ClientCallTracer* tracer);
271
272
  // Arena to manage the lifetime of the call tracer. Python needs this API
272
273
  // because the tracer was created within a separate shared object library which
273
274
  // doesn't have access to core functions like arena->ManagedNew<>.
274
- void grpc_call_tracer_set_and_manage(grpc_call* call,
275
- grpc_core::ClientCallTracer* tracer);
275
+ void grpc_call_tracer_set_and_manage(
276
+ grpc_call* call, grpc_core::ClientCallTracerInterface* tracer);
276
277
 
277
278
  void* grpc_call_tracer_get(grpc_call* call);
278
279
 
@@ -287,11 +288,11 @@ uint8_t grpc_call_is_client(grpc_call* call);
287
288
 
288
289
  class ClientCallTracerWrapper {
289
290
  public:
290
- explicit ClientCallTracerWrapper(grpc_core::ClientCallTracer* tracer)
291
+ explicit ClientCallTracerWrapper(grpc_core::ClientCallTracerInterface* tracer)
291
292
  : tracer_(tracer) {}
292
293
 
293
294
  private:
294
- std::unique_ptr<grpc_core::ClientCallTracer> tracer_;
295
+ std::unique_ptr<grpc_core::ClientCallTracerInterface> tracer_;
295
296
  };
296
297
 
297
298
  // Return an appropriate compression algorithm for the requested compression \a
@@ -933,8 +933,7 @@ struct cq_is_finished_arg {
933
933
  class ExecCtxNext : public grpc_core::ExecCtx {
934
934
  public:
935
935
  explicit ExecCtxNext(void* arg)
936
- : ExecCtx(0, GRPC_LATENT_SEE_METADATA("ExecCtx for CqNext")),
937
- check_ready_to_finish_arg_(arg) {}
936
+ : ExecCtx(0), check_ready_to_finish_arg_(arg) {}
938
937
 
939
938
  bool CheckReadyToFinish() override {
940
939
  cq_is_finished_arg* a =
@@ -1181,8 +1180,7 @@ static void del_plucker(grpc_completion_queue* cq, void* tag,
1181
1180
  class ExecCtxPluck : public grpc_core::ExecCtx {
1182
1181
  public:
1183
1182
  explicit ExecCtxPluck(void* arg)
1184
- : ExecCtx(0, GRPC_LATENT_SEE_METADATA("ExecCtx for CqPluck")),
1185
- check_ready_to_finish_arg_(arg) {}
1183
+ : ExecCtx(0), check_ready_to_finish_arg_(arg) {}
1186
1184
 
1187
1185
  bool CheckReadyToFinish() override {
1188
1186
  cq_is_finished_arg* a =
@@ -746,7 +746,7 @@ void FilterStackCall::BatchControl::FinishBatch(grpc_error_handle error) {
746
746
  grpc_call_error FilterStackCall::StartBatch(const grpc_op* ops, size_t nops,
747
747
  void* notify_tag,
748
748
  bool is_notify_tag_closure) {
749
- GRPC_LATENT_SEE_INNER_SCOPE("FilterStackCall::StartBatch");
749
+ GRPC_LATENT_SEE_SCOPE("FilterStackCall::StartBatch");
750
750
 
751
751
  size_t i;
752
752
  const grpc_op* op;
@@ -22,6 +22,6 @@
22
22
  #include <grpc/grpc.h>
23
23
  #include <grpc/support/port_platform.h>
24
24
 
25
- const char* grpc_version_string(void) { return "49.0.0"; }
25
+ const char* grpc_version_string(void) { return "50.0.0"; }
26
26
 
27
- const char* grpc_g_stands_for(void) { return "gee"; }
27
+ const char* grpc_g_stands_for(void) { return "gemini"; }
@@ -57,7 +57,7 @@ PromiseEndpoint::GetLocalAddress() const {
57
57
 
58
58
  void PromiseEndpoint::ReadState::Complete(absl::Status status,
59
59
  const size_t num_bytes_requested) {
60
- GRPC_LATENT_SEE_INNER_SCOPE("PromiseEndpoint::ReadState::Complete");
60
+ GRPC_LATENT_SEE_SCOPE("PromiseEndpoint::ReadState::Complete");
61
61
  while (true) {
62
62
  if (!status.ok()) {
63
63
  // Invalidates all previous reads.
@@ -74,7 +74,7 @@ void PromiseEndpoint::ReadState::Complete(absl::Status status,
74
74
  buffer);
75
75
  DCHECK(pending_buffer.Count() == 0u);
76
76
  if (buffer.Length() < num_bytes_requested) {
77
- GRPC_LATENT_SEE_INNER_SCOPE("PromiseEndpoint::ReadState::Continue");
77
+ GRPC_LATENT_SEE_SCOPE("PromiseEndpoint::ReadState::Continue");
78
78
  // A further read is needed.
79
79
  // Set read args with number of bytes needed as hint.
80
80
  grpc_event_engine::experimental::EventEngine::Endpoint::ReadArgs
@@ -74,7 +74,7 @@ class PromiseEndpoint {
74
74
  // `Write()` before the previous write finishes. Doing that results in
75
75
  // undefined behavior.
76
76
  auto Write(SliceBuffer data, WriteArgs write_args) {
77
- GRPC_LATENT_SEE_PARENT_SCOPE("GRPC:Write");
77
+ GRPC_LATENT_SEE_SCOPE("GRPC:Write");
78
78
  // Start write and assert previous write finishes.
79
79
  auto prev = write_state_->state.exchange(WriteState::kWriting,
80
80
  std::memory_order_relaxed);
@@ -136,14 +136,14 @@ class PromiseEndpoint {
136
136
  // `Read()` before the previous read finishes. Doing that results in
137
137
  // undefined behavior.
138
138
  auto Read(size_t num_bytes) {
139
- GRPC_LATENT_SEE_PARENT_SCOPE("GRPC:Read");
139
+ GRPC_LATENT_SEE_SCOPE("GRPC:Read");
140
140
  // Assert previous read finishes.
141
141
  CHECK(!read_state_->complete.load(std::memory_order_relaxed));
142
142
  // Should not have pending reads.
143
143
  CHECK_EQ(read_state_->pending_buffer.Count(), 0u);
144
144
  bool complete = true;
145
145
  while (read_state_->buffer.Length() < num_bytes) {
146
- GRPC_LATENT_SEE_INNER_SCOPE("GRPC:Read:Loop");
146
+ GRPC_LATENT_SEE_SCOPE("GRPC:Read:Loop");
147
147
  // Set read args with hinted bytes.
148
148
  grpc_event_engine::experimental::EventEngine::Endpoint::ReadArgs
149
149
  read_args;
@@ -28,10 +28,12 @@
28
28
 
29
29
  #include "absl/log/check.h"
30
30
  #include "absl/log/log.h"
31
+ #include "absl/random/random.h"
31
32
  #include "absl/status/status.h"
32
33
  #include "absl/status/statusor.h"
33
34
  #include "src/core/config/core_configuration.h"
34
35
  #include "src/core/lib/channel/channel_args.h"
36
+ #include "src/core/lib/experiments/experiments.h"
35
37
  #include "src/core/lib/iomgr/pollset_set.h"
36
38
  #include "src/core/load_balancing/delegating_helper.h"
37
39
  #include "src/core/load_balancing/lb_policy.h"
@@ -42,6 +44,7 @@
42
44
  #include "src/core/util/json/json.h"
43
45
  #include "src/core/util/orphanable.h"
44
46
  #include "src/core/util/ref_counted_ptr.h"
47
+ #include "src/core/util/shared_bit_gen.h"
45
48
 
46
49
  namespace grpc_core {
47
50
 
@@ -168,10 +171,34 @@ void EndpointList::Init(
168
171
  const ChannelArgs&)>
169
172
  create_endpoint) {
170
173
  if (endpoints == nullptr) return;
174
+ if (!IsRrWrrConnectFromRandomIndexEnabled()) {
175
+ endpoints->ForEach([&](const EndpointAddresses& endpoint) {
176
+ endpoints_.push_back(
177
+ create_endpoint(Ref(DEBUG_LOCATION, "Endpoint"), endpoint, args));
178
+ });
179
+ return;
180
+ }
181
+ // If all clients get the same endpoint list in the same order, and they
182
+ // all start connection attempts in that order, and all connection attempts
183
+ // take approximately the same amount of time, then all clients are
184
+ // likely to connect to the first endpoint in the list before any of
185
+ // the others. As soon as the client has that initial connection,
186
+ // it will send all queued RPCs on that connection while it waits for
187
+ // other endpoints to become connected. This can result in sending a
188
+ // potentially large burst of traffic to the first endpoint in the list.
189
+ // To avoid that, we start connecting from a random index into the list.
190
+ std::vector<EndpointAddresses> endpoint_list;
171
191
  endpoints->ForEach([&](const EndpointAddresses& endpoint) {
172
- endpoints_.push_back(
173
- create_endpoint(Ref(DEBUG_LOCATION, "Endpoint"), endpoint, args));
192
+ endpoint_list.push_back(endpoint);
174
193
  });
194
+ endpoints_.resize(endpoint_list.size());
195
+ size_t start_index = absl::Uniform(SharedBitGen(), 0UL, endpoint_list.size());
196
+ for (size_t i = 0; i < endpoint_list.size(); ++i) {
197
+ size_t index = (start_index + i) % endpoint_list.size();
198
+ EndpointAddresses& endpoint = endpoint_list[index];
199
+ endpoints_[index] =
200
+ create_endpoint(Ref(DEBUG_LOCATION, "Endpoint"), endpoint, args);
201
+ }
175
202
  }
176
203
 
177
204
  void EndpointList::ResetBackoffLocked() {
@@ -50,7 +50,7 @@ ClientLoadReportingFilter::Create(const ChannelArgs&, ChannelFilter::Args) {
50
50
 
51
51
  void ClientLoadReportingFilter::Call::OnClientInitialMetadata(
52
52
  ClientMetadata& client_initial_metadata) {
53
- GRPC_LATENT_SEE_INNER_SCOPE(
53
+ GRPC_LATENT_SEE_SCOPE(
54
54
  "ClientLoadReportingFilter::Call::OnClientInitialMetadata");
55
55
  // Handle client initial metadata.
56
56
  // Grab client stats object from metadata.
@@ -62,14 +62,14 @@ void ClientLoadReportingFilter::Call::OnClientInitialMetadata(
62
62
  }
63
63
 
64
64
  void ClientLoadReportingFilter::Call::OnServerInitialMetadata(ServerMetadata&) {
65
- GRPC_LATENT_SEE_INNER_SCOPE(
65
+ GRPC_LATENT_SEE_SCOPE(
66
66
  "ClientLoadReportingFilter::Call::OnServerInitialMetadata");
67
67
  saw_initial_metadata_ = true;
68
68
  }
69
69
 
70
70
  void ClientLoadReportingFilter::Call::OnServerTrailingMetadata(
71
71
  ServerMetadata& server_trailing_metadata) {
72
- GRPC_LATENT_SEE_INNER_SCOPE(
72
+ GRPC_LATENT_SEE_SCOPE(
73
73
  "ClientLoadReportingFilter::Call::OnServerTrailingMetadata");
74
74
  if (client_stats_ != nullptr) {
75
75
  client_stats_->AddCallFinished(
@@ -31,7 +31,7 @@
31
31
 
32
32
  namespace grpc_core {
33
33
 
34
- class ClientLoadReportingFilter final
34
+ class ClientLoadReportingFilter
35
35
  : public ImplementChannelFilter<ClientLoadReportingFilter> {
36
36
  public:
37
37
  static const grpc_channel_filter kFilter;
@@ -875,11 +875,18 @@ void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
875
875
  // Otherwise, process connectivity state change.
876
876
  switch (*connectivity_state_) {
877
877
  case GRPC_CHANNEL_TRANSIENT_FAILURE: {
878
- bool prev_seen_transient_failure =
879
- std::exchange(seen_transient_failure_, true);
880
878
  // If this is the first failure we've seen on this subchannel,
881
879
  // then we're still in the Happy Eyeballs pass.
882
- if (!prev_seen_transient_failure && seen_transient_failure_) {
880
+ if (!seen_transient_failure_) {
881
+ // Only set seen_transient_failure_ on subchannels that we've
882
+ // already gotten to in this Happy Eyeballs pass. We don't want
883
+ // to do this if a subchannel that we haven't yet gotten to reports
884
+ // TF, since that connection attempt might have been triggered by a
885
+ // different channel, and the subchannel may already be back in IDLE
886
+ // by the time we get there later in our Happy Eyeballs pass.
887
+ if (index_ <= subchannel_list_->attempting_index_) {
888
+ seen_transient_failure_ = true;
889
+ }
883
890
  // If a connection attempt fails before the timer fires, then
884
891
  // cancel the timer and start connecting on the next subchannel.
885
892
  if (index_ == subchannel_list_->attempting_index_) {
@@ -890,8 +897,8 @@ void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
890
897
  ++subchannel_list_->attempting_index_;
891
898
  subchannel_list_->StartConnectingNextSubchannel();
892
899
  } else {
893
- // If this was the last subchannel to fail, check if the Happy
894
- // Eyeballs pass is complete.
900
+ // In case this was the last subchannel to fail, check if the
901
+ // Happy Eyeballs pass is complete.
895
902
  subchannel_list_->MaybeFinishHappyEyeballsPass();
896
903
  }
897
904
  } else if (subchannel_list_->IsHappyEyeballsPassComplete()) {
@@ -407,10 +407,11 @@ LoadBalancingPolicy::PickResult XdsClusterImplLb::Picker::Pick(
407
407
  auto* call_attempt_tracer = call_state->GetCallAttemptTracer();
408
408
  if (call_attempt_tracer != nullptr) {
409
409
  call_attempt_tracer->SetOptionalLabel(
410
- ClientCallTracer::CallAttemptTracer::OptionalLabelKey::kXdsServiceName,
410
+ ClientCallTracerInterface::CallAttemptTracer::OptionalLabelKey::
411
+ kXdsServiceName,
411
412
  service_telemetry_label_);
412
413
  call_attempt_tracer->SetOptionalLabel(
413
- ClientCallTracer::CallAttemptTracer::OptionalLabelKey::
414
+ ClientCallTracerInterface::CallAttemptTracer::OptionalLabelKey::
414
415
  kXdsServiceNamespace,
415
416
  namespace_telemetry_label_);
416
417
  }
@@ -444,7 +445,8 @@ LoadBalancingPolicy::PickResult XdsClusterImplLb::Picker::Pick(
444
445
  // Add locality label to per-call metrics if needed.
445
446
  if (call_attempt_tracer != nullptr) {
446
447
  call_attempt_tracer->SetOptionalLabel(
447
- ClientCallTracer::CallAttemptTracer::OptionalLabelKey::kLocality,
448
+ ClientCallTracerInterface::CallAttemptTracer::OptionalLabelKey::
449
+ kLocality,
448
450
  subchannel_wrapper->locality());
449
451
  }
450
452
  // Handle load reporting.
@@ -0,0 +1,19 @@
1
+ //
2
+ //
3
+ // Copyright 2015 gRPC authors.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //
18
+
19
+ // TODO(hork): move src/core/lib/iomgr/socket_mutator.cc here
@@ -0,0 +1,25 @@
1
+ //
2
+ //
3
+ // Copyright 2015 gRPC authors.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //
18
+
19
+ #ifndef GRPC_SRC_CORE_NET_SOCKET_MUTATOR_H
20
+ #define GRPC_SRC_CORE_NET_SOCKET_MUTATOR_H
21
+
22
+ // TODO(hork): move src/core/lib/iomgr/socket_mutator.h here
23
+ #include "src/core/lib/iomgr/socket_mutator.h"
24
+
25
+ #endif // GRPC_SRC_CORE_NET_SOCKET_MUTATOR_H
@@ -71,6 +71,7 @@ extern void RegisterConnectedChannel(CoreConfiguration::Builder* builder);
71
71
  extern void RegisterLoadBalancedCallDestination(
72
72
  CoreConfiguration::Builder* builder);
73
73
  extern void RegisterChttp2Transport(CoreConfiguration::Builder* builder);
74
+ extern void RegisterFusedFilters(CoreConfiguration::Builder* builder);
74
75
  #ifndef GRPC_NO_RLS
75
76
  extern void RegisterRlsLbPolicy(CoreConfiguration::Builder* builder);
76
77
  #endif // !GRPC_NO_RLS
@@ -100,13 +101,17 @@ void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
100
101
  RegisterHttpConnectHandshaker(builder);
101
102
  RegisterTCPConnectHandshaker(builder);
102
103
  RegisterChttp2Transport(builder);
104
+ #ifndef GRPC_MINIMAL_LB_POLICY
103
105
  RegisterPriorityLbPolicy(builder);
104
106
  RegisterOutlierDetectionLbPolicy(builder);
105
107
  RegisterWeightedTargetLbPolicy(builder);
108
+ #endif
106
109
  RegisterPickFirstLbPolicy(builder);
110
+ #ifndef GRPC_MINIMAL_LB_POLICY
107
111
  RegisterRoundRobinLbPolicy(builder);
108
112
  RegisterRingHashLbPolicy(builder);
109
113
  RegisterWeightedRoundRobinLbPolicy(builder);
114
+ #endif
110
115
  BuildClientChannelConfiguration(builder);
111
116
  SecurityRegisterHandshakerFactories(builder);
112
117
  RegisterClientAuthorityFilter(builder);
@@ -131,6 +136,7 @@ void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
131
136
  RegisterBackendMetricFilter(builder);
132
137
  RegisterSecurityFilters(builder);
133
138
  RegisterExtraFilters(builder);
139
+ RegisterFusedFilters(builder);
134
140
  RegisterBuiltins(builder);
135
141
  }
136
142
 
@@ -19,7 +19,6 @@
19
19
  #ifndef GRPC_SRC_CORE_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
20
20
  #define GRPC_SRC_CORE_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
21
21
 
22
- #include <ares.h>
23
22
  #include <grpc/support/port_platform.h>
24
23
 
25
24
  #include <memory>
@@ -31,6 +30,10 @@
31
30
  #include "src/core/resolver/dns/c_ares/grpc_ares_wrapper.h"
32
31
  #include "src/core/util/sync.h"
33
32
 
33
+ #if GRPC_ARES == 1
34
+
35
+ #include <ares.h>
36
+
34
37
  namespace grpc_core {
35
38
 
36
39
  // A wrapped fd that integrates with the grpc iomgr of the current platform.
@@ -85,4 +88,6 @@ std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(Mutex* mu);
85
88
 
86
89
  } // namespace grpc_core
87
90
 
91
+ #endif // GRPC_ARES
92
+
88
93
  #endif // GRPC_SRC_CORE_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
@@ -20,7 +20,6 @@
20
20
  #include "src/core/lib/iomgr/port.h" // IWYU pragma: keep
21
21
  #if GRPC_ARES == 1 && defined(GRPC_WINDOWS_SOCKET_ARES_EV_DRIVER)
22
22
 
23
- #include <ares.h>
24
23
  #include <grpc/support/alloc.h>
25
24
  #include <grpc/support/log_windows.h>
26
25
  #include <grpc/support/string_util.h>
@@ -41,6 +40,8 @@
41
40
  #include "src/core/lib/iomgr/tcp_windows.h"
42
41
  #include "src/core/lib/slice/slice.h"
43
42
  #include "src/core/lib/slice/slice_internal.h"
43
+ // We pull in ares.h transitively here, ares.h is not self-contained
44
+ // w.r.t. windows headers though, so make sure pull them in above.
44
45
  #include "src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h"
45
46
  #include "src/core/resolver/dns/c_ares/grpc_ares_wrapper.h"
46
47
  #include "src/core/util/crash.h"
@@ -484,14 +484,17 @@ static void grpc_ares_notify_on_event_locked(grpc_ares_ev_driver* ev_driver)
484
484
  }
485
485
  }
486
486
  }
487
- // Any remaining fds in ev_driver->fds were not returned by ares_getsock() and
488
- // are therefore no longer in use, so they can be shut down and removed from
489
- // the list.
487
+ // We may be shutting down to completion of all requests, or due to a timeout
488
+ // or explicit caller-triggered cancellation. In any of these cases, shut
489
+ // down and destroy any remaining fds.
490
490
  while (ev_driver->fds != nullptr) {
491
491
  fd_node* cur = ev_driver->fds;
492
492
  ev_driver->fds = ev_driver->fds->next;
493
- fd_node_shutdown_locked(cur, "c-ares fd shutdown");
494
- if (!cur->readable_registered && !cur->writable_registered) {
493
+ if (ev_driver->shutting_down) {
494
+ fd_node_shutdown_locked(cur, "grpc_ares_notify_on_event_locked");
495
+ }
496
+ if (cur->already_shutdown && !cur->readable_registered &&
497
+ !cur->writable_registered) {
495
498
  fd_node_destroy_locked(cur);
496
499
  } else {
497
500
  cur->next = new_list;