grpc 1.55.0 → 1.56.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +102 -68
  3. data/include/grpc/event_engine/event_engine.h +4 -3
  4. data/include/grpc/grpc_audit_logging.h +96 -0
  5. data/include/grpc/grpc_security.h +19 -0
  6. data/include/grpc/module.modulemap +2 -0
  7. data/include/grpc/support/json.h +218 -0
  8. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +5 -0
  9. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -0
  10. data/src/core/ext/filters/client_channel/channel_connectivity.cc +4 -4
  11. data/src/core/ext/filters/client_channel/client_channel.cc +86 -104
  12. data/src/core/ext/filters/client_channel/client_channel.h +6 -0
  13. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +19 -18
  14. data/src/core/ext/filters/client_channel/client_channel_internal.h +16 -21
  15. data/src/core/ext/filters/client_channel/config_selector.h +9 -24
  16. data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -0
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +5 -4
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +455 -0
  19. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +54 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +186 -0
  21. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +2 -7
  22. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +53 -21
  23. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +23 -2
  24. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -6
  25. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +1 -9
  26. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +16 -7
  27. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +18 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +12 -9
  29. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -4
  30. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +36 -13
  31. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +76 -6
  32. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +42 -40
  33. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +4 -10
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +52 -47
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +1 -9
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +14 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +40 -43
  38. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +7 -12
  39. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -19
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +35 -33
  41. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +29 -4
  42. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/service_config_helper.cc +1 -1
  43. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +28 -27
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +163 -46
  45. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +16 -1
  46. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -0
  47. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +10 -40
  48. data/src/core/ext/filters/client_channel/subchannel.cc +10 -196
  49. data/src/core/ext/filters/client_channel/subchannel.h +3 -43
  50. data/src/core/ext/filters/http/message_compress/compression_filter.cc +5 -5
  51. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +100 -6
  52. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -8
  53. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -3
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +16 -1
  55. data/src/core/ext/transport/chttp2/transport/flow_control.cc +46 -95
  56. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +176 -0
  57. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +325 -0
  58. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +567 -543
  59. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +150 -9
  60. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +46 -32
  61. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +18 -5
  62. data/src/core/ext/transport/chttp2/transport/internal.h +1 -15
  63. data/src/core/ext/transport/chttp2/transport/parsing.cc +12 -12
  64. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +11 -2
  65. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +15 -0
  66. data/src/core/ext/xds/certificate_provider_store.cc +4 -9
  67. data/src/core/ext/xds/certificate_provider_store.h +1 -1
  68. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +30 -42
  69. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +14 -9
  70. data/src/core/ext/xds/xds_api.cc +9 -6
  71. data/src/core/ext/xds/xds_api.h +3 -2
  72. data/src/core/ext/xds/xds_audit_logger_registry.cc +122 -0
  73. data/src/core/ext/xds/xds_audit_logger_registry.h +68 -0
  74. data/src/core/ext/xds/xds_bootstrap_grpc.cc +21 -9
  75. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -0
  76. data/src/core/ext/xds/xds_client.cc +5 -4
  77. data/src/core/ext/xds/xds_client_stats.h +1 -1
  78. data/src/core/ext/xds/xds_cluster.cc +20 -19
  79. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +11 -8
  80. data/src/core/ext/xds/xds_common_types.cc +3 -1
  81. data/src/core/ext/xds/xds_http_fault_filter.cc +16 -13
  82. data/src/core/ext/xds/xds_http_fault_filter.h +2 -1
  83. data/src/core/ext/xds/xds_http_filters.h +4 -2
  84. data/src/core/ext/xds/xds_http_rbac_filter.cc +154 -67
  85. data/src/core/ext/xds/xds_http_rbac_filter.h +2 -1
  86. data/src/core/ext/xds/xds_http_stateful_session_filter.cc +15 -11
  87. data/src/core/ext/xds/xds_http_stateful_session_filter.h +2 -1
  88. data/src/core/ext/xds/xds_lb_policy_registry.cc +22 -16
  89. data/src/core/ext/xds/xds_listener.cc +1 -0
  90. data/src/core/ext/xds/xds_route_config.cc +40 -3
  91. data/src/core/ext/xds/xds_routing.cc +2 -2
  92. data/src/core/ext/xds/xds_transport_grpc.cc +3 -1
  93. data/src/core/lib/avl/avl.h +5 -0
  94. data/src/core/lib/backoff/random_early_detection.h +5 -0
  95. data/src/core/lib/channel/channel_args.cc +80 -22
  96. data/src/core/lib/channel/channel_args.h +34 -1
  97. data/src/core/lib/channel/channel_trace.cc +16 -12
  98. data/src/core/lib/channel/channelz.cc +159 -132
  99. data/src/core/lib/channel/channelz.h +42 -35
  100. data/src/core/lib/channel/channelz_registry.cc +23 -20
  101. data/src/core/lib/channel/connected_channel.cc +17 -6
  102. data/src/core/lib/channel/promise_based_filter.cc +0 -4
  103. data/src/core/lib/channel/promise_based_filter.h +2 -0
  104. data/src/core/lib/compression/compression_internal.cc +2 -5
  105. data/src/core/lib/config/config_vars.cc +20 -18
  106. data/src/core/lib/config/config_vars.h +4 -4
  107. data/src/core/lib/config/load_config.cc +13 -0
  108. data/src/core/lib/config/load_config.h +6 -0
  109. data/src/core/lib/debug/event_log.h +1 -1
  110. data/src/core/lib/debug/stats_data.h +1 -1
  111. data/src/core/lib/debug/trace.cc +24 -55
  112. data/src/core/lib/debug/trace.h +3 -1
  113. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +211 -0
  114. data/src/core/lib/event_engine/cf_engine/cf_engine.h +86 -0
  115. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +354 -0
  116. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +146 -0
  117. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +79 -0
  118. data/src/core/lib/event_engine/default_event_engine.cc +13 -1
  119. data/src/core/lib/event_engine/default_event_engine_factory.cc +14 -2
  120. data/src/core/lib/event_engine/poller.h +2 -2
  121. data/src/core/lib/event_engine/posix.h +4 -0
  122. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -1
  123. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +7 -18
  124. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +9 -0
  125. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +33 -19
  126. data/src/core/lib/event_engine/posix_engine/posix_engine.h +2 -1
  127. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +33 -4
  128. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +10 -8
  129. data/src/core/lib/event_engine/posix_engine/timer_manager.h +1 -1
  130. data/src/core/lib/event_engine/shim.cc +7 -1
  131. data/src/core/lib/event_engine/{thread_pool.cc → thread_pool/original_thread_pool.cc} +28 -25
  132. data/src/core/lib/event_engine/{thread_pool.h → thread_pool/original_thread_pool.h} +11 -15
  133. data/src/core/lib/event_engine/thread_pool/thread_pool.h +50 -0
  134. data/src/core/lib/event_engine/{executor/executor.h → thread_pool/thread_pool_factory.cc} +17 -15
  135. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +489 -0
  136. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +249 -0
  137. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +166 -0
  138. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +108 -0
  139. data/src/core/lib/event_engine/windows/iocp.cc +4 -3
  140. data/src/core/lib/event_engine/windows/iocp.h +3 -3
  141. data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
  142. data/src/core/lib/event_engine/windows/win_socket.h +4 -4
  143. data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -10
  144. data/src/core/lib/event_engine/windows/windows_endpoint.h +3 -2
  145. data/src/core/lib/event_engine/windows/windows_engine.cc +19 -17
  146. data/src/core/lib/event_engine/windows/windows_engine.h +6 -6
  147. data/src/core/lib/event_engine/windows/windows_listener.cc +3 -3
  148. data/src/core/lib/event_engine/windows/windows_listener.h +3 -2
  149. data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +63 -0
  150. data/src/core/lib/event_engine/work_queue/basic_work_queue.h +71 -0
  151. data/src/core/lib/event_engine/work_queue/work_queue.h +62 -0
  152. data/src/core/lib/experiments/config.cc +38 -7
  153. data/src/core/lib/experiments/config.h +16 -0
  154. data/src/core/lib/experiments/experiments.cc +67 -20
  155. data/src/core/lib/experiments/experiments.h +27 -21
  156. data/src/core/lib/gpr/log_internal.h +55 -0
  157. data/src/core/lib/gprpp/crash.cc +10 -0
  158. data/src/core/lib/gprpp/crash.h +3 -0
  159. data/src/core/lib/gprpp/per_cpu.cc +33 -0
  160. data/src/core/lib/gprpp/per_cpu.h +29 -6
  161. data/src/core/lib/gprpp/time.cc +1 -0
  162. data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
  163. data/src/core/lib/iomgr/endpoint_cfstream.cc +10 -8
  164. data/src/core/lib/iomgr/ev_apple.cc +12 -12
  165. data/src/core/lib/iomgr/ev_epoll1_linux.cc +10 -3
  166. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +15 -1
  167. data/src/core/lib/iomgr/iocp_windows.cc +24 -3
  168. data/src/core/lib/iomgr/iocp_windows.h +11 -0
  169. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +1 -1
  170. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -2
  171. data/src/core/lib/iomgr/socket_windows.cc +61 -7
  172. data/src/core/lib/iomgr/socket_windows.h +9 -2
  173. data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -3
  174. data/src/core/lib/iomgr/tcp_server_posix.cc +182 -119
  175. data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -1
  176. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +21 -0
  177. data/src/core/lib/iomgr/tcp_server_windows.cc +1 -1
  178. data/src/core/lib/json/json.h +2 -166
  179. data/src/core/lib/json/json_object_loader.cc +8 -9
  180. data/src/core/lib/json/json_object_loader.h +25 -18
  181. data/src/core/lib/json/json_reader.cc +13 -6
  182. data/src/core/lib/json/json_util.cc +6 -11
  183. data/src/core/lib/json/json_writer.cc +7 -8
  184. data/src/core/lib/load_balancing/lb_policy.h +13 -0
  185. data/src/core/lib/load_balancing/lb_policy_registry.cc +2 -1
  186. data/src/core/lib/matchers/matchers.cc +3 -4
  187. data/src/core/lib/matchers/matchers.h +2 -1
  188. data/src/core/lib/promise/activity.cc +5 -0
  189. data/src/core/lib/promise/activity.h +10 -0
  190. data/src/core/lib/promise/detail/promise_factory.h +1 -1
  191. data/src/core/lib/promise/party.cc +31 -13
  192. data/src/core/lib/promise/party.h +11 -2
  193. data/src/core/lib/promise/pipe.h +9 -2
  194. data/src/core/lib/promise/prioritized_race.h +95 -0
  195. data/src/core/lib/promise/sleep.cc +2 -1
  196. data/src/core/lib/resolver/server_address.cc +0 -8
  197. data/src/core/lib/resolver/server_address.h +0 -6
  198. data/src/core/lib/resource_quota/memory_quota.cc +7 -7
  199. data/src/core/lib/resource_quota/memory_quota.h +1 -2
  200. data/src/core/lib/security/authorization/audit_logging.cc +98 -0
  201. data/src/core/lib/security/authorization/audit_logging.h +73 -0
  202. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +47 -2
  203. data/src/core/lib/security/authorization/grpc_authorization_engine.h +18 -1
  204. data/src/core/lib/security/authorization/rbac_policy.cc +36 -4
  205. data/src/core/lib/security/authorization/rbac_policy.h +19 -2
  206. data/src/core/lib/security/authorization/stdout_logger.cc +75 -0
  207. data/src/core/lib/security/authorization/stdout_logger.h +61 -0
  208. data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +8 -4
  209. data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +8 -18
  210. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +14 -8
  211. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +19 -12
  212. data/src/core/lib/security/credentials/external/external_account_credentials.cc +4 -2
  213. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -0
  214. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
  215. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
  216. data/src/core/lib/security/credentials/jwt/json_token.cc +15 -14
  217. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -2
  218. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +1 -0
  219. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -0
  220. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +8 -0
  221. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +5 -1
  222. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -5
  223. data/src/core/lib/security/security_connector/ssl_utils.cc +2 -1
  224. data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
  225. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -1
  226. data/src/core/lib/security/util/json_util.cc +1 -0
  227. data/src/core/lib/service_config/service_config_call_data.h +49 -20
  228. data/src/core/lib/service_config/service_config_impl.cc +2 -1
  229. data/src/core/lib/surface/call.cc +38 -23
  230. data/src/core/lib/surface/completion_queue.cc +6 -2
  231. data/src/core/lib/surface/validate_metadata.cc +37 -22
  232. data/src/core/lib/surface/validate_metadata.h +13 -3
  233. data/src/core/lib/surface/version.cc +2 -2
  234. data/src/core/lib/transport/batch_builder.cc +15 -12
  235. data/src/core/lib/transport/batch_builder.h +39 -35
  236. data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -2
  237. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -0
  238. data/src/core/tsi/ssl_transport_security.cc +5 -2
  239. data/src/core/tsi/ssl_transport_security.h +13 -1
  240. data/src/ruby/ext/grpc/extconf.rb +8 -9
  241. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  242. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  243. data/src/ruby/lib/grpc/version.rb +1 -1
  244. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +9 -8
  245. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +1 -1
  246. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +3 -3
  247. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +10 -6
  248. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +7 -4
  249. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +6 -4
  250. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -1
  251. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +5 -9
  252. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +4 -2
  253. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +31 -22
  254. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +29 -26
  255. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +8 -0
  256. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +189 -13
  257. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.c +62 -0
  258. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +31 -0
  259. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +6 -4
  260. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +795 -795
  261. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -5
  262. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +4 -0
  263. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +18 -6
  264. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +15 -7
  265. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +1 -1
  266. data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa.c +1 -1
  267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +3 -0
  269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +24 -24
  270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +1 -1
  271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +7 -7
  272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +74 -74
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +1 -2
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +11 -11
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +12 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +14 -15
  277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
  278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +10 -10
  279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +23 -23
  280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +13 -13
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +2 -2
  283. data/third_party/boringssl-with-bazel/src/crypto/{hkdf → fipsmodule/hkdf}/hkdf.c +1 -1
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +2 -10
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +1 -4
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +115 -133
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +12 -14
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +57 -47
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +1 -8
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/polyval.c +27 -28
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +11 -23
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +21 -16
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.c +5 -288
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +143 -83
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +95 -183
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +71 -0
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +8 -0
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c +33 -0
  299. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +162 -6
  300. data/third_party/boringssl-with-bazel/src/crypto/internal.h +18 -0
  301. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +18 -11
  302. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +6 -13
  303. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +18 -14
  304. data/third_party/boringssl-with-bazel/src/crypto/{refcount_lock.c → refcount_no_threads.c} +3 -13
  305. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +89 -0
  306. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +77 -0
  307. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_crypt.c +568 -0
  308. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +62 -0
  309. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +218 -44
  310. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +35 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +588 -39
  312. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +27 -18
  313. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +1 -1
  314. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +17 -39
  315. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +39 -48
  316. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +0 -140
  317. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +72 -23
  318. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -14
  319. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +1 -1
  320. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
  321. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +1 -1
  322. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +33 -46
  323. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +1 -0
  324. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +3 -5
  325. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +14 -46
  326. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -26
  327. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +17 -10
  328. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +1 -1
  329. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +5 -7
  330. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +6 -4
  331. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +32 -1
  332. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +0 -4
  333. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -4
  334. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +3 -3
  335. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +28 -0
  336. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +2 -11
  337. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -3
  338. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +91 -1
  339. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +5 -0
  340. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +149 -20
  341. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +4 -0
  342. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +4 -0
  343. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +8 -0
  344. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +774 -615
  345. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +42 -10
  346. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +11 -6
  347. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +2 -4
  348. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +24 -16
  349. data/third_party/boringssl-with-bazel/src/ssl/internal.h +65 -18
  350. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +37 -18
  351. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +187 -193
  352. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +13 -129
  353. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +85 -10
  354. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +17 -4
  355. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +27 -19
  356. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +1 -1
  357. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +5 -21
  358. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -2
  359. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_msvc.h +1281 -0
  360. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64_msvc.h +2002 -0
  361. data/third_party/cares/cares/include/ares.h +23 -1
  362. data/third_party/cares/cares/{src/lib → include}/ares_nameser.h +9 -7
  363. data/third_party/cares/cares/include/ares_rules.h +2 -2
  364. data/third_party/cares/cares/include/ares_version.h +3 -3
  365. data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +266 -0
  366. data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +240 -0
  367. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +49 -80
  368. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +37 -43
  369. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +12 -4
  370. data/third_party/cares/cares/src/lib/ares_data.c +16 -0
  371. data/third_party/cares/cares/src/lib/ares_data.h +7 -0
  372. data/third_party/cares/cares/src/lib/ares_destroy.c +8 -0
  373. data/third_party/cares/cares/src/lib/ares_expand_name.c +17 -6
  374. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +1 -0
  375. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +156 -78
  376. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +130 -326
  377. data/third_party/cares/cares/src/lib/ares_init.c +97 -485
  378. data/third_party/cares/cares/src/lib/ares_library_init.c +2 -89
  379. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +23 -142
  380. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +22 -142
  381. data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +184 -0
  382. data/third_party/cares/cares/src/lib/ares_private.h +30 -16
  383. data/third_party/cares/cares/src/lib/ares_process.c +55 -16
  384. data/third_party/cares/cares/src/lib/ares_query.c +1 -35
  385. data/third_party/cares/cares/src/lib/ares_rand.c +279 -0
  386. data/third_party/cares/cares/src/lib/ares_send.c +5 -7
  387. data/third_party/cares/cares/src/lib/ares_strdup.c +12 -19
  388. data/third_party/cares/cares/src/lib/ares_strsplit.c +44 -128
  389. data/third_party/cares/cares/src/lib/ares_strsplit.h +9 -10
  390. data/third_party/cares/cares/src/lib/inet_net_pton.c +78 -116
  391. data/third_party/cares/cares/src/tools/ares_getopt.h +53 -0
  392. metadata +50 -12
  393. data/src/core/ext/filters/client_channel/health/health_check_client.cc +0 -175
  394. data/src/core/ext/filters/client_channel/health/health_check_client.h +0 -43
  395. data/third_party/cares/cares/src/lib/ares_library_init.h +0 -43
@@ -0,0 +1,218 @@
1
+ //
2
+ // Copyright 2015 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+
17
+ #ifndef GRPC_SUPPORT_JSON_H
18
+ #define GRPC_SUPPORT_JSON_H
19
+
20
+ #include <grpc/support/port_platform.h>
21
+
22
+ #include <stdint.h>
23
+
24
+ #include <map>
25
+ #include <string>
26
+ #include <utility>
27
+ #include <vector>
28
+
29
+ #include "absl/strings/str_cat.h"
30
+ #include "absl/types/variant.h"
31
+
32
+ namespace grpc_core {
33
+ namespace experimental {
34
+
35
+ // A JSON value, which can be any one of null, boolean, number, string,
36
+ // object, or array.
37
+ class Json {
38
+ public:
39
+ // The JSON type.
40
+ enum class Type {
41
+ kNull, // No payload. Default type when using the zero-arg ctor.
42
+ kBoolean, // Use boolean() for payload.
43
+ kNumber, // Numbers are stored in string form to avoid precision
44
+ // and integer capacity issues. Use string() for payload.
45
+ kString, // Use string() for payload.
46
+ kObject, // Use object() for payload.
47
+ kArray, // Use array() for payload.
48
+ };
49
+
50
+ using Object = std::map<std::string, Json>;
51
+ using Array = std::vector<Json>;
52
+
53
+ // Factory method for kBoolean.
54
+ static Json FromBool(bool b) {
55
+ Json json;
56
+ json.value_ = b;
57
+ return json;
58
+ }
59
+
60
+ // Factory methods for kNumber.
61
+ static Json FromNumber(const std::string& str) {
62
+ Json json;
63
+ json.value_ = NumberValue{str};
64
+ return json;
65
+ }
66
+ static Json FromNumber(const char* str) {
67
+ Json json;
68
+ json.value_ = NumberValue{std::string(str)};
69
+ return json;
70
+ }
71
+ static Json FromNumber(std::string&& str) {
72
+ Json json;
73
+ json.value_ = NumberValue{std::move(str)};
74
+ return json;
75
+ }
76
+ static Json FromNumber(int32_t value) {
77
+ Json json;
78
+ json.value_ = NumberValue{absl::StrCat(value)};
79
+ return json;
80
+ }
81
+ static Json FromNumber(uint32_t value) {
82
+ Json json;
83
+ json.value_ = NumberValue{absl::StrCat(value)};
84
+ return json;
85
+ }
86
+ static Json FromNumber(int64_t value) {
87
+ Json json;
88
+ json.value_ = NumberValue{absl::StrCat(value)};
89
+ return json;
90
+ }
91
+ static Json FromNumber(uint64_t value) {
92
+ Json json;
93
+ json.value_ = NumberValue{absl::StrCat(value)};
94
+ return json;
95
+ }
96
+ static Json FromNumber(double value) {
97
+ Json json;
98
+ json.value_ = NumberValue{absl::StrCat(value)};
99
+ return json;
100
+ }
101
+
102
+ // Factory methods for kString.
103
+ static Json FromString(const std::string& str) {
104
+ Json json;
105
+ json.value_ = str;
106
+ return json;
107
+ }
108
+ static Json FromString(const char* str) {
109
+ Json json;
110
+ json.value_ = std::string(str);
111
+ return json;
112
+ }
113
+ static Json FromString(std::string&& str) {
114
+ Json json;
115
+ json.value_ = std::move(str);
116
+ return json;
117
+ }
118
+
119
+ // Factory methods for kObject.
120
+ static Json FromObject(const Object& object) {
121
+ Json json;
122
+ json.value_ = object;
123
+ return json;
124
+ }
125
+ static Json FromObject(Object&& object) {
126
+ Json json;
127
+ json.value_ = std::move(object);
128
+ return json;
129
+ }
130
+
131
+ // Factory methods for kArray.
132
+ static Json FromArray(const Array& array) {
133
+ Json json;
134
+ json.value_ = array;
135
+ return json;
136
+ }
137
+ static Json FromArray(Array&& array) {
138
+ Json json;
139
+ json.value_ = std::move(array);
140
+ return json;
141
+ }
142
+
143
+ Json() = default;
144
+
145
+ // Copyable.
146
+ Json(const Json& other) = default;
147
+ Json& operator=(const Json& other) = default;
148
+
149
+ // Moveable.
150
+ Json(Json&& other) noexcept : value_(std::move(other.value_)) {
151
+ other.value_ = absl::monostate();
152
+ }
153
+ Json& operator=(Json&& other) noexcept {
154
+ value_ = std::move(other.value_);
155
+ other.value_ = absl::monostate();
156
+ return *this;
157
+ }
158
+
159
+ // Returns the JSON type.
160
+ Type type() const {
161
+ struct ValueFunctor {
162
+ Json::Type operator()(const absl::monostate&) { return Type::kNull; }
163
+ Json::Type operator()(bool) { return Type::kBoolean; }
164
+ Json::Type operator()(const NumberValue&) { return Type::kNumber; }
165
+ Json::Type operator()(const std::string&) { return Type::kString; }
166
+ Json::Type operator()(const Object&) { return Type::kObject; }
167
+ Json::Type operator()(const Array&) { return Type::kArray; }
168
+ };
169
+ return absl::visit(ValueFunctor(), value_);
170
+ }
171
+
172
+ // Payload accessor for kBoolean.
173
+ // Must not be called for other types.
174
+ bool boolean() const { return absl::get<bool>(value_); }
175
+
176
+ // Payload accessor for kNumber or kString.
177
+ // Must not be called for other types.
178
+ const std::string& string() const {
179
+ const NumberValue* num = absl::get_if<NumberValue>(&value_);
180
+ if (num != nullptr) return num->value;
181
+ return absl::get<std::string>(value_);
182
+ }
183
+
184
+ // Payload accessor for kObject.
185
+ // Must not be called for other types.
186
+ const Object& object() const { return absl::get<Object>(value_); }
187
+
188
+ // Payload accessor for kArray.
189
+ // Must not be called for other types.
190
+ const Array& array() const { return absl::get<Array>(value_); }
191
+
192
+ bool operator==(const Json& other) const { return value_ == other.value_; }
193
+ bool operator!=(const Json& other) const { return !(*this == other); }
194
+
195
+ private:
196
+ struct NumberValue {
197
+ std::string value;
198
+
199
+ bool operator==(const NumberValue& other) const {
200
+ return value == other.value;
201
+ }
202
+ };
203
+ using Value = absl::variant<absl::monostate, // kNull
204
+ bool, // kBoolean
205
+ NumberValue, // kNumber
206
+ std::string, // kString
207
+ Object, // kObject
208
+ Array>; // kArray
209
+
210
+ explicit Json(Value value) : value_(std::move(value)) {}
211
+
212
+ Value value_;
213
+ };
214
+
215
+ } // namespace experimental
216
+ } // namespace grpc_core
217
+
218
+ #endif // GRPC_SUPPORT_JSON_H
@@ -67,6 +67,11 @@ absl::optional<std::string> BackendMetricFilter::MaybeSerializeBackendMetrics(
67
67
  data.mem_utilization);
68
68
  has_data = true;
69
69
  }
70
+ if (data.application_utilization != -1) {
71
+ xds_data_orca_v3_OrcaLoadReport_set_application_utilization(
72
+ response, data.application_utilization);
73
+ has_data = true;
74
+ }
70
75
  if (data.qps != -1) {
71
76
  xds_data_orca_v3_OrcaLoadReport_set_rps_fractional(response, data.qps);
72
77
  has_data = true;
@@ -69,6 +69,8 @@ const BackendMetricData* ParseBackendMetricData(
69
69
  xds_data_orca_v3_OrcaLoadReport_cpu_utilization(msg);
70
70
  backend_metric_data->mem_utilization =
71
71
  xds_data_orca_v3_OrcaLoadReport_mem_utilization(msg);
72
+ backend_metric_data->application_utilization =
73
+ xds_data_orca_v3_OrcaLoadReport_application_utilization(msg);
72
74
  backend_metric_data->qps =
73
75
  xds_data_orca_v3_OrcaLoadReport_rps_fractional(msg);
74
76
  backend_metric_data->eps = xds_data_orca_v3_OrcaLoadReport_eps(msg);
@@ -20,7 +20,6 @@
20
20
 
21
21
  #include "absl/base/thread_annotations.h"
22
22
  #include "absl/status/status.h"
23
- #include "absl/synchronization/mutex.h"
24
23
  #include "absl/types/optional.h"
25
24
 
26
25
  #include <grpc/event_engine/event_engine.h>
@@ -36,6 +35,7 @@
36
35
  #include "src/core/lib/gprpp/crash.h"
37
36
  #include "src/core/lib/gprpp/dual_ref_counted.h"
38
37
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
38
+ #include "src/core/lib/gprpp/sync.h"
39
39
  #include "src/core/lib/gprpp/time.h"
40
40
  #include "src/core/lib/iomgr/closure.h"
41
41
  #include "src/core/lib/iomgr/error.h"
@@ -169,7 +169,7 @@ class StateWatcher : public DualRefCounted<StateWatcher> {
169
169
 
170
170
  void StartTimer(Timestamp deadline) {
171
171
  const Duration timeout = deadline - Timestamp::Now();
172
- absl::MutexLock lock(&mu_);
172
+ MutexLock lock(&mu_);
173
173
  timer_handle_ = channel_->channel_stack()->EventEngine()->RunAfter(
174
174
  timeout, [self = Ref()]() mutable {
175
175
  ApplicationCallbackExecCtx callback_exec_ctx;
@@ -186,7 +186,7 @@ class StateWatcher : public DualRefCounted<StateWatcher> {
186
186
  GRPC_LOG_IF_ERROR("watch_completion_error", error);
187
187
  }
188
188
  {
189
- absl::MutexLock lock(&self->mu_);
189
+ MutexLock lock(&self->mu_);
190
190
  if (self->timer_handle_.has_value()) {
191
191
  self->channel_->channel_stack()->EventEngine()->Cancel(
192
192
  *self->timer_handle_);
@@ -238,7 +238,7 @@ class StateWatcher : public DualRefCounted<StateWatcher> {
238
238
  // timer_handle_ might be accessed in parallel from multiple threads, e.g.
239
239
  // timer callback fired immediately on an EventEngine thread before
240
240
  // RunAfter() returns.
241
- absl::Mutex mu_;
241
+ Mutex mu_;
242
242
  absl::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>
243
243
  timer_handle_ ABSL_GUARDED_BY(mu_);
244
244
  bool timer_fired_ = false;
@@ -42,6 +42,7 @@
42
42
  #include <grpc/event_engine/event_engine.h>
43
43
  #include <grpc/slice.h>
44
44
  #include <grpc/status.h>
45
+ #include <grpc/support/json.h>
45
46
  #include <grpc/support/log.h>
46
47
  #include <grpc/support/string_util.h>
47
48
  #include <grpc/support/time.h>
@@ -94,9 +95,6 @@
94
95
  // Client channel filter
95
96
  //
96
97
 
97
- #define GRPC_ARG_HEALTH_CHECK_SERVICE_NAME \
98
- "grpc.internal.health_check_service_name"
99
-
100
98
  namespace grpc_core {
101
99
 
102
100
  using internal::ClientChannelMethodParsedConfig;
@@ -479,8 +477,8 @@ class ClientChannel::ResolverResultHandler : public Resolver::ResultHandler {
479
477
  //
480
478
 
481
479
  // This class is a wrapper for Subchannel that hides details of the
482
- // channel's implementation (such as the health check service name and
483
- // connected subchannel) from the LB policy API.
480
+ // channel's implementation (such as the connected subchannel) from the
481
+ // LB policy API.
484
482
  //
485
483
  // Note that no synchronization is needed here, because even if the
486
484
  // underlying subchannel is shared between channels, this wrapper will only
@@ -488,14 +486,12 @@ class ClientChannel::ResolverResultHandler : public Resolver::ResultHandler {
488
486
  // control plane work_serializer.
489
487
  class ClientChannel::SubchannelWrapper : public SubchannelInterface {
490
488
  public:
491
- SubchannelWrapper(ClientChannel* chand, RefCountedPtr<Subchannel> subchannel,
492
- absl::optional<std::string> health_check_service_name)
489
+ SubchannelWrapper(ClientChannel* chand, RefCountedPtr<Subchannel> subchannel)
493
490
  : SubchannelInterface(GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)
494
491
  ? "SubchannelWrapper"
495
492
  : nullptr),
496
493
  chand_(chand),
497
- subchannel_(std::move(subchannel)),
498
- health_check_service_name_(std::move(health_check_service_name)) {
494
+ subchannel_(std::move(subchannel)) {
499
495
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
500
496
  gpr_log(GPR_INFO,
501
497
  "chand=%p: creating subchannel wrapper %p for subchannel %p",
@@ -548,7 +544,6 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
548
544
  watcher_wrapper = new WatcherWrapper(std::move(watcher),
549
545
  Ref(DEBUG_LOCATION, "WatcherWrapper"));
550
546
  subchannel_->WatchConnectivityState(
551
- health_check_service_name_,
552
547
  RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
553
548
  watcher_wrapper));
554
549
  }
@@ -557,8 +552,7 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
557
552
  override ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
558
553
  auto it = watcher_map_.find(watcher);
559
554
  GPR_ASSERT(it != watcher_map_.end());
560
- subchannel_->CancelConnectivityStateWatch(health_check_service_name_,
561
- it->second);
555
+ subchannel_->CancelConnectivityStateWatch(it->second);
562
556
  watcher_map_.erase(it);
563
557
  }
564
558
 
@@ -675,17 +669,13 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
675
669
  std::string(keepalive_throttling.value()).c_str());
676
670
  }
677
671
  }
678
- // Ignore update if the parent WatcherWrapper has been replaced
679
- // since this callback was scheduled.
680
- if (watcher_ != nullptr) {
681
- // Propagate status only in state TF.
682
- // We specifically want to avoid propagating the status for
683
- // state IDLE that the real subchannel gave us only for the
684
- // purpose of keepalive propagation.
685
- watcher_->OnConnectivityStateChange(
686
- state, state == GRPC_CHANNEL_TRANSIENT_FAILURE ? status
687
- : absl::OkStatus());
688
- }
672
+ // Propagate status only in state TF.
673
+ // We specifically want to avoid propagating the status for
674
+ // state IDLE that the real subchannel gave us only for the
675
+ // purpose of keepalive propagation.
676
+ watcher_->OnConnectivityStateChange(
677
+ state,
678
+ state == GRPC_CHANNEL_TRANSIENT_FAILURE ? status : absl::OkStatus());
689
679
  }
690
680
 
691
681
  std::unique_ptr<SubchannelInterface::ConnectivityStateWatcherInterface>
@@ -695,7 +685,6 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
695
685
 
696
686
  ClientChannel* chand_;
697
687
  RefCountedPtr<Subchannel> subchannel_;
698
- absl::optional<std::string> health_check_service_name_;
699
688
  // Maps from the address of the watcher passed to us by the LB policy
700
689
  // to the address of the WrapperWatcher that we passed to the underlying
701
690
  // subchannel. This is needed so that when the LB policy calls
@@ -908,13 +897,6 @@ class ClientChannel::ClientChannelControlHelper
908
897
  ServerAddress address, const ChannelArgs& args) override
909
898
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
910
899
  if (chand_->resolver_ == nullptr) return nullptr; // Shutting down.
911
- // Determine health check service name.
912
- absl::optional<std::string> health_check_service_name;
913
- if (!args.GetBool(GRPC_ARG_INHIBIT_HEALTH_CHECKING).value_or(false)) {
914
- health_check_service_name =
915
- args.GetOwnedString(GRPC_ARG_HEALTH_CHECK_SERVICE_NAME);
916
- }
917
- // Construct channel args for subchannel.
918
900
  ChannelArgs subchannel_args = ClientChannel::MakeSubchannelArgs(
919
901
  args, address.args(), chand_->subchannel_pool_,
920
902
  chand_->default_authority_);
@@ -926,8 +908,7 @@ class ClientChannel::ClientChannelControlHelper
926
908
  // Make sure the subchannel has updated keepalive time.
927
909
  subchannel->ThrottleKeepaliveTime(chand_->keepalive_time_);
928
910
  // Create and return wrapper for the subchannel.
929
- return MakeRefCounted<SubchannelWrapper>(
930
- chand_, std::move(subchannel), std::move(health_check_service_name));
911
+ return MakeRefCounted<SubchannelWrapper>(chand_, std::move(subchannel));
931
912
  }
932
913
 
933
914
  void UpdateState(grpc_connectivity_state state, const absl::Status& status,
@@ -1199,9 +1180,9 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
1199
1180
  // above.
1200
1181
  if (!policy_name.has_value()) policy_name = "pick_first";
1201
1182
  // Now that we have the policy name, construct an empty config for it.
1202
- Json config_json = Json::Array{Json::Object{
1203
- {std::string(*policy_name), Json::Object{}},
1204
- }};
1183
+ Json config_json = Json::FromArray({Json::FromObject({
1184
+ {std::string(*policy_name), Json::FromObject({})},
1185
+ })});
1205
1186
  auto lb_policy_config =
1206
1187
  CoreConfiguration::Get().lb_policy_registry().ParseLoadBalancingConfig(
1207
1188
  config_json);
@@ -1366,11 +1347,8 @@ void ClientChannel::OnResolverErrorLocked(absl::Status status) {
1366
1347
  // Otherwise, we go into TRANSIENT_FAILURE.
1367
1348
  if (lb_policy_ == nullptr) {
1368
1349
  // Update connectivity state.
1369
- // TODO(roth): We should be updating the connectivity state here but
1370
- // not the picker.
1371
- UpdateStateAndPickerLocked(
1372
- GRPC_CHANNEL_TRANSIENT_FAILURE, status, "resolver failure",
1373
- MakeRefCounted<LoadBalancingPolicy::TransientFailurePicker>(status));
1350
+ UpdateStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE, status,
1351
+ "resolver failure");
1374
1352
  {
1375
1353
  MutexLock lock(&resolution_mu_);
1376
1354
  // Update resolver transient failure.
@@ -1414,6 +1392,14 @@ absl::Status ClientChannel::CreateOrUpdateLbPolicyLocked(
1414
1392
  // Creates a new LB policy.
1415
1393
  OrphanablePtr<LoadBalancingPolicy> ClientChannel::CreateLbPolicyLocked(
1416
1394
  const ChannelArgs& args) {
1395
+ // The LB policy will start in state CONNECTING but will not
1396
+ // necessarily send us an update synchronously, so set state to
1397
+ // CONNECTING (in case the resolver had previously failed and put the
1398
+ // channel into TRANSIENT_FAILURE) and make sure we have a queueing picker.
1399
+ UpdateStateAndPickerLocked(
1400
+ GRPC_CHANNEL_CONNECTING, absl::Status(), "started resolving",
1401
+ MakeRefCounted<LoadBalancingPolicy::QueuePicker>(nullptr));
1402
+ // Now create the LB policy.
1417
1403
  LoadBalancingPolicy::Args lb_policy_args;
1418
1404
  lb_policy_args.work_serializer = work_serializer_;
1419
1405
  lb_policy_args.channel_control_helper =
@@ -1506,21 +1492,17 @@ void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
1506
1492
 
1507
1493
  void ClientChannel::CreateResolverLocked() {
1508
1494
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
1509
- gpr_log(GPR_INFO, "chand=%p: starting name resolution", this);
1495
+ gpr_log(GPR_INFO, "chand=%p: starting name resolution for %s", this,
1496
+ uri_to_resolve_.c_str());
1510
1497
  }
1511
1498
  resolver_ = CoreConfiguration::Get().resolver_registry().CreateResolver(
1512
- uri_to_resolve_.c_str(), channel_args_, interested_parties_,
1513
- work_serializer_, std::make_unique<ResolverResultHandler>(this));
1499
+ uri_to_resolve_, channel_args_, interested_parties_, work_serializer_,
1500
+ std::make_unique<ResolverResultHandler>(this));
1514
1501
  // Since the validity of the args was checked when the channel was created,
1515
1502
  // CreateResolver() must return a non-null result.
1516
1503
  GPR_ASSERT(resolver_ != nullptr);
1517
- // TODO(roth): We should be updating the connectivity state here but
1518
- // not the picker. But we need to make sure that we are initializing
1519
- // the picker to a queueing picker somewhere, in case the LB policy
1520
- // does not immediately return a new picker.
1521
- UpdateStateAndPickerLocked(
1522
- GRPC_CHANNEL_CONNECTING, absl::Status(), "started resolving",
1523
- MakeRefCounted<LoadBalancingPolicy::QueuePicker>(nullptr));
1504
+ UpdateStateLocked(GRPC_CHANNEL_CONNECTING, absl::Status(),
1505
+ "started resolving");
1524
1506
  resolver_->StartLocked();
1525
1507
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
1526
1508
  gpr_log(GPR_INFO, "chand=%p: created resolver=%p", this, resolver_.get());
@@ -1534,24 +1516,7 @@ void ClientChannel::DestroyResolverAndLbPolicyLocked() {
1534
1516
  resolver_.get());
1535
1517
  }
1536
1518
  resolver_.reset();
1537
- if (lb_policy_ != nullptr) {
1538
- if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
1539
- gpr_log(GPR_INFO, "chand=%p: shutting down lb_policy=%p", this,
1540
- lb_policy_.get());
1541
- }
1542
- grpc_pollset_set_del_pollset_set(lb_policy_->interested_parties(),
1543
- interested_parties_);
1544
- lb_policy_.reset();
1545
- }
1546
- }
1547
- }
1548
-
1549
- void ClientChannel::UpdateStateAndPickerLocked(
1550
- grpc_connectivity_state state, const absl::Status& status,
1551
- const char* reason,
1552
- RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker) {
1553
- // Special case for IDLE and SHUTDOWN states.
1554
- if (picker == nullptr || state == GRPC_CHANNEL_SHUTDOWN) {
1519
+ // Clear resolution state.
1555
1520
  saved_service_config_.reset();
1556
1521
  saved_config_selector_.reset();
1557
1522
  // Acquire resolution lock to update config selector and associated state.
@@ -1567,8 +1532,22 @@ void ClientChannel::UpdateStateAndPickerLocked(
1567
1532
  config_selector_to_unref = std::move(config_selector_);
1568
1533
  dynamic_filters_to_unref = std::move(dynamic_filters_);
1569
1534
  }
1535
+ // Clear LB policy if set.
1536
+ if (lb_policy_ != nullptr) {
1537
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_trace)) {
1538
+ gpr_log(GPR_INFO, "chand=%p: shutting down lb_policy=%p", this,
1539
+ lb_policy_.get());
1540
+ }
1541
+ grpc_pollset_set_del_pollset_set(lb_policy_->interested_parties(),
1542
+ interested_parties_);
1543
+ lb_policy_.reset();
1544
+ }
1570
1545
  }
1571
- // Update connectivity state.
1546
+ }
1547
+
1548
+ void ClientChannel::UpdateStateLocked(grpc_connectivity_state state,
1549
+ const absl::Status& status,
1550
+ const char* reason) {
1572
1551
  state_tracker_.SetState(state, status, reason);
1573
1552
  if (channelz_node_ != nullptr) {
1574
1553
  channelz_node_->SetConnectivityState(state);
@@ -1578,19 +1557,24 @@ void ClientChannel::UpdateStateAndPickerLocked(
1578
1557
  channelz::ChannelNode::GetChannelConnectivityStateChangeString(
1579
1558
  state)));
1580
1559
  }
1560
+ }
1561
+
1562
+ void ClientChannel::UpdateStateAndPickerLocked(
1563
+ grpc_connectivity_state state, const absl::Status& status,
1564
+ const char* reason,
1565
+ RefCountedPtr<LoadBalancingPolicy::SubchannelPicker> picker) {
1566
+ UpdateStateLocked(state, status, reason);
1581
1567
  // Grab the LB lock to update the picker and trigger reprocessing of the
1582
1568
  // queued picks.
1583
1569
  // Old picker will be unreffed after releasing the lock.
1584
- {
1585
- MutexLock lock(&lb_mu_);
1586
- picker_.swap(picker);
1587
- // Reprocess queued picks.
1588
- for (LoadBalancedCall* call : lb_queued_calls_) {
1589
- call->RemoveCallFromLbQueuedCallsLocked();
1590
- call->RetryPickLocked();
1591
- }
1592
- lb_queued_calls_.clear();
1570
+ MutexLock lock(&lb_mu_);
1571
+ picker_.swap(picker);
1572
+ // Reprocess queued picks.
1573
+ for (LoadBalancedCall* call : lb_queued_calls_) {
1574
+ call->RemoveCallFromLbQueuedCallsLocked();
1575
+ call->RetryPickLocked();
1593
1576
  }
1577
+ lb_queued_calls_.clear();
1594
1578
  }
1595
1579
 
1596
1580
  namespace {
@@ -1704,10 +1688,13 @@ void ClientChannel::StartTransportOpLocked(grpc_transport_op* op) {
1704
1688
  StatusIntProperty::ChannelConnectivityState,
1705
1689
  &value) &&
1706
1690
  static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
1707
- if (disconnect_error_.ok()) {
1691
+ if (disconnect_error_.ok()) { // Ignore if we're shutting down.
1708
1692
  // Enter IDLE state.
1709
1693
  UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, absl::Status(),
1710
1694
  "channel entering IDLE", nullptr);
1695
+ // TODO(roth): Do we need to check for any queued picks here, in
1696
+ // case there's a race condition in the client_idle filter?
1697
+ // And maybe also check for calls in the resolver queue?
1711
1698
  }
1712
1699
  } else {
1713
1700
  // Disconnect.
@@ -1832,23 +1819,22 @@ grpc_error_handle ClientChannel::CallData::ApplyServiceConfigToCallLocked(
1832
1819
  chand(), this);
1833
1820
  }
1834
1821
  if (!config_selector.ok()) return config_selector.status();
1835
- // Use the ConfigSelector to determine the config for the call.
1836
- auto call_config =
1837
- (*config_selector)->GetCallConfig({send_initial_metadata(), arena()});
1838
- if (!call_config.ok()) {
1839
- return absl_status_to_grpc_error(
1840
- MaybeRewriteIllegalStatusCode(call_config.status(), "ConfigSelector"));
1841
- }
1842
1822
  // Create a ClientChannelServiceConfigCallData for the call. This stores
1843
1823
  // a ref to the ServiceConfig and caches the right set of parsed configs
1844
1824
  // to use for the call. The ClientChannelServiceConfigCallData will store
1845
1825
  // itself in the call context, so that it can be accessed by filters
1846
1826
  // below us in the stack, and it will be cleaned up when the call ends.
1847
1827
  auto* service_config_call_data =
1848
- arena()->New<ClientChannelServiceConfigCallData>(
1849
- std::move(call_config->service_config), call_config->method_configs,
1850
- std::move(call_config->call_attributes),
1851
- std::move(call_config->on_commit), call_context());
1828
+ arena()->New<ClientChannelServiceConfigCallData>(arena(), call_context());
1829
+ // Use the ConfigSelector to determine the config for the call.
1830
+ absl::Status call_config_status =
1831
+ (*config_selector)
1832
+ ->GetCallConfig(
1833
+ {send_initial_metadata(), arena(), service_config_call_data});
1834
+ if (!call_config_status.ok()) {
1835
+ return absl_status_to_grpc_error(
1836
+ MaybeRewriteIllegalStatusCode(call_config_status, "ConfigSelector"));
1837
+ }
1852
1838
  // Apply our own method params to the call.
1853
1839
  auto* method_params = static_cast<ClientChannelMethodParsedConfig*>(
1854
1840
  service_config_call_data->GetMethodParsedConfig(
@@ -2355,7 +2341,8 @@ class ClientChannel::LoadBalancedCall::LbCallState
2355
2341
 
2356
2342
  // Internal API to allow first-party LB policies to access per-call
2357
2343
  // attributes set by the ConfigSelector.
2358
- absl::string_view GetCallAttribute(UniqueTypeName type) override;
2344
+ ServiceConfigCallData::CallAttributeInterface* GetCallAttribute(
2345
+ UniqueTypeName type) const override;
2359
2346
 
2360
2347
  private:
2361
2348
  LoadBalancedCall* lb_call_;
@@ -2440,15 +2427,12 @@ class ClientChannel::LoadBalancedCall::Metadata
2440
2427
  // ClientChannel::LoadBalancedCall::LbCallState
2441
2428
  //
2442
2429
 
2443
- absl::string_view
2430
+ ServiceConfigCallData::CallAttributeInterface*
2444
2431
  ClientChannel::LoadBalancedCall::LbCallState::GetCallAttribute(
2445
- UniqueTypeName type) {
2432
+ UniqueTypeName type) const {
2446
2433
  auto* service_config_call_data = static_cast<ServiceConfigCallData*>(
2447
2434
  lb_call_->call_context()[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
2448
- auto& call_attributes = service_config_call_data->call_attributes();
2449
- auto it = call_attributes.find(type);
2450
- if (it == call_attributes.end()) return absl::string_view();
2451
- return it->second;
2435
+ return service_config_call_data->GetCallAttribute(type);
2452
2436
  }
2453
2437
 
2454
2438
  //
@@ -3033,6 +3017,8 @@ void ClientChannel::FilterBasedLoadBalancedCall::RecvInitialMetadataReady(
3033
3017
  // recv_initial_metadata_flags is not populated for clients
3034
3018
  self->call_attempt_tracer()->RecordReceivedInitialMetadata(
3035
3019
  self->recv_initial_metadata_);
3020
+ auto* peer_string = self->recv_initial_metadata_->get_pointer(PeerString());
3021
+ if (peer_string != nullptr) self->peer_string_ = peer_string->Ref();
3036
3022
  }
3037
3023
  Closure::Run(DEBUG_LOCATION, self->original_recv_initial_metadata_ready_,
3038
3024
  error);
@@ -3076,12 +3062,8 @@ void ClientChannel::FilterBasedLoadBalancedCall::RecvTrailingMetadataReady(
3076
3062
  }
3077
3063
  }
3078
3064
  absl::string_view peer_string;
3079
- if (self->recv_initial_metadata_ != nullptr) {
3080
- Slice* peer_string_slice =
3081
- self->recv_initial_metadata_->get_pointer(PeerString());
3082
- if (peer_string_slice != nullptr) {
3083
- peer_string = peer_string_slice->as_string_view();
3084
- }
3065
+ if (self->peer_string_.has_value()) {
3066
+ peer_string = self->peer_string_->as_string_view();
3085
3067
  }
3086
3068
  self->RecordCallCompletion(status, self->recv_trailing_metadata_,
3087
3069
  self->transport_stream_stats_, peer_string);
@@ -65,6 +65,7 @@
65
65
  #include "src/core/lib/resolver/resolver.h"
66
66
  #include "src/core/lib/resource_quota/arena.h"
67
67
  #include "src/core/lib/service_config/service_config.h"
68
+ #include "src/core/lib/slice/slice.h"
68
69
  #include "src/core/lib/surface/channel.h"
69
70
  #include "src/core/lib/transport/connectivity_state.h"
70
71
  #include "src/core/lib/transport/metadata_batch.h"
@@ -247,6 +248,10 @@ class ClientChannel {
247
248
  OrphanablePtr<LoadBalancingPolicy> CreateLbPolicyLocked(
248
249
  const ChannelArgs& args) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_);
249
250
 
251
+ void UpdateStateLocked(grpc_connectivity_state state,
252
+ const absl::Status& status, const char* reason)
253
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(*work_serializer_);
254
+
250
255
  void UpdateStateAndPickerLocked(
251
256
  grpc_connectivity_state state, const absl::Status& status,
252
257
  const char* reason,
@@ -552,6 +557,7 @@ class ClientChannel::FilterBasedLoadBalancedCall
552
557
  CallCombiner* call_combiner_;
553
558
  grpc_polling_entity* pollent_;
554
559
  grpc_closure* on_call_destruction_complete_;
560
+ absl::optional<Slice> peer_string_;
555
561
 
556
562
  // Set when we get a cancel_stream op.
557
563
  grpc_error_handle cancel_error_;