grpc 1.49.0.pre1 → 1.50.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (271) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +54 -153
  3. data/include/grpc/event_engine/endpoint_config.h +11 -5
  4. data/include/grpc/event_engine/event_engine.h +1 -1
  5. data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
  6. data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
  7. data/include/grpc/impl/codegen/atm_windows.h +0 -2
  8. data/include/grpc/impl/codegen/grpc_types.h +6 -0
  9. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
  10. data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
  11. data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
  12. data/src/core/ext/filters/client_channel/client_channel.h +1 -1
  13. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
  14. data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
  15. data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
  16. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
  17. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
  20. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
  22. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
  26. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
  27. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
  28. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
  29. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
  35. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
  36. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
  37. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
  38. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
  39. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
  40. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
  41. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
  42. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
  43. data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
  44. data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
  45. data/src/core/ext/filters/client_channel/subchannel.h +12 -3
  46. data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
  47. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
  48. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
  49. data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
  50. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
  51. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
  52. data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
  53. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
  54. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
  55. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
  56. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
  57. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
  59. data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
  60. data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
  61. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
  62. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
  65. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
  66. data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
  67. data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
  68. data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
  69. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
  70. data/src/core/ext/xds/certificate_provider_store.cc +63 -3
  71. data/src/core/ext/xds/certificate_provider_store.h +9 -1
  72. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
  73. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
  74. data/src/core/ext/xds/xds_api.cc +21 -17
  75. data/src/core/ext/xds/xds_api.h +7 -0
  76. data/src/core/ext/xds/xds_bootstrap.cc +5 -537
  77. data/src/core/ext/xds/xds_bootstrap.h +39 -111
  78. data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
  79. data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
  80. data/src/core/ext/xds/xds_client.cc +219 -145
  81. data/src/core/ext/xds/xds_client.h +19 -17
  82. data/src/core/ext/xds/xds_client_grpc.cc +18 -80
  83. data/src/core/ext/xds/xds_client_grpc.h +2 -25
  84. data/src/core/ext/xds/xds_client_stats.cc +4 -4
  85. data/src/core/ext/xds/xds_cluster.cc +87 -79
  86. data/src/core/ext/xds/xds_cluster.h +5 -5
  87. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
  88. data/src/core/ext/xds/xds_common_types.cc +13 -5
  89. data/src/core/ext/xds/xds_endpoint.cc +8 -6
  90. data/src/core/ext/xds/xds_endpoint.h +3 -4
  91. data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
  92. data/src/core/ext/xds/xds_listener.cc +25 -20
  93. data/src/core/ext/xds/xds_listener.h +3 -4
  94. data/src/core/ext/xds/xds_resource_type.h +11 -8
  95. data/src/core/ext/xds/xds_route_config.cc +15 -16
  96. data/src/core/ext/xds/xds_route_config.h +3 -3
  97. data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
  98. data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
  99. data/src/core/lib/backoff/backoff.cc +2 -4
  100. data/src/core/lib/channel/call_finalization.h +1 -3
  101. data/src/core/lib/channel/channel_args.h +114 -14
  102. data/src/core/lib/channel/channel_trace.cc +3 -4
  103. data/src/core/lib/channel/promise_based_filter.cc +18 -19
  104. data/src/core/lib/channel/status_util.cc +27 -0
  105. data/src/core/lib/channel/status_util.h +10 -0
  106. data/src/core/lib/config/core_configuration.cc +5 -1
  107. data/src/core/lib/config/core_configuration.h +33 -0
  108. data/src/core/lib/debug/stats.cc +26 -30
  109. data/src/core/lib/debug/stats.h +2 -12
  110. data/src/core/lib/debug/stats_data.cc +118 -614
  111. data/src/core/lib/debug/stats_data.h +67 -465
  112. data/src/core/lib/debug/trace.cc +0 -2
  113. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
  114. data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
  115. data/src/core/lib/event_engine/forkable.cc +19 -16
  116. data/src/core/lib/event_engine/poller.h +14 -12
  117. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
  118. data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
  119. data/src/core/lib/event_engine/thread_pool.cc +131 -94
  120. data/src/core/lib/event_engine/thread_pool.h +56 -23
  121. data/src/core/lib/event_engine/time_util.cc +30 -0
  122. data/src/core/lib/event_engine/time_util.h +32 -0
  123. data/src/core/lib/event_engine/utils.cc +0 -5
  124. data/src/core/lib/event_engine/utils.h +0 -4
  125. data/src/core/lib/event_engine/windows/iocp.cc +13 -7
  126. data/src/core/lib/event_engine/windows/iocp.h +2 -1
  127. data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
  128. data/src/core/lib/experiments/config.cc +146 -0
  129. data/src/core/lib/experiments/config.h +43 -0
  130. data/src/core/lib/experiments/experiments.cc +75 -0
  131. data/src/core/lib/experiments/experiments.h +56 -0
  132. data/src/core/lib/gpr/alloc.cc +1 -9
  133. data/src/core/lib/gpr/log_windows.cc +0 -1
  134. data/src/core/lib/gpr/string_util_windows.cc +3 -30
  135. data/src/core/lib/gpr/sync_abseil.cc +0 -14
  136. data/src/core/lib/gpr/sync_posix.cc +0 -14
  137. data/src/core/lib/gpr/time_posix.cc +0 -6
  138. data/src/core/lib/gpr/time_precise.h +1 -1
  139. data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
  140. data/src/core/lib/gpr/useful.h +11 -0
  141. data/src/core/lib/{gpr → gprpp}/env.h +25 -12
  142. data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
  143. data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
  144. data/src/core/lib/gprpp/env_windows.cc +56 -0
  145. data/src/core/lib/gprpp/fork.cc +14 -22
  146. data/src/core/lib/gprpp/fork.h +0 -8
  147. data/src/core/lib/gprpp/global_config_env.cc +7 -6
  148. data/src/core/lib/gprpp/notification.h +67 -0
  149. data/src/core/lib/gprpp/packed_table.h +40 -0
  150. data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
  151. data/src/core/lib/gprpp/sorted_pack.h +98 -0
  152. data/src/core/lib/gprpp/status_helper.h +6 -0
  153. data/src/core/lib/gprpp/table.h +9 -1
  154. data/src/core/lib/gprpp/tchar.cc +49 -0
  155. data/src/core/lib/gprpp/tchar.h +33 -0
  156. data/src/core/lib/gprpp/time.cc +21 -0
  157. data/src/core/lib/gprpp/time.h +55 -0
  158. data/src/core/lib/gprpp/validation_errors.cc +61 -0
  159. data/src/core/lib/gprpp/validation_errors.h +110 -0
  160. data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
  161. data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
  162. data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
  163. data/src/core/lib/iomgr/call_combiner.cc +0 -8
  164. data/src/core/lib/iomgr/closure.h +0 -1
  165. data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
  166. data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
  167. data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
  168. data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
  169. data/src/core/lib/iomgr/exec_ctx.cc +0 -10
  170. data/src/core/lib/iomgr/exec_ctx.h +7 -31
  171. data/src/core/lib/iomgr/iocp_windows.cc +1 -2
  172. data/src/core/lib/iomgr/iomgr.cc +6 -8
  173. data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
  174. data/src/core/lib/iomgr/pollset.h +1 -1
  175. data/src/core/lib/iomgr/pollset_set.h +0 -1
  176. data/src/core/lib/iomgr/resolve_address.h +1 -0
  177. data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
  178. data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
  179. data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
  180. data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
  181. data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
  182. data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
  183. data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
  184. data/src/core/lib/iomgr/tcp_client.cc +6 -7
  185. data/src/core/lib/iomgr/tcp_client.h +11 -11
  186. data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
  188. data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
  189. data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
  190. data/src/core/lib/iomgr/tcp_posix.cc +131 -114
  191. data/src/core/lib/iomgr/tcp_posix.h +3 -1
  192. data/src/core/lib/iomgr/tcp_server.cc +5 -4
  193. data/src/core/lib/iomgr/tcp_server.h +9 -6
  194. data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
  195. data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
  196. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
  197. data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
  198. data/src/core/lib/iomgr/tcp_windows.cc +0 -1
  199. data/src/core/lib/iomgr/tcp_windows.h +0 -1
  200. data/src/core/lib/iomgr/timer_generic.cc +4 -4
  201. data/src/core/lib/iomgr/timer_manager.cc +1 -2
  202. data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
  203. data/src/core/lib/json/json_object_loader.cc +21 -52
  204. data/src/core/lib/json/json_object_loader.h +56 -76
  205. data/src/core/lib/json/json_util.cc +2 -1
  206. data/src/core/lib/load_balancing/lb_policy.h +5 -5
  207. data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
  208. data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
  209. data/src/core/lib/promise/activity.h +2 -3
  210. data/src/core/lib/promise/context.h +1 -1
  211. data/src/core/lib/promise/sleep.cc +16 -4
  212. data/src/core/lib/promise/sleep.h +8 -2
  213. data/src/core/lib/resolver/resolver.h +13 -3
  214. data/src/core/lib/resource_quota/api.cc +9 -0
  215. data/src/core/lib/resource_quota/api.h +6 -0
  216. data/src/core/lib/resource_quota/arena.cc +1 -3
  217. data/src/core/lib/resource_quota/memory_quota.cc +8 -24
  218. data/src/core/lib/resource_quota/memory_quota.h +6 -19
  219. data/src/core/lib/resource_quota/periodic_update.cc +2 -3
  220. data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
  221. data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
  222. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
  223. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
  224. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
  225. data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
  226. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
  227. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
  228. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
  229. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
  230. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
  231. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
  232. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
  233. data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
  234. data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
  235. data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
  236. data/src/core/lib/surface/call.cc +1 -11
  237. data/src/core/lib/surface/channel.cc +3 -2
  238. data/src/core/lib/surface/completion_queue.cc +16 -28
  239. data/src/core/lib/surface/completion_queue.h +1 -1
  240. data/src/core/lib/surface/completion_queue_factory.cc +5 -0
  241. data/src/core/lib/surface/init.cc +16 -11
  242. data/src/core/lib/surface/init_internally.cc +24 -0
  243. data/src/core/lib/surface/init_internally.h +28 -0
  244. data/src/core/lib/surface/server.cc +1 -7
  245. data/src/core/lib/surface/server.h +4 -6
  246. data/src/core/lib/surface/version.cc +2 -2
  247. data/src/core/lib/transport/bdp_estimator.cc +1 -3
  248. data/src/core/lib/transport/metadata_batch.cc +2 -3
  249. data/src/core/lib/transport/metadata_batch.h +9 -7
  250. data/src/core/lib/transport/parsed_metadata.h +4 -2
  251. data/src/core/lib/transport/status_conversion.cc +1 -3
  252. data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
  253. data/src/core/lib/transport/transport.h +0 -1
  254. data/src/core/lib/transport/transport_impl.h +0 -1
  255. data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
  256. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
  257. data/src/ruby/ext/grpc/extconf.rb +1 -1
  258. data/src/ruby/lib/grpc/version.rb +1 -1
  259. data/src/ruby/spec/channel_spec.rb +5 -0
  260. data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
  261. data/src/ruby/spec/user_agent_spec.rb +1 -1
  262. metadata +31 -17
  263. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
  264. data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
  265. data/src/core/ext/xds/certificate_provider_registry.h +0 -59
  266. data/src/core/lib/event_engine/promise.h +0 -78
  267. data/src/core/lib/gpr/env_windows.cc +0 -74
  268. data/src/core/lib/gpr/string_windows.h +0 -32
  269. data/src/core/lib/profiling/basic_timers.cc +0 -295
  270. data/src/core/lib/profiling/stap_timers.cc +0 -50
  271. data/src/core/lib/profiling/timers.h +0 -94
@@ -32,7 +32,6 @@
32
32
  #include "src/core/lib/gprpp/debug_location.h"
33
33
  #include "src/core/lib/gprpp/sync.h"
34
34
  #include "src/core/lib/gprpp/time.h"
35
- #include "src/core/lib/iomgr/exec_ctx.h"
36
35
  #include "src/core/lib/resource_quota/resource_quota.h"
37
36
  #include "src/core/lib/transport/error_utils.h"
38
37
 
@@ -128,7 +127,7 @@ void SubchannelStreamClient::StartRetryTimerLocked() {
128
127
  if (GPR_UNLIKELY(tracer_ != nullptr)) {
129
128
  gpr_log(GPR_INFO, "%s %p: SubchannelStreamClient health check call lost...",
130
129
  tracer_, this);
131
- Duration timeout = next_try - ExecCtx::Get()->Now();
130
+ Duration timeout = next_try - Timestamp::Now();
132
131
  if (timeout > Duration::Zero()) {
133
132
  gpr_log(GPR_INFO, "%s %p: ... will retry in %" PRId64 "ms.", tracer_,
134
133
  this, timeout.millis());
@@ -19,7 +19,6 @@
19
19
  #include "src/core/ext/filters/fault_injection/fault_injection_filter.h"
20
20
 
21
21
  #include <stdint.h>
22
- #include <stdlib.h>
23
22
 
24
23
  #include <algorithm>
25
24
  #include <atomic>
@@ -32,7 +31,6 @@
32
31
  #include "absl/strings/str_cat.h"
33
32
  #include "absl/strings/string_view.h"
34
33
  #include "absl/types/optional.h"
35
- #include "absl/utility/utility.h"
36
34
 
37
35
  #include <grpc/status.h>
38
36
  #include <grpc/support/log.h>
@@ -44,7 +42,6 @@
44
42
  #include "src/core/lib/config/core_configuration.h"
45
43
  #include "src/core/lib/debug/trace.h"
46
44
  #include "src/core/lib/gprpp/time.h"
47
- #include "src/core/lib/iomgr/exec_ctx.h"
48
45
  #include "src/core/lib/promise/context.h"
49
46
  #include "src/core/lib/promise/sleep.h"
50
47
  #include "src/core/lib/promise/try_seq.h"
@@ -70,12 +67,14 @@ auto AsInt(absl::string_view s) -> absl::optional<T> {
70
67
  return absl::nullopt;
71
68
  }
72
69
 
73
- inline bool UnderFraction(const uint32_t numerator,
70
+ inline bool UnderFraction(absl::InsecureBitGen* rand_generator,
71
+ const uint32_t numerator,
74
72
  const uint32_t denominator) {
75
73
  if (numerator <= 0) return false;
76
74
  if (numerator >= denominator) return true;
77
75
  // Generate a random number in [0, denominator).
78
- const uint32_t random_number = rand() % denominator;
76
+ const uint32_t random_number =
77
+ absl::Uniform(absl::IntervalClosedOpen, *rand_generator, 0u, denominator);
79
78
  return random_number < numerator;
80
79
  }
81
80
 
@@ -96,7 +95,7 @@ class FaultHandle {
96
95
  FaultHandle(const FaultHandle&) = delete;
97
96
  FaultHandle& operator=(const FaultHandle&) = delete;
98
97
  FaultHandle(FaultHandle&& other) noexcept
99
- : active_(absl::exchange(other.active_, false)) {}
98
+ : active_(std::exchange(other.active_, false)) {}
100
99
  FaultHandle& operator=(FaultHandle&& other) noexcept {
101
100
  std::swap(active_, other.active_);
102
101
  return *this;
@@ -139,7 +138,8 @@ FaultInjectionFilter::FaultInjectionFilter(ChannelFilter::Args filter_args)
139
138
  filter_args.channel_stack(),
140
139
  filter_args.uninitialized_channel_element())),
141
140
  service_config_parser_index_(
142
- FaultInjectionServiceConfigParser::ParserIndex()) {}
141
+ FaultInjectionServiceConfigParser::ParserIndex()),
142
+ mu_(new Mutex) {}
143
143
 
144
144
  // Construct a promise for one call.
145
145
  ArenaPromise<ServerMetadataHandle> FaultInjectionFilter::MakeCallPromise(
@@ -219,14 +219,21 @@ FaultInjectionFilter::MakeInjectionDecision(
219
219
  }
220
220
  }
221
221
  // Roll the dice
222
- const bool delay_request =
223
- delay != Duration::Zero() &&
224
- UnderFraction(delay_percentage_numerator,
225
- fi_policy->delay_percentage_denominator);
226
- const bool abort_request =
227
- abort_code != GRPC_STATUS_OK &&
228
- UnderFraction(abort_percentage_numerator,
229
- fi_policy->abort_percentage_denominator);
222
+ bool delay_request = delay != Duration::Zero();
223
+ bool abort_request = abort_code != GRPC_STATUS_OK;
224
+ if (delay_request || abort_request) {
225
+ MutexLock lock(mu_.get());
226
+ if (delay_request) {
227
+ delay_request =
228
+ UnderFraction(&delay_rand_generator_, delay_percentage_numerator,
229
+ fi_policy->delay_percentage_denominator);
230
+ }
231
+ if (abort_request) {
232
+ abort_request =
233
+ UnderFraction(&abort_rand_generator_, abort_percentage_numerator,
234
+ fi_policy->abort_percentage_denominator);
235
+ }
236
+ }
230
237
 
231
238
  return InjectionDecision(
232
239
  fi_policy->max_faults, delay_request ? delay : Duration::Zero(),
@@ -243,7 +250,7 @@ bool FaultInjectionFilter::InjectionDecision::HaveActiveFaultsQuota() const {
243
250
  Timestamp FaultInjectionFilter::InjectionDecision::DelayUntil() {
244
251
  if (delay_time_ != Duration::Zero() && HaveActiveFaultsQuota()) {
245
252
  active_fault_ = FaultHandle{true};
246
- return ExecCtx::Get()->Now() + delay_time_;
253
+ return Timestamp::Now() + delay_time_;
247
254
  }
248
255
  return Timestamp::InfPast();
249
256
  }
@@ -21,11 +21,16 @@
21
21
 
22
22
  #include <stddef.h>
23
23
 
24
+ #include <memory>
25
+
26
+ #include "absl/base/thread_annotations.h"
27
+ #include "absl/random/random.h"
24
28
  #include "absl/status/statusor.h"
25
29
 
26
30
  #include "src/core/lib/channel/channel_args.h"
27
31
  #include "src/core/lib/channel/channel_fwd.h"
28
32
  #include "src/core/lib/channel/promise_based_filter.h"
33
+ #include "src/core/lib/gprpp/sync.h"
29
34
  #include "src/core/lib/promise/arena_promise.h"
30
35
  #include "src/core/lib/transport/transport.h"
31
36
 
@@ -60,6 +65,9 @@ class FaultInjectionFilter : public ChannelFilter {
60
65
  // The relative index of instances of the same filter.
61
66
  size_t index_;
62
67
  const size_t service_config_parser_index_;
68
+ std::unique_ptr<Mutex> mu_;
69
+ absl::InsecureBitGen abort_rand_generator_ ABSL_GUARDED_BY(mu_);
70
+ absl::InsecureBitGen delay_rand_generator_ ABSL_GUARDED_BY(mu_);
63
71
  };
64
72
 
65
73
  } // namespace grpc_core
@@ -31,7 +31,6 @@
31
31
  #include "absl/strings/str_join.h"
32
32
  #include "absl/strings/string_view.h"
33
33
  #include "absl/types/optional.h"
34
- #include "absl/utility/utility.h"
35
34
 
36
35
  #include <grpc/grpc.h>
37
36
  #include <grpc/impl/codegen/grpc_types.h>
@@ -120,7 +119,7 @@ ArenaPromise<ServerMetadataHandle> HttpClientFilter::MakeCallPromise(
120
119
 
121
120
  auto* read_latch = GetContext<Arena>()->New<Latch<ServerMetadata*>>();
122
121
  auto* write_latch =
123
- absl::exchange(call_args.server_initial_metadata, read_latch);
122
+ std::exchange(call_args.server_initial_metadata, read_latch);
124
123
 
125
124
  return CallPushPull(
126
125
  Seq(next_promise_factory(std::move(call_args)),
@@ -24,10 +24,10 @@
24
24
  #include <stdlib.h>
25
25
 
26
26
  #include <new>
27
+ #include <utility>
27
28
 
28
29
  #include "absl/meta/type_traits.h"
29
30
  #include "absl/types/optional.h"
30
- #include "absl/utility/utility.h"
31
31
 
32
32
  #include <grpc/compression.h>
33
33
  #include <grpc/impl/codegen/compression_types.h>
@@ -40,7 +40,6 @@
40
40
  #include "src/core/lib/iomgr/call_combiner.h"
41
41
  #include "src/core/lib/iomgr/closure.h"
42
42
  #include "src/core/lib/iomgr/error.h"
43
- #include "src/core/lib/profiling/timers.h"
44
43
  #include "src/core/lib/slice/slice_buffer.h"
45
44
  #include "src/core/lib/surface/call.h"
46
45
  #include "src/core/lib/transport/metadata_batch.h"
@@ -204,7 +203,7 @@ void CallData::FinishSendMessage(grpc_call_element* elem) {
204
203
  }
205
204
  }
206
205
  }
207
- grpc_call_next_op(elem, absl::exchange(send_message_batch_, nullptr));
206
+ grpc_call_next_op(elem, std::exchange(send_message_batch_, nullptr));
208
207
  }
209
208
 
210
209
  void CallData::FailSendMessageBatchInCallCombiner(void* calld_arg,
@@ -227,7 +226,6 @@ void CallData::ForwardSendMessageBatch(void* elem_arg,
227
226
 
228
227
  void CallData::CompressStartTransportStreamOpBatch(
229
228
  grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
230
- GPR_TIMER_SCOPE("compress_start_transport_stream_op_batch", 0);
231
229
  // Handle cancel_stream.
232
230
  if (batch->cancel_stream) {
233
231
  GRPC_ERROR_UNREF(cancel_error_);
@@ -40,7 +40,6 @@
40
40
  #include "src/core/lib/iomgr/call_combiner.h"
41
41
  #include "src/core/lib/iomgr/closure.h"
42
42
  #include "src/core/lib/iomgr/error.h"
43
- #include "src/core/lib/profiling/timers.h"
44
43
  #include "src/core/lib/slice/slice_buffer.h"
45
44
  #include "src/core/lib/transport/metadata_batch.h"
46
45
  #include "src/core/lib/transport/transport.h"
@@ -274,7 +273,6 @@ void CallData::DecompressStartTransportStreamOpBatch(
274
273
 
275
274
  void DecompressStartTransportStreamOpBatch(
276
275
  grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
277
- GPR_TIMER_SCOPE("decompress_start_transport_stream_op_batch", 0);
278
276
  CallData* calld = static_cast<CallData*>(elem->call_data);
279
277
  calld->DecompressStartTransportStreamOpBatch(elem, batch);
280
278
  }
@@ -26,7 +26,6 @@
26
26
  #include "absl/base/attributes.h"
27
27
  #include "absl/status/status.h"
28
28
  #include "absl/types/optional.h"
29
- #include "absl/utility/utility.h"
30
29
 
31
30
  #include <grpc/impl/codegen/grpc_types.h>
32
31
 
@@ -130,7 +129,7 @@ ArenaPromise<ServerMetadataHandle> HttpServerFilter::MakeCallPromise(
130
129
 
131
130
  auto* read_latch = GetContext<Arena>()->New<Latch<ServerMetadata*>>();
132
131
  auto* write_latch =
133
- absl::exchange(call_args.server_initial_metadata, read_latch);
132
+ std::exchange(call_args.server_initial_metadata, read_latch);
134
133
 
135
134
  return CallPushPull(Seq(next_promise_factory(std::move(call_args)),
136
135
  [](ServerMetadataHandle md) -> ServerMetadataHandle {
@@ -22,7 +22,6 @@
22
22
 
23
23
  #include <stdint.h>
24
24
 
25
- #include <memory>
26
25
  #include <string>
27
26
  #include <utility>
28
27
 
@@ -50,6 +49,7 @@
50
49
  #include "src/core/lib/channel/channelz.h"
51
50
  #include "src/core/lib/config/core_configuration.h"
52
51
  #include "src/core/lib/debug/trace.h"
52
+ #include "src/core/lib/event_engine/channel_args_endpoint_config.h"
53
53
  #include "src/core/lib/gprpp/debug_location.h"
54
54
  #include "src/core/lib/gprpp/orphanable.h"
55
55
  #include "src/core/lib/gprpp/unique_type_name.h"
@@ -289,17 +289,20 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
289
289
  "security connector already present in channel args.");
290
290
  }
291
291
  // Find the authority to use in the security connector.
292
- std::string authority =
293
- args.GetOwnedString(GRPC_ARG_DEFAULT_AUTHORITY).value();
292
+ absl::optional<std::string> authority =
293
+ args.GetOwnedString(GRPC_ARG_DEFAULT_AUTHORITY);
294
+ if (!authority.has_value()) {
295
+ return absl::InternalError("authority not present in channel args");
296
+ }
294
297
  // Create the security connector using the credentials and target name.
295
298
  RefCountedPtr<grpc_channel_security_connector>
296
299
  subchannel_security_connector =
297
300
  channel_credentials->create_security_connector(
298
- /*call_creds=*/nullptr, authority.c_str(), &args);
301
+ /*call_creds=*/nullptr, authority->c_str(), &args);
299
302
  if (subchannel_security_connector == nullptr) {
300
303
  return absl::InternalError(absl::StrFormat(
301
304
  "Failed to create secure subchannel for secure name '%s'",
302
- authority));
305
+ *authority));
303
306
  }
304
307
  return args.SetObject(std::move(subchannel_security_connector));
305
308
  }
@@ -398,12 +401,13 @@ grpc_channel* grpc_channel_create_from_fd(const char* target, int fd,
398
401
  .PreconditionChannelArgs(args)
399
402
  .SetIfUnset(GRPC_ARG_DEFAULT_AUTHORITY, "test.authority")
400
403
  .SetObject(creds->Ref());
401
- auto c_final_args = final_args.ToC();
402
404
 
403
405
  int flags = fcntl(fd, F_GETFL, 0);
404
406
  GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0);
405
- grpc_endpoint* client = grpc_tcp_client_create_from_fd(
406
- grpc_fd_create(fd, "client", true), c_final_args.get(), "fd-client");
407
+ grpc_endpoint* client = grpc_tcp_create_from_fd(
408
+ grpc_fd_create(fd, "client", true),
409
+ grpc_event_engine::experimental::ChannelArgsEndpointConfig(final_args),
410
+ "fd-client");
407
411
  grpc_transport* transport =
408
412
  grpc_create_chttp2_transport(final_args, client, true);
409
413
  GPR_ASSERT(transport);
@@ -54,6 +54,7 @@
54
54
  #include "src/core/lib/channel/channelz.h"
55
55
  #include "src/core/lib/config/core_configuration.h"
56
56
  #include "src/core/lib/debug/trace.h"
57
+ #include "src/core/lib/event_engine/channel_args_endpoint_config.h"
57
58
  #include "src/core/lib/gprpp/debug_location.h"
58
59
  #include "src/core/lib/gprpp/orphanable.h"
59
60
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
@@ -63,7 +64,6 @@
63
64
  #include "src/core/lib/iomgr/closure.h"
64
65
  #include "src/core/lib/iomgr/endpoint.h"
65
66
  #include "src/core/lib/iomgr/iomgr_fwd.h"
66
- #include "src/core/lib/iomgr/pollset.h"
67
67
  #include "src/core/lib/iomgr/pollset_set.h"
68
68
  #include "src/core/lib/iomgr/resolve_address.h"
69
69
  #include "src/core/lib/iomgr/resolved_address.h"
@@ -88,7 +88,7 @@
88
88
  #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
89
89
  #include "src/core/lib/iomgr/ev_posix.h"
90
90
  #include "src/core/lib/iomgr/exec_ctx.h"
91
- #include "src/core/lib/iomgr/tcp_posix.h"
91
+ #include "src/core/lib/iomgr/tcp_client_posix.h"
92
92
  #endif // GPR_SUPPORT_CHANNELS_FROM_FD
93
93
 
94
94
  namespace grpc_core {
@@ -156,7 +156,8 @@ class Chttp2ServerListener : public Server::ListenerInterface {
156
156
 
157
157
  void Start(grpc_endpoint* endpoint, const ChannelArgs& args);
158
158
 
159
- // Needed to be able to grab an external ref in ActiveConnection::Start()
159
+ // Needed to be able to grab an external ref in
160
+ // ActiveConnection::Start()
160
161
  using InternallyRefCounted<HandshakingState>::Ref;
161
162
 
162
163
  private:
@@ -201,8 +202,8 @@ class Chttp2ServerListener : public Server::ListenerInterface {
201
202
  // Set by HandshakingState before the handshaking begins and reset when
202
203
  // handshaking is done.
203
204
  OrphanablePtr<HandshakingState> handshaking_state_ ABSL_GUARDED_BY(&mu_);
204
- // Set by HandshakingState when handshaking is done and a valid transport is
205
- // created.
205
+ // Set by HandshakingState when handshaking is done and a valid transport
206
+ // is created.
206
207
  grpc_chttp2_transport* transport_ ABSL_GUARDED_BY(&mu_) = nullptr;
207
208
  grpc_closure on_close_;
208
209
  grpc_timer drain_grace_timer_;
@@ -228,11 +229,11 @@ class Chttp2ServerListener : public Server::ListenerInterface {
228
229
  grpc_closure* destroy_done);
229
230
 
230
231
  // The interface required by RefCountedPtr<> has been manually implemented
231
- // here to take a ref on tcp_server_ instead. Note that, the handshaker needs
232
- // tcp_server_ to exist for the lifetime of the handshake since it's needed by
233
- // acceptor. Sharing refs between the listener and tcp_server_ is just an
234
- // optimization to avoid taking additional refs on the listener, since
235
- // TcpServerShutdownComplete already holds a ref to the listener.
232
+ // here to take a ref on tcp_server_ instead. Note that, the handshaker
233
+ // needs tcp_server_ to exist for the lifetime of the handshake since it's
234
+ // needed by acceptor. Sharing refs between the listener and tcp_server_ is
235
+ // just an optimization to avoid taking additional refs on the listener,
236
+ // since TcpServerShutdownComplete already holds a ref to the listener.
236
237
  void IncrementRefCount() { grpc_tcp_server_ref(tcp_server_); }
237
238
  void IncrementRefCount(const DebugLocation& /* location */,
238
239
  const char* /* reason */) {
@@ -345,8 +346,8 @@ void Chttp2ServerListener::ConfigFetcherWatcher::StopServing() {
345
346
  listener_->is_serving_ = false;
346
347
  connections = std::move(listener_->connections_);
347
348
  }
348
- // Send GOAWAYs on the transports so that they disconnected when existing RPCs
349
- // finish.
349
+ // Send GOAWAYs on the transports so that they disconnected when existing
350
+ // RPCs finish.
350
351
  for (auto& connection : connections) {
351
352
  connection.first->SendGoAway();
352
353
  }
@@ -357,7 +358,7 @@ void Chttp2ServerListener::ConfigFetcherWatcher::StopServing() {
357
358
  //
358
359
 
359
360
  Timestamp GetConnectionDeadline(const ChannelArgs& args) {
360
- return ExecCtx::Get()->Now() +
361
+ return Timestamp::Now() +
361
362
  std::max(
362
363
  Duration::Milliseconds(1),
363
364
  args.GetDurationFromIntMillis(GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS)
@@ -487,9 +488,9 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
487
488
  self->Ref().release(); // Held by OnReceiveSettings().
488
489
  GRPC_CLOSURE_INIT(&self->on_receive_settings_, OnReceiveSettings,
489
490
  self, grpc_schedule_on_exec_ctx);
490
- // If the listener has been configured with a config fetcher, we need
491
- // to watch on the transport being closed so that we can an updated
492
- // list of active connections.
491
+ // If the listener has been configured with a config fetcher, we
492
+ // need to watch on the transport being closed so that we can an
493
+ // updated list of active connections.
493
494
  grpc_closure* on_close = nullptr;
494
495
  if (self->connection_->listener_->config_fetcher_watcher_ !=
495
496
  nullptr) {
@@ -586,7 +587,7 @@ void Chttp2ServerListener::ActiveConnection::SendGoAway() {
586
587
  this, nullptr);
587
588
  grpc_timer_init(
588
589
  &drain_grace_timer_,
589
- ExecCtx::Get()->Now() +
590
+ Timestamp::Now() +
590
591
  std::max(
591
592
  Duration::Zero(),
592
593
  listener_->args_
@@ -628,8 +629,8 @@ void Chttp2ServerListener::ActiveConnection::OnClose(
628
629
  {
629
630
  MutexLock listener_lock(&self->listener_->mu_);
630
631
  MutexLock connection_lock(&self->mu_);
631
- // The node was already deleted from the connections_ list if the connection
632
- // is shutdown.
632
+ // The node was already deleted from the connections_ list if the
633
+ // connection is shutdown.
633
634
  if (!self->shutdown_) {
634
635
  auto it = self->listener_->connections_.find(self);
635
636
  if (it != self->listener_->connections_.end()) {
@@ -679,8 +680,10 @@ grpc_error_handle Chttp2ServerListener::Create(
679
680
  grpc_error_handle error = GRPC_ERROR_NONE;
680
681
  // Create Chttp2ServerListener.
681
682
  listener = new Chttp2ServerListener(server, args, args_modifier);
682
- error = grpc_tcp_server_create(&listener->tcp_server_shutdown_complete_,
683
- args.ToC().get(), &listener->tcp_server_);
683
+ error = grpc_tcp_server_create(
684
+ &listener->tcp_server_shutdown_complete_,
685
+ grpc_event_engine::experimental::ChannelArgsEndpointConfig(args),
686
+ &listener->tcp_server_);
684
687
  if (!GRPC_ERROR_IS_NONE(error)) return error;
685
688
  if (server->config_fetcher() != nullptr) {
686
689
  listener->resolved_address_ = *addr;
@@ -725,9 +728,10 @@ grpc_error_handle Chttp2ServerListener::CreateWithAcceptor(
725
728
  Chttp2ServerArgsModifier args_modifier) {
726
729
  Chttp2ServerListener* listener =
727
730
  new Chttp2ServerListener(server, args, args_modifier);
728
- grpc_error_handle error =
729
- grpc_tcp_server_create(&listener->tcp_server_shutdown_complete_,
730
- args.ToC().get(), &listener->tcp_server_);
731
+ grpc_error_handle error = grpc_tcp_server_create(
732
+ &listener->tcp_server_shutdown_complete_,
733
+ grpc_event_engine::experimental::ChannelArgsEndpointConfig(args),
734
+ &listener->tcp_server_);
731
735
  if (!GRPC_ERROR_IS_NONE(error)) {
732
736
  delete listener;
733
737
  return error;
@@ -1073,8 +1077,10 @@ void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
1073
1077
  std::string name = absl::StrCat("fd:", fd);
1074
1078
  auto memory_quota =
1075
1079
  server_args.GetObject<grpc_core::ResourceQuota>()->memory_quota();
1076
- grpc_endpoint* server_endpoint = grpc_tcp_create(
1077
- grpc_fd_create(fd, name.c_str(), true), server_args.ToC().get(), name);
1080
+ grpc_endpoint* server_endpoint = grpc_tcp_create_from_fd(
1081
+ grpc_fd_create(fd, name.c_str(), true),
1082
+ grpc_event_engine::experimental::ChannelArgsEndpointConfig(server_args),
1083
+ name);
1078
1084
  grpc_transport* transport = grpc_create_chttp2_transport(
1079
1085
  server_args, server_endpoint, false /* is_client */
1080
1086
  );
@@ -98,7 +98,7 @@ grpc_slice grpc_chttp2_huffman_compress(const grpc_slice& input) {
98
98
  const uint8_t* in;
99
99
  uint8_t* out;
100
100
  grpc_slice output;
101
- uint32_t temp = 0;
101
+ uint64_t temp = 0;
102
102
  uint32_t temp_length = 0;
103
103
 
104
104
  nbits = 0;