grpc 1.73.0 → 1.74.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 (499) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +38 -17
  3. data/include/grpc/create_channel_from_endpoint.h +54 -0
  4. data/include/grpc/credentials.h +11 -5
  5. data/include/grpc/event_engine/event_engine.h +74 -17
  6. data/include/grpc/grpc_posix.h +20 -1
  7. data/include/grpc/impl/channel_arg_names.h +2 -4
  8. data/include/grpc/module.modulemap +1 -0
  9. data/include/grpc/support/json.h +24 -0
  10. data/src/core/call/interception_chain.h +7 -11
  11. data/src/core/channelz/channel_trace.cc +213 -115
  12. data/src/core/channelz/channel_trace.h +380 -86
  13. data/src/core/channelz/channelz.cc +270 -181
  14. data/src/core/channelz/channelz.h +168 -55
  15. data/src/core/channelz/channelz_registry.cc +2 -1
  16. data/src/core/channelz/channelz_registry.h +24 -0
  17. data/src/core/channelz/property_list.cc +357 -0
  18. data/src/core/channelz/property_list.h +202 -0
  19. data/src/core/channelz/ztrace_collector.h +3 -2
  20. data/src/core/client_channel/backup_poller.cc +17 -2
  21. data/src/core/client_channel/client_channel.cc +17 -28
  22. data/src/core/client_channel/client_channel_filter.cc +19 -29
  23. data/src/core/client_channel/config_selector.h +8 -2
  24. data/src/core/client_channel/dynamic_filters.cc +5 -6
  25. data/src/core/client_channel/dynamic_filters.h +1 -1
  26. data/src/core/client_channel/global_subchannel_pool.cc +4 -1
  27. data/src/core/client_channel/retry_filter.cc +21 -27
  28. data/src/core/client_channel/retry_filter.h +10 -7
  29. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
  30. data/src/core/client_channel/retry_filter_legacy_call_data.h +1 -1
  31. data/src/core/client_channel/retry_interceptor.cc +30 -44
  32. data/src/core/client_channel/retry_interceptor.h +18 -17
  33. data/src/core/client_channel/retry_throttle.cc +46 -61
  34. data/src/core/client_channel/retry_throttle.h +17 -39
  35. data/src/core/client_channel/subchannel.cc +43 -19
  36. data/src/core/client_channel/subchannel.h +8 -0
  37. data/src/core/config/config_vars.cc +2 -0
  38. data/src/core/config/core_configuration.cc +1 -0
  39. data/src/core/config/core_configuration.h +11 -0
  40. data/src/core/credentials/call/call_creds_registry.h +125 -0
  41. data/src/core/credentials/call/call_creds_registry_init.cc +91 -0
  42. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +6 -48
  43. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +86 -0
  44. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.h +74 -0
  45. data/src/core/credentials/call/jwt_util.cc +70 -0
  46. data/src/core/credentials/call/jwt_util.h +32 -0
  47. data/src/core/credentials/transport/channel_creds_registry_init.cc +1 -1
  48. data/src/core/credentials/transport/google_default/google_default_credentials.cc +72 -4
  49. data/src/core/credentials/transport/ssl/ssl_credentials.cc +0 -1
  50. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +1 -0
  51. data/src/core/credentials/transport/xds/xds_credentials.cc +0 -3
  52. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +8 -8
  53. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +16 -16
  54. data/src/core/ext/filters/http/client_authority_filter.cc +2 -4
  55. data/src/core/ext/filters/http/message_compress/compression_filter.h +25 -22
  56. data/src/core/ext/filters/http/server/http_server_filter.h +12 -11
  57. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +120 -35
  58. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -5
  59. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +162 -115
  60. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +0 -3
  61. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +1239 -3514
  62. data/src/core/ext/transport/chttp2/transport/decode_huff.h +1008 -1486
  63. data/src/core/ext/transport/chttp2/transport/flow_control.h +22 -17
  64. data/src/core/ext/transport/chttp2/transport/frame.cc +10 -0
  65. data/src/core/ext/transport/chttp2/transport/frame.h +2 -2
  66. data/src/core/ext/transport/chttp2/transport/frame_data.cc +1 -1
  67. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +7 -8
  68. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +4 -5
  69. data/src/core/ext/transport/chttp2/transport/header_assembler.h +299 -0
  70. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +1 -1
  71. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +11 -5
  72. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +12 -1
  73. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +1017 -0
  74. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +593 -0
  75. data/src/core/ext/transport/chttp2/transport/http2_settings.h +19 -22
  76. data/{third_party/abseil-cpp/absl/strings/cord_buffer.cc → src/core/ext/transport/chttp2/transport/http2_stats_collector.cc} +14 -14
  77. data/src/core/ext/transport/chttp2/transport/http2_stats_collector.h +33 -0
  78. data/src/core/ext/transport/chttp2/transport/http2_status.h +6 -1
  79. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +43 -0
  80. data/src/core/ext/transport/chttp2/transport/http2_transport.h +65 -0
  81. data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +0 -29
  82. data/src/core/ext/transport/chttp2/transport/internal.h +18 -8
  83. data/src/core/ext/transport/chttp2/transport/keepalive.cc +105 -0
  84. data/src/core/ext/transport/chttp2/transport/keepalive.h +138 -0
  85. data/src/core/ext/transport/chttp2/transport/message_assembler.h +185 -0
  86. data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -4
  87. data/src/core/ext/transport/chttp2/transport/ping_callbacks.h +19 -0
  88. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +151 -0
  89. data/src/core/ext/transport/chttp2/transport/ping_promise.h +180 -0
  90. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +5 -9
  91. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +11 -0
  92. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +39 -1
  93. data/src/core/ext/transport/chttp2/transport/transport_common.cc +19 -0
  94. data/src/core/ext/transport/chttp2/transport/transport_common.h +27 -0
  95. data/src/core/ext/transport/chttp2/transport/writing.cc +37 -11
  96. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb.h +571 -0
  97. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.c +120 -0
  98. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.h +36 -0
  99. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +1272 -0
  100. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +312 -0
  101. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +50 -0
  102. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +984 -0
  103. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +226 -0
  104. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +44 -0
  105. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +175 -0
  106. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +82 -0
  107. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c +135 -0
  108. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.h +67 -0
  109. data/src/core/filter/auth/auth_filters.h +0 -25
  110. data/src/core/filter/auth/client_auth_filter.cc +0 -118
  111. data/src/core/filter/filter_args.h +9 -23
  112. data/src/core/handshaker/handshaker.cc +23 -14
  113. data/src/core/handshaker/handshaker.h +3 -0
  114. data/src/core/handshaker/http_connect/http_connect_handshaker.cc +3 -1
  115. data/src/core/handshaker/security/legacy_secure_endpoint.cc +6 -5
  116. data/src/core/handshaker/security/secure_endpoint.cc +70 -25
  117. data/src/core/handshaker/security/security_handshaker.cc +4 -1
  118. data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +7 -1
  119. data/src/core/lib/channel/channel_args.cc +15 -0
  120. data/src/core/lib/channel/channel_args.h +3 -0
  121. data/src/core/lib/channel/channel_stack.cc +22 -23
  122. data/src/core/lib/channel/channel_stack.h +9 -7
  123. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -1
  124. data/src/core/lib/channel/channel_stack_builder_impl.h +2 -7
  125. data/src/core/lib/channel/promise_based_filter.h +5 -5
  126. data/src/core/lib/debug/trace_impl.h +0 -1
  127. data/src/core/lib/event_engine/ares_resolver.cc +165 -46
  128. data/src/core/lib/event_engine/ares_resolver.h +48 -2
  129. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +3 -1
  130. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -4
  131. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +2 -6
  132. data/src/core/lib/event_engine/endpoint_channel_arg_wrapper.cc +40 -0
  133. data/src/core/lib/event_engine/endpoint_channel_arg_wrapper.h +60 -0
  134. data/src/core/lib/event_engine/event_engine.cc +7 -0
  135. data/src/core/lib/event_engine/extensions/channelz.h +10 -6
  136. data/src/core/lib/event_engine/grpc_polled_fd.h +5 -0
  137. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +130 -162
  138. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +11 -15
  139. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +75 -117
  140. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +7 -9
  141. data/src/core/lib/event_engine/posix_engine/event_poller.h +18 -15
  142. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +0 -18
  143. data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +124 -0
  144. data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.h +243 -0
  145. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +29 -19
  146. data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +6 -2
  147. data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +6 -1
  148. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +145 -92
  149. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +9 -19
  150. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +333 -116
  151. data/src/core/lib/event_engine/posix_engine/posix_engine.h +61 -18
  152. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +45 -37
  153. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +6 -4
  154. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +32 -142
  155. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +6 -5
  156. data/src/core/lib/event_engine/posix_engine/posix_interface.h +211 -0
  157. data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +1083 -0
  158. data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +281 -0
  159. data/src/core/lib/event_engine/posix_engine/posix_write_event_sink.cc +154 -0
  160. data/src/core/lib/event_engine/posix_engine/posix_write_event_sink.h +174 -0
  161. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -719
  162. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +10 -170
  163. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +33 -22
  164. data/src/core/lib/event_engine/posix_engine/timer_manager.h +13 -11
  165. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +117 -151
  166. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +26 -94
  167. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +26 -25
  168. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +6 -2
  169. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +36 -62
  170. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +6 -2
  171. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +7 -6
  172. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +12 -6
  173. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +3 -1
  174. data/src/core/lib/event_engine/shim.cc +9 -0
  175. data/src/core/lib/event_engine/shim.h +3 -0
  176. data/src/core/lib/event_engine/thread_pool/thread_pool.h +7 -3
  177. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +0 -17
  178. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +4 -2
  179. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +3 -2
  180. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +4 -0
  181. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.h +4 -0
  182. data/src/core/lib/event_engine/windows/windows_endpoint.h +2 -6
  183. data/src/core/lib/event_engine/windows/windows_engine.cc +0 -1
  184. data/src/core/lib/event_engine/windows/windows_engine.h +1 -3
  185. data/src/core/lib/event_engine/windows/windows_listener.cc +14 -2
  186. data/src/core/lib/experiments/experiments.cc +45 -93
  187. data/src/core/lib/experiments/experiments.h +21 -51
  188. data/src/core/lib/iomgr/endpoint.cc +4 -3
  189. data/src/core/lib/iomgr/endpoint.h +7 -4
  190. data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -2
  191. data/src/core/lib/iomgr/ev_epoll1_linux.cc +7 -2
  192. data/src/core/lib/iomgr/ev_poll_posix.cc +7 -2
  193. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +4 -6
  194. data/src/core/lib/iomgr/tcp_posix.cc +12 -6
  195. data/src/core/lib/iomgr/tcp_windows.cc +3 -2
  196. data/src/core/lib/promise/activity.h +1 -0
  197. data/src/core/lib/promise/arena_promise.h +23 -7
  198. data/src/core/lib/promise/detail/promise_factory.h +10 -0
  199. data/src/core/lib/promise/detail/promise_like.h +118 -11
  200. data/src/core/lib/promise/detail/promise_variant.h +50 -0
  201. data/src/core/lib/promise/detail/seq_state.h +687 -548
  202. data/src/core/lib/promise/if.h +20 -0
  203. data/src/core/lib/promise/inter_activity_latch.h +147 -0
  204. data/src/core/lib/promise/inter_activity_mutex.h +547 -0
  205. data/src/core/lib/promise/loop.h +65 -3
  206. data/src/core/lib/promise/map.h +24 -0
  207. data/src/core/lib/promise/match_promise.h +103 -0
  208. data/src/core/lib/promise/mpsc.cc +425 -0
  209. data/src/core/lib/promise/mpsc.h +490 -0
  210. data/src/core/lib/promise/party.cc +50 -1
  211. data/src/core/lib/promise/party.h +66 -1
  212. data/src/core/lib/promise/race.h +31 -0
  213. data/src/core/lib/promise/seq.h +4 -1
  214. data/src/core/lib/promise/status_flag.h +7 -0
  215. data/src/core/lib/promise/try_seq.h +4 -1
  216. data/src/core/lib/promise/wait_set.cc +28 -0
  217. data/src/core/lib/promise/wait_set.h +86 -0
  218. data/src/core/lib/resource_quota/arena.h +19 -0
  219. data/src/core/lib/slice/slice.h +5 -0
  220. data/src/core/lib/surface/channel_create.cc +88 -13
  221. data/src/core/lib/surface/channel_create.h +4 -0
  222. data/src/core/lib/surface/channel_init.cc +164 -47
  223. data/src/core/lib/surface/channel_init.h +64 -1
  224. data/src/core/lib/surface/filter_stack_call.cc +18 -9
  225. data/src/core/lib/surface/init.cc +6 -15
  226. data/src/core/lib/surface/legacy_channel.cc +3 -5
  227. data/src/core/lib/surface/legacy_channel.h +3 -1
  228. data/src/core/lib/surface/version.cc +2 -2
  229. data/src/core/lib/transport/promise_endpoint.cc +110 -0
  230. data/src/core/lib/transport/promise_endpoint.h +307 -0
  231. data/src/core/load_balancing/child_policy_handler.cc +2 -4
  232. data/src/core/load_balancing/delegating_helper.h +2 -3
  233. data/src/core/load_balancing/health_check_client.cc +1 -5
  234. data/src/core/load_balancing/lb_policy.h +1 -3
  235. data/src/core/load_balancing/oob_backend_metric.cc +1 -5
  236. data/src/core/load_balancing/pick_first/pick_first.cc +3 -0
  237. data/src/core/load_balancing/xds/cds.cc +10 -1
  238. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -0
  239. data/src/core/resolver/xds/xds_config.cc +6 -3
  240. data/src/core/resolver/xds/xds_config.h +9 -4
  241. data/src/core/resolver/xds/xds_dependency_manager.cc +21 -6
  242. data/src/core/resolver/xds/xds_dependency_manager.h +2 -1
  243. data/src/core/resolver/xds/xds_resolver.cc +31 -11
  244. data/src/core/server/server.cc +83 -12
  245. data/src/core/server/server.h +21 -2
  246. data/src/core/server/xds_server_config_fetcher.cc +63 -25
  247. data/src/core/service_config/service_config.h +1 -1
  248. data/src/core/service_config/service_config_impl.h +1 -1
  249. data/src/core/telemetry/context_list_entry.cc +38 -0
  250. data/src/core/telemetry/context_list_entry.h +42 -12
  251. data/src/core/telemetry/stats_data.cc +233 -207
  252. data/src/core/telemetry/stats_data.h +250 -153
  253. data/src/core/telemetry/tcp_tracer.h +1 -1
  254. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +11 -3
  255. data/src/core/tsi/fake_transport_security.cc +17 -0
  256. data/src/core/tsi/ssl_transport_security.cc +2 -0
  257. data/src/core/tsi/transport_security_grpc.cc +8 -0
  258. data/src/core/tsi/transport_security_grpc.h +15 -0
  259. data/src/core/util/backoff.cc +1 -5
  260. data/src/core/util/backoff.h +1 -0
  261. data/src/core/util/down_cast.h +1 -1
  262. data/src/core/util/function_signature.h +15 -1
  263. data/src/core/util/http_client/httpcli.cc +12 -5
  264. data/src/core/util/http_client/httpcli.h +4 -1
  265. data/src/core/util/latent_see.h +8 -5
  266. data/src/core/util/log.cc +4 -0
  267. data/src/core/util/memory_usage.h +268 -0
  268. data/src/core/util/per_cpu.cc +2 -0
  269. data/src/core/util/per_cpu.h +7 -0
  270. data/src/core/util/shared_bit_gen.h +20 -0
  271. data/src/core/util/single_set_ptr.h +2 -2
  272. data/src/core/util/upb_utils.h +42 -0
  273. data/src/core/util/uri.cc +3 -2
  274. data/src/core/util/useful.h +53 -2
  275. data/src/core/util/wait_for_single_owner.cc +31 -0
  276. data/src/core/util/wait_for_single_owner.h +24 -0
  277. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -0
  278. data/src/core/xds/grpc/xds_bootstrap_grpc.h +5 -0
  279. data/src/core/xds/grpc/xds_client_grpc.cc +6 -2
  280. data/src/core/xds/grpc/xds_common_types_parser.cc +138 -50
  281. data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
  282. data/src/core/xds/grpc/xds_http_filter.h +7 -0
  283. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +22 -0
  284. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -0
  285. data/src/core/xds/grpc/xds_route_config_parser.cc +15 -38
  286. data/src/core/xds/grpc/xds_server_grpc.cc +63 -13
  287. data/src/core/xds/grpc/xds_server_grpc.h +10 -2
  288. data/src/core/xds/grpc/xds_server_grpc_interface.h +4 -0
  289. data/src/core/xds/grpc/xds_transport_grpc.cc +18 -0
  290. data/src/core/xds/xds_client/xds_bootstrap.h +2 -0
  291. data/src/core/xds/xds_client/xds_client.cc +26 -5
  292. data/src/ruby/ext/grpc/extconf.rb +2 -0
  293. data/src/ruby/ext/grpc/rb_call.c +1 -8
  294. data/src/ruby/ext/grpc/rb_channel.c +72 -568
  295. data/src/ruby/ext/grpc/rb_channel.h +0 -3
  296. data/src/ruby/ext/grpc/rb_completion_queue.c +26 -14
  297. data/src/ruby/ext/grpc/rb_completion_queue.h +1 -7
  298. data/src/ruby/ext/grpc/rb_grpc.c +9 -5
  299. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
  300. data/src/ruby/ext/grpc/rb_loader.c +0 -4
  301. data/src/ruby/ext/grpc/rb_server.c +31 -50
  302. data/src/ruby/lib/grpc/generic/client_stub.rb +4 -4
  303. data/src/ruby/lib/grpc/version.rb +1 -1
  304. data/src/ruby/spec/core_spec.rb +22 -0
  305. data/src/ruby/spec/generic/active_call_spec.rb +1 -1
  306. data/third_party/abseil-cpp/absl/algorithm/container.h +2 -19
  307. data/third_party/abseil-cpp/absl/base/attributes.h +76 -7
  308. data/third_party/abseil-cpp/absl/base/call_once.h +11 -12
  309. data/third_party/abseil-cpp/absl/base/config.h +20 -129
  310. data/third_party/abseil-cpp/absl/base/{internal/fast_type_id.h → fast_type_id.h} +11 -16
  311. data/third_party/abseil-cpp/absl/base/internal/cycleclock.cc +0 -5
  312. data/third_party/abseil-cpp/absl/base/internal/cycleclock_config.h +7 -7
  313. data/third_party/abseil-cpp/absl/base/internal/endian.h +34 -38
  314. data/third_party/abseil-cpp/absl/base/internal/iterator_traits.h +71 -0
  315. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +6 -5
  316. data/third_party/abseil-cpp/absl/base/internal/{nullability_impl.h → nullability_deprecated.h} +45 -8
  317. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +0 -9
  318. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +3 -13
  319. data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +6 -6
  320. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +8 -3
  321. data/third_party/abseil-cpp/absl/base/no_destructor.h +11 -32
  322. data/third_party/abseil-cpp/absl/base/nullability.h +84 -72
  323. data/third_party/abseil-cpp/absl/base/options.h +3 -80
  324. data/third_party/abseil-cpp/absl/base/policy_checks.h +7 -7
  325. data/third_party/abseil-cpp/absl/cleanup/cleanup.h +1 -3
  326. data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +3 -4
  327. data/third_party/abseil-cpp/absl/container/btree_map.h +4 -2
  328. data/third_party/abseil-cpp/absl/container/btree_set.h +4 -2
  329. data/third_party/abseil-cpp/absl/container/fixed_array.h +7 -14
  330. data/third_party/abseil-cpp/absl/container/flat_hash_map.h +5 -0
  331. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +6 -1
  332. data/third_party/abseil-cpp/absl/container/inlined_vector.h +8 -5
  333. data/third_party/abseil-cpp/absl/container/internal/btree.h +132 -29
  334. data/third_party/abseil-cpp/absl/container/internal/btree_container.h +175 -71
  335. data/third_party/abseil-cpp/absl/container/internal/common.h +43 -0
  336. data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +1 -2
  337. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +9 -10
  338. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +1 -8
  339. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +0 -4
  340. data/third_party/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +527 -0
  341. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +20 -4
  342. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +31 -12
  343. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +2 -7
  344. data/third_party/abseil-cpp/absl/container/internal/layout.h +26 -42
  345. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +199 -68
  346. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +1354 -183
  347. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +881 -1424
  348. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set_resize_impl.h +80 -0
  349. data/third_party/abseil-cpp/absl/crc/crc32c.cc +0 -4
  350. data/third_party/abseil-cpp/absl/crc/crc32c.h +7 -5
  351. data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +0 -22
  352. data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +45 -74
  353. data/third_party/abseil-cpp/absl/debugging/internal/addresses.h +57 -0
  354. data/third_party/abseil-cpp/absl/debugging/internal/decode_rust_punycode.cc +1 -1
  355. data/third_party/abseil-cpp/absl/debugging/internal/decode_rust_punycode.h +5 -5
  356. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +8 -35
  357. data/third_party/abseil-cpp/absl/debugging/internal/demangle_rust.cc +16 -16
  358. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +40 -37
  359. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +16 -7
  360. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +14 -5
  361. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +10 -4
  362. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +27 -16
  363. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +13 -4
  364. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +4 -3
  365. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +15 -28
  366. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +19 -9
  367. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +144 -27
  368. data/third_party/abseil-cpp/absl/debugging/stacktrace.h +73 -5
  369. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +19 -9
  370. data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +3 -2
  371. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +25 -6
  372. data/third_party/abseil-cpp/absl/flags/commandlineflag.h +2 -2
  373. data/third_party/abseil-cpp/absl/flags/flag.h +4 -3
  374. data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h +2 -2
  375. data/third_party/abseil-cpp/absl/flags/internal/flag.cc +2 -1
  376. data/third_party/abseil-cpp/absl/flags/internal/flag.h +7 -6
  377. data/third_party/abseil-cpp/absl/flags/internal/registry.h +4 -3
  378. data/third_party/abseil-cpp/absl/flags/reflection.cc +2 -3
  379. data/third_party/abseil-cpp/absl/functional/any_invocable.h +8 -10
  380. data/third_party/abseil-cpp/absl/functional/function_ref.h +2 -9
  381. data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +110 -226
  382. data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +10 -12
  383. data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +2 -5
  384. data/third_party/abseil-cpp/absl/hash/hash.h +18 -0
  385. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +1 -5
  386. data/third_party/abseil-cpp/absl/hash/internal/hash.h +86 -61
  387. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +25 -68
  388. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.h +2 -6
  389. data/third_party/abseil-cpp/absl/hash/internal/weakly_mixed_integer.h +38 -0
  390. data/third_party/abseil-cpp/absl/log/check.h +2 -1
  391. data/third_party/abseil-cpp/absl/log/globals.h +4 -5
  392. data/third_party/abseil-cpp/absl/log/internal/append_truncated.h +28 -0
  393. data/third_party/abseil-cpp/absl/log/internal/check_op.cc +22 -22
  394. data/third_party/abseil-cpp/absl/log/internal/check_op.h +65 -62
  395. data/third_party/abseil-cpp/absl/log/internal/conditions.cc +5 -3
  396. data/third_party/abseil-cpp/absl/log/internal/conditions.h +7 -2
  397. data/third_party/abseil-cpp/absl/log/internal/log_message.cc +85 -43
  398. data/third_party/abseil-cpp/absl/log/internal/log_message.h +84 -59
  399. data/third_party/abseil-cpp/absl/log/internal/nullstream.h +1 -0
  400. data/third_party/abseil-cpp/absl/log/internal/proto.cc +3 -2
  401. data/third_party/abseil-cpp/absl/log/internal/proto.h +3 -3
  402. data/third_party/abseil-cpp/absl/log/internal/strip.h +4 -12
  403. data/third_party/abseil-cpp/absl/log/internal/vlog_config.h +8 -6
  404. data/third_party/abseil-cpp/absl/log/internal/voidify.h +10 -4
  405. data/third_party/abseil-cpp/absl/log/log.h +48 -35
  406. data/third_party/abseil-cpp/absl/log/log_sink_registry.h +2 -2
  407. data/third_party/abseil-cpp/absl/meta/type_traits.h +46 -175
  408. data/third_party/abseil-cpp/absl/numeric/bits.h +68 -2
  409. data/third_party/abseil-cpp/absl/numeric/int128.cc +0 -52
  410. data/third_party/abseil-cpp/absl/numeric/internal/bits.h +7 -3
  411. data/third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc +1 -1
  412. data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +10 -11
  413. data/third_party/abseil-cpp/absl/random/distributions.h +6 -8
  414. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +1 -1
  415. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +5 -6
  416. data/third_party/abseil-cpp/absl/random/internal/{pool_urbg.cc → entropy_pool.cc} +22 -90
  417. data/third_party/abseil-cpp/absl/random/internal/entropy_pool.h +35 -0
  418. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +5 -6
  419. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +1 -1
  420. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +20 -12
  421. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +5 -5
  422. data/third_party/abseil-cpp/absl/random/random.h +88 -53
  423. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +6 -2
  424. data/third_party/abseil-cpp/absl/status/internal/status_internal.cc +3 -4
  425. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +3 -4
  426. data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +4 -3
  427. data/third_party/abseil-cpp/absl/status/status.cc +4 -8
  428. data/third_party/abseil-cpp/absl/status/status.h +8 -8
  429. data/third_party/abseil-cpp/absl/status/status_payload_printer.h +2 -2
  430. data/third_party/abseil-cpp/absl/status/statusor.cc +2 -2
  431. data/third_party/abseil-cpp/absl/status/statusor.h +6 -6
  432. data/third_party/abseil-cpp/absl/strings/ascii.cc +9 -9
  433. data/third_party/abseil-cpp/absl/strings/ascii.h +18 -18
  434. data/third_party/abseil-cpp/absl/strings/charconv.cc +21 -22
  435. data/third_party/abseil-cpp/absl/strings/charconv.h +5 -5
  436. data/third_party/abseil-cpp/absl/strings/cord.cc +54 -58
  437. data/third_party/abseil-cpp/absl/strings/cord.h +94 -83
  438. data/third_party/abseil-cpp/absl/strings/cord_analysis.cc +11 -11
  439. data/third_party/abseil-cpp/absl/strings/cord_analysis.h +3 -3
  440. data/third_party/abseil-cpp/absl/strings/escaping.cc +130 -149
  441. data/third_party/abseil-cpp/absl/strings/escaping.h +9 -10
  442. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +1 -1
  443. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +6 -8
  444. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +0 -4
  445. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +0 -4
  446. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +7 -63
  447. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +1 -11
  448. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +0 -22
  449. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +5 -3
  450. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +4 -2
  451. data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +3 -3
  452. data/third_party/abseil-cpp/absl/strings/internal/string_constant.h +0 -5
  453. data/third_party/abseil-cpp/absl/strings/internal/utf8.cc +96 -1
  454. data/third_party/abseil-cpp/absl/strings/internal/utf8.h +15 -1
  455. data/third_party/abseil-cpp/absl/strings/numbers.cc +53 -32
  456. data/third_party/abseil-cpp/absl/strings/numbers.h +87 -58
  457. data/third_party/abseil-cpp/absl/strings/str_cat.cc +6 -7
  458. data/third_party/abseil-cpp/absl/strings/str_cat.h +32 -32
  459. data/third_party/abseil-cpp/absl/strings/str_format.h +18 -18
  460. data/third_party/abseil-cpp/absl/strings/str_replace.cc +3 -3
  461. data/third_party/abseil-cpp/absl/strings/str_replace.h +6 -6
  462. data/third_party/abseil-cpp/absl/strings/string_view.cc +4 -9
  463. data/third_party/abseil-cpp/absl/strings/string_view.h +27 -32
  464. data/third_party/abseil-cpp/absl/strings/strip.h +4 -4
  465. data/third_party/abseil-cpp/absl/strings/substitute.cc +5 -4
  466. data/third_party/abseil-cpp/absl/strings/substitute.h +66 -64
  467. data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.cc +0 -4
  468. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.cc +0 -5
  469. data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.cc +0 -4
  470. data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.cc +0 -4
  471. data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.cc +0 -4
  472. data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.cc +0 -4
  473. data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.cc +0 -4
  474. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +1 -1
  475. data/third_party/abseil-cpp/absl/synchronization/mutex.h +97 -69
  476. data/third_party/abseil-cpp/absl/synchronization/notification.h +1 -1
  477. data/third_party/abseil-cpp/absl/time/civil_time.cc +1 -0
  478. data/third_party/abseil-cpp/absl/time/duration.cc +12 -7
  479. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +1 -1
  480. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +90 -111
  481. data/third_party/abseil-cpp/absl/time/time.h +20 -15
  482. data/third_party/abseil-cpp/absl/types/optional.h +7 -747
  483. data/third_party/abseil-cpp/absl/types/span.h +13 -11
  484. data/third_party/abseil-cpp/absl/types/variant.h +5 -784
  485. data/third_party/abseil-cpp/absl/utility/utility.h +10 -185
  486. metadata +72 -20
  487. data/src/core/lib/event_engine/forkable.cc +0 -105
  488. data/src/core/lib/event_engine/forkable.h +0 -67
  489. data/src/core/lib/iomgr/python_util.h +0 -46
  490. data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +0 -108
  491. data/third_party/abseil-cpp/absl/base/internal/invoke.h +0 -241
  492. data/third_party/abseil-cpp/absl/log/log_entry.cc +0 -41
  493. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +0 -131
  494. data/third_party/abseil-cpp/absl/types/bad_optional_access.cc +0 -66
  495. data/third_party/abseil-cpp/absl/types/bad_optional_access.h +0 -78
  496. data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +0 -82
  497. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +0 -82
  498. data/third_party/abseil-cpp/absl/types/internal/optional.h +0 -352
  499. data/third_party/abseil-cpp/absl/types/internal/variant.h +0 -1622
@@ -26,9 +26,6 @@
26
26
  /* Initializes the Channel class. */
27
27
  void Init_grpc_channel();
28
28
 
29
- void grpc_rb_channel_polling_thread_start();
30
- void grpc_rb_channel_polling_thread_stop();
31
-
32
29
  /* Gets the wrapped channel from the ruby wrapper */
33
30
  grpc_channel* grpc_rb_get_wrapped_channel(VALUE v);
34
31
 
@@ -34,15 +34,22 @@ typedef struct next_call_stack {
34
34
  grpc_event event;
35
35
  gpr_timespec timeout;
36
36
  void* tag;
37
- void (*unblock_func)(void*);
38
- void* unblock_func_arg;
37
+ volatile int interrupted;
39
38
  } next_call_stack;
40
39
 
41
40
  /* Calls grpc_completion_queue_pluck without holding the ruby GIL */
42
41
  static void* grpc_rb_completion_queue_pluck_no_gil(void* param) {
43
42
  next_call_stack* const next_call = (next_call_stack*)param;
44
- next_call->event = grpc_completion_queue_pluck(next_call->cq, next_call->tag,
45
- next_call->timeout, NULL);
43
+ gpr_timespec increment = gpr_time_from_millis(200, GPR_TIMESPAN);
44
+ gpr_timespec deadline;
45
+ for (;;) {
46
+ deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), increment);
47
+ next_call->event = grpc_completion_queue_pluck(
48
+ next_call->cq, next_call->tag, deadline, NULL);
49
+ if (next_call->event.type != GRPC_QUEUE_TIMEOUT) break;
50
+ if (gpr_time_cmp(deadline, next_call->timeout) > 0) break;
51
+ if (next_call->interrupted) break;
52
+ }
46
53
  return NULL;
47
54
  }
48
55
 
@@ -56,28 +63,33 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq) {
56
63
  grpc_completion_queue_destroy(cq);
57
64
  }
58
65
 
59
- static void outer_unblock_func(void* param) {
66
+ static void unblock_func(void* param) {
60
67
  next_call_stack* const next_call = (next_call_stack*)param;
61
- if (next_call->unblock_func == NULL) return;
62
- next_call->unblock_func(next_call->unblock_func_arg);
68
+ next_call->interrupted = 1;
63
69
  }
64
70
 
65
71
  /* Does the same thing as grpc_completion_queue_pluck, while properly releasing
66
72
  the GVL and handling interrupts */
67
73
  grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
68
74
  gpr_timespec deadline,
69
- void (*unblock_func)(void* param),
70
- void* unblock_func_arg) {
75
+ const char* reason) {
71
76
  next_call_stack next_call;
72
77
  MEMZERO(&next_call, next_call_stack, 1);
73
78
  next_call.cq = queue;
74
79
  next_call.timeout = deadline;
75
80
  next_call.tag = tag;
76
81
  next_call.event.type = GRPC_QUEUE_TIMEOUT;
77
- next_call.unblock_func = unblock_func;
78
- next_call.unblock_func_arg = unblock_func_arg;
79
- rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
80
- (void*)&next_call, outer_unblock_func,
81
- (void*)&next_call);
82
+ /* Loop until we finish a pluck without an interruption. See
83
+ * https://github.com/grpc/grpc/issues/38210 for an example of why
84
+ * this is necessary. */
85
+ grpc_absl_log_str(GPR_DEBUG, "CQ pluck loop begin: ", reason);
86
+ do {
87
+ next_call.interrupted = 0;
88
+ rb_thread_call_without_gvl(grpc_rb_completion_queue_pluck_no_gil,
89
+ (void*)&next_call, unblock_func,
90
+ (void*)&next_call);
91
+ if (next_call.event.type != GRPC_QUEUE_TIMEOUT) break;
92
+ } while (next_call.interrupted);
93
+ grpc_absl_log_str(GPR_DEBUG, "CQ pluck loop done: ", reason);
82
94
  return next_call.event;
83
95
  }
@@ -29,14 +29,8 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue* cq);
29
29
  * Makes the implementation of CompletionQueue#pluck available in other files
30
30
  *
31
31
  * This avoids having code that holds the GIL repeated at multiple sites.
32
- *
33
- * unblock_func is invoked with the provided argument to unblock the CQ
34
- * operation in the event of process termination (e.g. a signal), but
35
- * unblock_func may be NULL in which case it's unused.
36
32
  */
37
33
  grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
38
- gpr_timespec deadline,
39
- void (*unblock_func)(void* param),
40
- void* unblock_func_arg);
34
+ gpr_timespec deadline, const char* reason);
41
35
 
42
36
  #endif /* GRPC_RB_COMPLETION_QUEUE_H_ */
@@ -333,7 +333,6 @@ static void grpc_ruby_init_threads() {
333
333
  rb_mutex_lock(g_bg_thread_init_rb_mu);
334
334
  if (!g_bg_thread_init_done) {
335
335
  grpc_rb_event_queue_thread_start();
336
- grpc_rb_channel_polling_thread_start();
337
336
  g_bg_thread_init_done = true;
338
337
  }
339
338
  rb_mutex_unlock(g_bg_thread_init_rb_mu);
@@ -381,7 +380,7 @@ static VALUE grpc_rb_prefork(VALUE self) {
381
380
  rb_raise(rb_eRuntimeError,
382
381
  "GRPC.prefork and fork need to be called from the same thread "
383
382
  "that GRPC was initialized on (GRPC lazy-initializes when when "
384
- "the first GRPC object is created");
383
+ "the first GRPC object is created)");
385
384
  }
386
385
  if (g_grpc_rb_num_fork_unsafe_threads > 0) {
387
386
  rb_raise(
@@ -395,7 +394,6 @@ static VALUE grpc_rb_prefork(VALUE self) {
395
394
  g_grpc_rb_prefork_pending = true;
396
395
  rb_mutex_lock(g_bg_thread_init_rb_mu);
397
396
  if (g_bg_thread_init_done) {
398
- grpc_rb_channel_polling_thread_stop();
399
397
  grpc_rb_event_queue_thread_stop();
400
398
  // all ruby-level background threads joined at this point
401
399
  g_bg_thread_init_done = false;
@@ -449,9 +447,15 @@ void grpc_rb_fork_unsafe_begin() { g_grpc_rb_num_fork_unsafe_threads++; }
449
447
  void grpc_rb_fork_unsafe_end() { g_grpc_rb_num_fork_unsafe_threads--; }
450
448
 
451
449
  // APIs to mark fork-unsafe sections from ruby code
452
- static VALUE grpc_rb_fork_unsafe_begin_api() { grpc_rb_fork_unsafe_begin(); }
450
+ static VALUE grpc_rb_fork_unsafe_begin_api() {
451
+ grpc_rb_fork_unsafe_begin();
452
+ return Qnil;
453
+ }
453
454
 
454
- static VALUE grpc_rb_fork_unsafe_end_api() { grpc_rb_fork_unsafe_end(); }
455
+ static VALUE grpc_rb_fork_unsafe_end_api() {
456
+ grpc_rb_fork_unsafe_end();
457
+ return Qnil;
458
+ }
455
459
 
456
460
  // One-time initialization
457
461
  void Init_grpc_c() {
@@ -132,7 +132,7 @@ extern grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentia
132
132
  typedef void(*grpc_call_credentials_release_type)(grpc_call_credentials* creds);
133
133
  extern grpc_call_credentials_release_type grpc_call_credentials_release_import;
134
134
  #define grpc_call_credentials_release grpc_call_credentials_release_import
135
- typedef grpc_channel_credentials*(*grpc_google_default_credentials_create_type)(grpc_call_credentials* call_credentials);
135
+ typedef grpc_channel_credentials*(*grpc_google_default_credentials_create_type)(grpc_call_credentials* call_creds_for_tls, grpc_call_credentials* call_creds_for_alts);
136
136
  extern grpc_google_default_credentials_create_type grpc_google_default_credentials_create_import;
137
137
  #define grpc_google_default_credentials_create grpc_google_default_credentials_create_import
138
138
  typedef grpc_ssl_server_certificate_config*(*grpc_ssl_server_certificate_config_create_type)(const char* pem_root_certs, const grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs, size_t num_key_cert_pairs);
@@ -23,11 +23,7 @@
23
23
 
24
24
  int grpc_rb_load_core() {
25
25
  #if GPR_ARCH_64
26
- #if GRPC_RUBY_WINDOWS_UCRT
27
26
  TCHAR fname[] = _T("grpc_c.64-ucrt.ruby");
28
- #else
29
- TCHAR fname[] = _T("grpc_c.64-msvcrt.ruby");
30
- #endif
31
27
  #else
32
28
  TCHAR fname[] = _T("grpc_c.32-msvcrt.ruby");
33
29
  #endif
@@ -49,28 +49,32 @@ typedef struct grpc_rb_server {
49
49
  /* The actual server */
50
50
  grpc_server* wrapped;
51
51
  grpc_completion_queue* queue;
52
+ int shutdown_and_notify_done;
52
53
  int destroy_done;
53
54
  } grpc_rb_server;
54
55
 
55
- static void grpc_rb_server_shutdown_and_notify_internal(grpc_rb_server* server,
56
- gpr_timespec deadline) {
56
+ static void grpc_rb_server_maybe_shutdown_and_notify(grpc_rb_server* server,
57
+ gpr_timespec deadline) {
57
58
  grpc_event ev;
58
59
  void* tag = &ev;
59
- if (server->wrapped != NULL) {
60
- grpc_server_shutdown_and_notify(server->wrapped, server->queue, tag);
61
- // Following pluck calls will release the GIL and block but cannot
62
- // be interrupted. They should terminate quickly enough though b/c
63
- // we will cancel all server calls after the deadline.
64
- ev = rb_completion_queue_pluck(server->queue, tag, deadline, NULL, NULL);
65
- if (ev.type == GRPC_QUEUE_TIMEOUT) {
66
- grpc_server_cancel_all_calls(server->wrapped);
60
+ if (!server->shutdown_and_notify_done) {
61
+ server->shutdown_and_notify_done = 1;
62
+ if (server->wrapped != NULL) {
63
+ grpc_server_shutdown_and_notify(server->wrapped, server->queue, tag);
67
64
  ev = rb_completion_queue_pluck(
68
- server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL, NULL);
69
- }
70
- if (ev.type != GRPC_OP_COMPLETE) {
71
- grpc_absl_log_int(
72
- GPR_DEBUG,
73
- "GRPC_RUBY: bad grpc_server_shutdown_and_notify result:", ev.type);
65
+ server->queue, tag, deadline,
66
+ "grpc_server_shutdown_and_notify first try");
67
+ if (ev.type == GRPC_QUEUE_TIMEOUT) {
68
+ grpc_server_cancel_all_calls(server->wrapped);
69
+ ev = rb_completion_queue_pluck(
70
+ server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME),
71
+ "grpc_server_shutdown_and_notify second try");
72
+ }
73
+ if (ev.type != GRPC_OP_COMPLETE) {
74
+ grpc_absl_log_int(
75
+ GPR_DEBUG,
76
+ "GRPC_RUBY: bad grpc_server_shutdown_and_notify result: ", ev.type);
77
+ }
74
78
  }
75
79
  }
76
80
  }
@@ -89,19 +93,15 @@ static void grpc_rb_server_maybe_destroy(grpc_rb_server* server) {
89
93
  }
90
94
 
91
95
  static void grpc_rb_server_free_internal(void* p) {
92
- grpc_rb_server* svr = NULL;
93
- gpr_timespec deadline;
94
96
  if (p == NULL) {
95
97
  return;
96
98
  };
97
- svr = (grpc_rb_server*)p;
98
-
99
- deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
100
- gpr_time_from_seconds(2, GPR_TIMESPAN));
101
-
102
- grpc_rb_server_shutdown_and_notify_internal(svr, deadline);
103
- grpc_rb_server_maybe_destroy(svr);
104
-
99
+ grpc_rb_server* server = (grpc_rb_server*)p;
100
+ // Shutdown the server first if we haven't already
101
+ gpr_timespec deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
102
+ gpr_time_from_seconds(2, GPR_TIMESPAN));
103
+ grpc_rb_server_maybe_shutdown_and_notify(server, deadline);
104
+ grpc_rb_server_maybe_destroy(server);
105
105
  xfree(p);
106
106
  }
107
107
 
@@ -131,6 +131,7 @@ static VALUE grpc_rb_server_alloc(VALUE cls) {
131
131
  grpc_rb_server* wrapper = ALLOC(grpc_rb_server);
132
132
  wrapper->wrapped = NULL;
133
133
  wrapper->destroy_done = 0;
134
+ wrapper->shutdown_and_notify_done = 0;
134
135
  return TypedData_Wrap_Struct(cls, &grpc_rb_server_data_type, wrapper);
135
136
  }
136
137
 
@@ -190,26 +191,6 @@ struct server_request_call_args {
190
191
  request_call_stack st;
191
192
  };
192
193
 
193
- static void shutdown_server_unblock_func(void* arg) {
194
- grpc_rb_server* server = (grpc_rb_server*)arg;
195
- grpc_absl_log(GPR_DEBUG, "GRPC_RUBY: shutdown_server_unblock_func");
196
- GRPC_RUBY_ASSERT(server->wrapped != NULL);
197
- grpc_event event;
198
- void* tag = &event;
199
- grpc_server_shutdown_and_notify(server->wrapped, server->queue, tag);
200
- grpc_server_cancel_all_calls(server->wrapped);
201
- // Following call is blocking, but should finish quickly since we've
202
- // cancelled all calls.
203
- event = grpc_completion_queue_pluck(server->queue, tag,
204
- gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
205
- grpc_absl_log_int(
206
- GPR_DEBUG,
207
- "GRPC_RUBY: shutdown_server_unblock_func pluck event.type: ", event.type);
208
- grpc_absl_log_int(
209
- GPR_DEBUG,
210
- "GRPC_RUBY: shutdown_server_unblock_func event.success: ", event.success);
211
- }
212
-
213
194
  static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
214
195
  grpc_rb_fork_unsafe_begin();
215
196
  struct server_request_call_args* args =
@@ -232,9 +213,9 @@ static VALUE grpc_rb_server_request_call_try(VALUE value_args) {
232
213
  grpc_call_error_detail_of(err), err);
233
214
  }
234
215
 
235
- grpc_event ev = rb_completion_queue_pluck(
236
- args->server->queue, tag, gpr_inf_future(GPR_CLOCK_REALTIME),
237
- shutdown_server_unblock_func, args->server);
216
+ grpc_event ev = rb_completion_queue_pluck(args->server->queue, tag,
217
+ gpr_inf_future(GPR_CLOCK_REALTIME),
218
+ "server request call");
238
219
  if (!ev.success) {
239
220
  rb_raise(grpc_rb_eCallError, "request_call completion failed");
240
221
  }
@@ -307,7 +288,7 @@ static VALUE grpc_rb_server_shutdown_and_notify(VALUE self, VALUE timeout) {
307
288
  deadline = grpc_rb_time_timeval(timeout, /* absolute time*/ 0);
308
289
  }
309
290
 
310
- grpc_rb_server_shutdown_and_notify_internal(s, deadline);
291
+ grpc_rb_server_maybe_shutdown_and_notify(s, deadline);
311
292
 
312
293
  return Qnil;
313
294
  }
@@ -60,7 +60,7 @@ module GRPC
60
60
  # Minimally, a stub is created with the just the host of the gRPC service
61
61
  # it wishes to access, e.g.,
62
62
  #
63
- # my_stub = ClientStub.new(example.host.com:50505,
63
+ # my_stub = ClientStub.new("example.host.com:50505",
64
64
  # :this_channel_is_insecure)
65
65
  #
66
66
  # If a channel_override argument is passed, it will be used as the
@@ -72,7 +72,7 @@ module GRPC
72
72
  #
73
73
  # - :channel_override
74
74
  # when present, this must be a pre-created GRPC::Core::Channel. If it's
75
- # present the host and arbitrary keyword arg areignored, and the RPC
75
+ # present the host and arbitrary keyword args are ignored, and the RPC
76
76
  # connection uses this channel.
77
77
  #
78
78
  # - :timeout
@@ -118,11 +118,11 @@ module GRPC
118
118
  #
119
119
  # * it does not return until a response is received.
120
120
  #
121
- # * the requests is sent only when GRPC core's flow control allows it to
121
+ # * the request is sent only when GRPC core's flow control allows it to
122
122
  # be sent.
123
123
  #
124
124
  # == Errors ==
125
- # An RuntimeError is raised if
125
+ # A RuntimeError is raised if
126
126
  #
127
127
  # * the server responds with a non-OK status
128
128
  #
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.73.0'
17
+ VERSION = '1.74.0'
18
18
  end
@@ -0,0 +1,22 @@
1
+ # Copyright 2015 gRPC authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'spec_helper'
16
+
17
+ describe GRPC::Core do
18
+ it 'returns valid VALUEs from C functions' do
19
+ expect(GRPC::Core.fork_unsafe_begin).to be_nil
20
+ expect(GRPC::Core.fork_unsafe_end).to be_nil
21
+ end
22
+ end
@@ -60,8 +60,8 @@ describe GRPC::ActiveCall do
60
60
 
61
61
  after(:each) do
62
62
  @server.shutdown_and_notify(deadline)
63
- @server.close
64
63
  @server_thread.join
64
+ @server.close
65
65
  # Don't rely on GC to unref the call, since that can prevent
66
66
  # the channel connectivity state polling thread from shutting down.
67
67
  @call.close
@@ -44,7 +44,6 @@
44
44
  #include <cassert>
45
45
  #include <iterator>
46
46
  #include <numeric>
47
- #include <random>
48
47
  #include <type_traits>
49
48
  #include <unordered_map>
50
49
  #include <unordered_set>
@@ -76,8 +75,8 @@ using ContainerIter = decltype(begin(std::declval<C&>()));
76
75
  // An MSVC bug involving template parameter substitution requires us to use
77
76
  // decltype() here instead of just std::pair.
78
77
  template <typename C1, typename C2>
79
- using ContainerIterPairType =
80
- decltype(std::make_pair(ContainerIter<C1>(), ContainerIter<C2>()));
78
+ using ContainerIterPairType = decltype(std::make_pair(
79
+ std::declval<ContainerIter<C1>>(), std::declval<ContainerIter<C2>>()));
81
80
 
82
81
  template <typename C>
83
82
  using ContainerDifferenceType = decltype(std::distance(
@@ -847,25 +846,9 @@ template <typename C, typename OutputIterator, typename Distance,
847
846
  typename UniformRandomBitGenerator>
848
847
  OutputIterator c_sample(const C& c, OutputIterator result, Distance n,
849
848
  UniformRandomBitGenerator&& gen) {
850
- #if defined(__cpp_lib_sample) && __cpp_lib_sample >= 201603L
851
849
  return std::sample(container_algorithm_internal::c_begin(c),
852
850
  container_algorithm_internal::c_end(c), result, n,
853
851
  std::forward<UniformRandomBitGenerator>(gen));
854
- #else
855
- // Fall back to a stable selection-sampling implementation.
856
- auto first = container_algorithm_internal::c_begin(c);
857
- Distance unsampled_elements = c_distance(c);
858
- n = (std::min)(n, unsampled_elements);
859
- for (; n != 0; ++first) {
860
- Distance r =
861
- std::uniform_int_distribution<Distance>(0, --unsampled_elements)(gen);
862
- if (r < n) {
863
- *result++ = *first;
864
- --n;
865
- }
866
- }
867
- return result;
868
- #endif
869
852
  }
870
853
 
871
854
  //------------------------------------------------------------------------------
@@ -339,9 +339,9 @@
339
339
  #ifndef ABSL_ATTRIBUTE_SECTION_VARIABLE
340
340
  #ifdef _AIX
341
341
  // __attribute__((section(#name))) on AIX is achieved by using the `.csect`
342
- // psudo op which includes an additional integer as part of its syntax indcating
343
- // alignment. If data fall under different alignments then you might get a
344
- // compilation error indicating a `Section type conflict`.
342
+ // pseudo op which includes an additional integer as part of its syntax
343
+ // indicating alignment. If data fall under different alignments then you might
344
+ // get a compilation error indicating a `Section type conflict`.
345
345
  #define ABSL_ATTRIBUTE_SECTION_VARIABLE(name)
346
346
  #else
347
347
  #define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name)))
@@ -553,12 +553,11 @@
553
553
  //
554
554
  // Prevents the compiler from complaining about variables that appear unused.
555
555
  //
556
- // For code or headers that are assured to only build with C++17 and up, prefer
557
- // just using the standard '[[maybe_unused]]' directly over this macro.
556
+ // Deprecated: Use the standard C++17 `[[maybe_unused]` instead.
558
557
  //
559
558
  // Due to differences in positioning requirements between the old, compiler
560
- // specific __attribute__ syntax and the now standard [[maybe_unused]], this
561
- // macro does not attempt to take advantage of '[[maybe_unused]]'.
559
+ // specific __attribute__ syntax and the now standard `[[maybe_unused]]`, this
560
+ // macro does not attempt to take advantage of `[[maybe_unused]]`.
562
561
  #if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__))
563
562
  #undef ABSL_ATTRIBUTE_UNUSED
564
563
  #define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__))
@@ -759,6 +758,76 @@
759
758
  #define ABSL_CONST_INIT
760
759
  #endif
761
760
 
761
+ // ABSL_REQUIRE_EXPLICIT_INIT
762
+ //
763
+ // ABSL_REQUIRE_EXPLICIT_INIT is placed *after* the data members of an aggregate
764
+ // type to indicate that the annotated member must be explicitly initialized by
765
+ // the user whenever the aggregate is constructed. For example:
766
+ //
767
+ // struct Coord {
768
+ // int x ABSL_REQUIRE_EXPLICIT_INIT;
769
+ // int y ABSL_REQUIRE_EXPLICIT_INIT;
770
+ // };
771
+ // Coord coord = {1}; // warning: field 'y' is not explicitly initialized
772
+ //
773
+ // Note that usage on C arrays is not supported in C++.
774
+ // Use a struct (such as std::array) to wrap the array member instead.
775
+ //
776
+ // Avoid applying this attribute to the members of non-aggregate types.
777
+ // The behavior within non-aggregates is unspecified and subject to change.
778
+ //
779
+ // Do NOT attempt to suppress or demote the error generated by this attribute.
780
+ // Just like with a missing function argument, it is a hard error by design.
781
+ //
782
+ // See the upstream documentation for more details:
783
+ // https://clang.llvm.org/docs/AttributeReference.html#require-explicit-initialization
784
+ #ifdef __cplusplus
785
+ #if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_explicit_initialization)
786
+ // clang-format off
787
+ #define ABSL_REQUIRE_EXPLICIT_INIT \
788
+ [[clang::require_explicit_initialization]] = \
789
+ AbslInternal_YouForgotToExplicitlyInitializeAField::v
790
+ #else
791
+ #define ABSL_REQUIRE_EXPLICIT_INIT \
792
+ = AbslInternal_YouForgotToExplicitlyInitializeAField::v
793
+ #endif
794
+ // clang-format on
795
+ #else
796
+ // clang-format off
797
+ #if ABSL_HAVE_ATTRIBUTE(require_explicit_initialization)
798
+ #define ABSL_REQUIRE_EXPLICIT_INIT \
799
+ __attribute__((require_explicit_initialization))
800
+ #else
801
+ #define ABSL_REQUIRE_EXPLICIT_INIT \
802
+ /* No portable fallback for C is available */
803
+ #endif
804
+ // clang-format on
805
+ #endif
806
+
807
+ #ifdef __cplusplus
808
+ struct AbslInternal_YouForgotToExplicitlyInitializeAField {
809
+ // A portable version of [[clang::require_explicit_initialization]] that
810
+ // never builds, as a last resort for all toolchains.
811
+ // The error messages are poor, so we don't rely on this unless we have to.
812
+ template <class T>
813
+ #if !defined(SWIG)
814
+ constexpr
815
+ #endif
816
+ operator T() const /* NOLINT */ {
817
+ const void *volatile deliberately_volatile_ptr = nullptr;
818
+ // Infinite loop to prevent constexpr compilation
819
+ for (;;) {
820
+ // This assignment ensures the 'this' pointer is not optimized away, so
821
+ // that linking always fails.
822
+ deliberately_volatile_ptr = this; // Deliberately not constexpr
823
+ (void)deliberately_volatile_ptr;
824
+ }
825
+ }
826
+ // This is deliberately left undefined to prevent linking
827
+ static AbslInternal_YouForgotToExplicitlyInitializeAField v;
828
+ };
829
+ #endif
830
+
762
831
  // ABSL_ATTRIBUTE_PURE_FUNCTION
763
832
  //
764
833
  // ABSL_ATTRIBUTE_PURE_FUNCTION is used to annotate declarations of "pure"
@@ -28,12 +28,12 @@
28
28
  #include <algorithm>
29
29
  #include <atomic>
30
30
  #include <cstdint>
31
+ #include <functional>
31
32
  #include <type_traits>
32
33
  #include <utility>
33
34
 
34
35
  #include "absl/base/attributes.h"
35
36
  #include "absl/base/config.h"
36
- #include "absl/base/internal/invoke.h"
37
37
  #include "absl/base/internal/low_level_scheduling.h"
38
38
  #include "absl/base/internal/raw_logging.h"
39
39
  #include "absl/base/internal/scheduling_mode.h"
@@ -49,8 +49,8 @@ ABSL_NAMESPACE_BEGIN
49
49
  class once_flag;
50
50
 
51
51
  namespace base_internal {
52
- absl::Nonnull<std::atomic<uint32_t>*> ControlWord(
53
- absl::Nonnull<absl::once_flag*> flag);
52
+ std::atomic<uint32_t>* absl_nonnull ControlWord(
53
+ absl::once_flag* absl_nonnull flag);
54
54
  } // namespace base_internal
55
55
 
56
56
  // call_once()
@@ -93,8 +93,8 @@ class once_flag {
93
93
  once_flag& operator=(const once_flag&) = delete;
94
94
 
95
95
  private:
96
- friend absl::Nonnull<std::atomic<uint32_t>*> base_internal::ControlWord(
97
- absl::Nonnull<once_flag*> flag);
96
+ friend std::atomic<uint32_t>* absl_nonnull base_internal::ControlWord(
97
+ once_flag* absl_nonnull flag);
98
98
  std::atomic<uint32_t> control_;
99
99
  };
100
100
 
@@ -108,7 +108,7 @@ namespace base_internal {
108
108
  // Like call_once, but uses KERNEL_ONLY scheduling. Intended to be used to
109
109
  // initialize entities used by the scheduler implementation.
110
110
  template <typename Callable, typename... Args>
111
- void LowLevelCallOnce(absl::Nonnull<absl::once_flag*> flag, Callable&& fn,
111
+ void LowLevelCallOnce(absl::once_flag* absl_nonnull flag, Callable&& fn,
112
112
  Args&&... args);
113
113
 
114
114
  // Disables scheduling while on stack when scheduling mode is non-cooperative.
@@ -150,7 +150,7 @@ enum {
150
150
 
151
151
  template <typename Callable, typename... Args>
152
152
  void
153
- CallOnceImpl(absl::Nonnull<std::atomic<uint32_t>*> control,
153
+ CallOnceImpl(std::atomic<uint32_t>* absl_nonnull control,
154
154
  base_internal::SchedulingMode scheduling_mode, Callable&& fn,
155
155
  Args&&... args) {
156
156
  #ifndef NDEBUG
@@ -181,8 +181,7 @@ template <typename Callable, typename... Args>
181
181
  std::memory_order_relaxed) ||
182
182
  base_internal::SpinLockWait(control, ABSL_ARRAYSIZE(trans), trans,
183
183
  scheduling_mode) == kOnceInit) {
184
- base_internal::invoke(std::forward<Callable>(fn),
185
- std::forward<Args>(args)...);
184
+ std::invoke(std::forward<Callable>(fn), std::forward<Args>(args)...);
186
185
  old_control =
187
186
  control->exchange(base_internal::kOnceDone, std::memory_order_release);
188
187
  if (old_control == base_internal::kOnceWaiter) {
@@ -191,13 +190,13 @@ template <typename Callable, typename... Args>
191
190
  } // else *control is already kOnceDone
192
191
  }
193
192
 
194
- inline absl::Nonnull<std::atomic<uint32_t>*> ControlWord(
195
- absl::Nonnull<once_flag*> flag) {
193
+ inline std::atomic<uint32_t>* absl_nonnull ControlWord(
194
+ once_flag* absl_nonnull flag) {
196
195
  return &flag->control_;
197
196
  }
198
197
 
199
198
  template <typename Callable, typename... Args>
200
- void LowLevelCallOnce(absl::Nonnull<absl::once_flag*> flag, Callable&& fn,
199
+ void LowLevelCallOnce(absl::once_flag* absl_nonnull flag, Callable&& fn,
201
200
  Args&&... args) {
202
201
  std::atomic<uint32_t>* once = base_internal::ControlWord(flag);
203
202
  uint32_t s = once->load(std::memory_order_acquire);