Merge branch 'master' into tjagtap_src_core_lib

pull/36467/head
tanvi-jagtap 10 months ago
commit c34a771988
  1. 3
      BUILD
  2. 1829
      CMakeLists.txt
  3. 4
      bazel/grpc_build_system.bzl
  4. 3955
      build_autogenerated.yaml
  5. 8
      build_handwritten.yaml
  6. 2
      examples/python/observability/requirements.txt
  7. 8
      src/android/test/interop/app/CMakeLists.txt
  8. 50
      src/core/BUILD
  9. 5
      src/core/channelz/channelz.cc
  10. 6
      src/core/channelz/channelz_registry.cc
  11. 57
      src/core/client_channel/client_channel_filter.cc
  12. 3
      src/core/client_channel/client_channel_internal.h
  13. 5
      src/core/client_channel/config_selector.h
  14. 5
      src/core/client_channel/dynamic_filters.cc
  15. 5
      src/core/client_channel/http_proxy_mapper.cc
  16. 8
      src/core/client_channel/local_subchannel_pool.cc
  17. 5
      src/core/client_channel/retry_filter.h
  18. 9
      src/core/client_channel/retry_filter_legacy_call_data.cc
  19. 19
      src/core/client_channel/subchannel.cc
  20. 8
      src/core/client_channel/subchannel_stream_client.cc
  21. 33
      src/core/lib/event_engine/ares_resolver.cc
  22. 4
      src/core/lib/event_engine/cf_engine/cf_engine.cc
  23. 3
      src/core/lib/event_engine/cf_engine/dns_service_resolver.cc
  24. 3
      src/core/lib/event_engine/cf_engine/dns_service_resolver.h
  25. 10
      src/core/lib/event_engine/forkable.cc
  26. 13
      src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc
  27. 19
      src/core/lib/event_engine/posix_engine/ev_poll_posix.cc
  28. 3
      src/core/lib/event_engine/posix_engine/lockfree_event.cc
  29. 46
      src/core/lib/event_engine/posix_engine/posix_endpoint.cc
  30. 22
      src/core/lib/event_engine/posix_engine/posix_endpoint.h
  31. 17
      src/core/lib/event_engine/posix_engine/posix_engine.cc
  32. 5
      src/core/lib/event_engine/posix_engine/posix_engine_listener.cc
  33. 9
      src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc
  34. 3
      src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc
  35. 3
      src/core/lib/event_engine/posix_engine/tcp_socket_utils.h
  36. 7
      src/core/lib/event_engine/posix_engine/timer_manager.cc
  37. 6
      src/core/lib/event_engine/resolved_address.cc
  38. 4
      src/core/lib/event_engine/slice.cc
  39. 17
      src/core/lib/event_engine/tcp_socket_utils.cc
  40. 13
      src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
  41. 61
      src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc
  42. 18
      src/core/lib/event_engine/windows/iocp.cc
  43. 12
      src/core/lib/event_engine/windows/win_socket.cc
  44. 17
      src/core/lib/event_engine/windows/windows_endpoint.cc
  45. 13
      src/core/lib/event_engine/windows/windows_engine.cc
  46. 13
      src/core/lib/event_engine/windows/windows_listener.cc
  47. 3
      src/core/lib/uri/uri_parser.cc
  48. 2
      src/objective-c/tests/BUILD
  49. 2
      src/objective-c/tests/CFStreamTests/CFStreamClientTests.mm
  50. 2
      src/objective-c/tests/CFStreamTests/CFStreamEndpointTests.mm
  51. 4
      src/objective-c/tests/CronetTests/CronetUnitTests.mm
  52. 2
      src/objective-c/tests/EventEngineTests/CFEventEngineClientTests.mm
  53. 2
      src/objective-c/tests/EventEngineTests/CFEventEngineUnitTests.mm
  54. 3
      src/python/grpcio_observability/grpc_observability/BUILD.bazel
  55. 2
      src/python/grpcio_observability/setup.py
  56. 4
      src/python/grpcio_tests/tests/observability/BUILD.bazel
  57. 5
      src/python/grpcio_tests/tests/unit/test_common.py
  58. 10
      test/core/address_utils/BUILD
  59. 2
      test/core/address_utils/parse_address_test.cc
  60. 2
      test/core/address_utils/parse_address_with_named_scope_id_test.cc
  61. 2
      test/core/address_utils/sockaddr_utils_test.cc
  62. 4
      test/core/avl/BUILD
  63. 2
      test/core/backoff/BUILD
  64. 2
      test/core/backoff/backoff_test.cc
  65. 2
      test/core/bad_client/bad_client.cc
  66. 2
      test/core/bad_client/generate_tests.bzl
  67. 2
      test/core/bad_client/tests/bad_streaming_id.cc
  68. 2
      test/core/bad_client/tests/badreq.cc
  69. 2
      test/core/bad_client/tests/connection_prefix.cc
  70. 2
      test/core/bad_client/tests/duplicate_header.cc
  71. 2
      test/core/bad_client/tests/head_of_line_blocking.cc
  72. 2
      test/core/bad_client/tests/headers.cc
  73. 2
      test/core/bad_client/tests/initial_settings_frame.cc
  74. 2
      test/core/bad_client/tests/out_of_bounds.cc
  75. 2
      test/core/bad_client/tests/server_registered_method.cc
  76. 2
      test/core/bad_client/tests/simple_request.cc
  77. 2
      test/core/bad_client/tests/unknown_frame.cc
  78. 2
      test/core/bad_client/tests/window_overflow.cc
  79. 2
      test/core/bad_connection/BUILD
  80. 2
      test/core/bad_connection/close_fd_test.cc
  81. 4
      test/core/bad_ssl/bad_ssl_test.cc
  82. 8
      test/core/bad_ssl/generate_tests.bzl
  83. 4
      test/core/bad_ssl/server_common.cc
  84. 2
      test/core/bad_ssl/servers/alpn.cc
  85. 2
      test/core/bad_ssl/servers/cert.cc
  86. 22
      test/core/channel/BUILD
  87. 4
      test/core/channel/call_tracer_test.cc
  88. 2
      test/core/channel/channel_args_test.cc
  89. 2
      test/core/channel/channel_stack_builder_test.cc
  90. 2
      test/core/channel/channel_stack_test.cc
  91. 4
      test/core/channel/metrics_test.cc
  92. 2
      test/core/channel/minimal_stack_is_minimal_test.cc
  93. 6
      test/core/channelz/BUILD
  94. 2
      test/core/channelz/channel_trace_test.cc
  95. 2
      test/core/channelz/channelz_registry_test.cc
  96. 2
      test/core/channelz/channelz_test.cc
  97. 8
      test/core/client_channel/BUILD
  98. 2
      test/core/client_channel/client_channel_service_config_test.cc
  99. 2
      test/core/client_channel/client_channel_test.cc
  100. 2
      test/core/client_channel/retry_service_config_test.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1364,6 +1364,7 @@ grpc_cc_library(
],
external_deps = [
"absl/base:core_headers",
"absl/log:check",
"absl/status:statusor",
"absl/strings",
"absl/types:optional",
@ -3304,6 +3305,7 @@ grpc_cc_library(
"//src/core:lib/uri/uri_parser.h",
],
external_deps = [
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -3617,6 +3619,7 @@ grpc_cc_library(
"absl/container:flat_hash_set",
"absl/container:inlined_vector",
"absl/functional:any_invocable",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",

1829
CMakeLists.txt generated

File diff suppressed because it is too large Load Diff

@ -539,7 +539,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
if language.upper() == "C":
copts = copts + if_not_windows(["-std=c11"])
core_deps = deps + _get_external_deps(external_deps) + ["//test/core/util:grpc_suppressions"]
core_deps = deps + _get_external_deps(external_deps) + ["//test/core/test_util:grpc_suppressions"]
# Test args for all tests
test_args = {
@ -617,7 +617,7 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da
data = data,
testonly = testonly,
linkshared = linkshared,
deps = deps + _get_external_deps(external_deps) + ["//test/core/util:grpc_suppressions"],
deps = deps + _get_external_deps(external_deps) + ["//test/core/test_util:grpc_suppressions"],
copts = GRPC_DEFAULT_COPTS + copts,
linkopts = if_not_windows(["-pthread"]) + linkopts,
tags = tags,

File diff suppressed because it is too large Load Diff

@ -29,7 +29,7 @@ configs:
compile_the_world: true
test_environ:
ASAN_OPTIONS: detect_leaks=1:color=always
LSAN_OPTIONS: suppressions=test/core/util/lsan_suppressions.txt:report_objects=1
LSAN_OPTIONS: suppressions=test/core/test_util/lsan_suppressions.txt:report_objects=1
asan-noleaks:
CC: clang
CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer
@ -53,7 +53,7 @@ configs:
compile_the_world: true
test_environ:
ASAN_OPTIONS: detect_leaks=1:color=always
LSAN_OPTIONS: suppressions=test/core/util/lsan_suppressions.txt:report_objects=1
LSAN_OPTIONS: suppressions=test/core/test_util/lsan_suppressions.txt:report_objects=1
c++-compat:
CFLAGS: -Wc++-compat
CPPFLAGS: -O0
@ -115,7 +115,7 @@ configs:
LDXX: clang++
compile_the_world: true
test_environ:
TSAN_OPTIONS: suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
TSAN_OPTIONS: suppressions=test/core/test_util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
ubsan:
CC: clang
CPPFLAGS: -O0 -stdlib=libc++ -fsanitize-coverage=edge,trace-pc-guard -fsanitize=undefined
@ -127,7 +127,7 @@ configs:
LDXX: clang++
compile_the_world: true
test_environ:
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=test/core/test_util/ubsan_suppressions.txt
defaults:
boringssl:
CFLAGS: -g

@ -1,3 +1,3 @@
grpcio>=1.62.0
grpcio-observability>=1.62.0
opentelemetry-sdk==1.21.0
opentelemetry-sdk>=1.21.0

@ -114,10 +114,10 @@ add_library(grpc-interop
${GRPC_SRC_DIR}/test/cpp/interop/backend_metrics_lb_policy.cc
${GRPC_SRC_DIR}/test/cpp/interop/interop_client.h
${GRPC_SRC_DIR}/test/cpp/interop/interop_client.cc
${GRPC_SRC_DIR}/test/core/util/histogram.h
${GRPC_SRC_DIR}/test/core/util/histogram.cc
${GRPC_SRC_DIR}/test/core/util/test_lb_policies.h
${GRPC_SRC_DIR}/test/core/util/test_lb_policies.cc)
${GRPC_SRC_DIR}/test/core/test_util/histogram.h
${GRPC_SRC_DIR}/test/core/test_util/histogram.cc
${GRPC_SRC_DIR}/test/core/test_util/test_lb_policies.h
${GRPC_SRC_DIR}/test/core/test_util/test_lb_policies.cc)
target_link_libraries(grpc-interop
messages_proto_lib

@ -92,6 +92,7 @@ grpc_cc_library(
external_deps = [
"absl/container:flat_hash_set",
"absl/hash",
"absl/log:check",
"absl/strings",
"absl/utility",
],
@ -1144,6 +1145,9 @@ grpc_cc_library(
grpc_cc_library(
name = "ref_counted",
external_deps = [
"absl/log:check",
],
language = "c++",
public_hdrs = ["lib/gprpp/ref_counted.h"],
deps = [
@ -1157,6 +1161,9 @@ grpc_cc_library(
grpc_cc_library(
name = "dual_ref_counted",
external_deps = [
"absl/log:check",
],
language = "c++",
public_hdrs = ["lib/gprpp/dual_ref_counted.h"],
deps = [
@ -1675,6 +1682,9 @@ grpc_cc_library(
hdrs = [
"lib/event_engine/forkable.h",
],
external_deps = [
"absl/log:check",
],
deps = [
"//:config_vars",
"//:gpr",
@ -1822,6 +1832,7 @@ grpc_cc_library(
"absl/base:core_headers",
"absl/container:flat_hash_set",
"absl/functional:any_invocable",
"absl/log:check",
"absl/time",
"absl/types:optional",
],
@ -1871,6 +1882,7 @@ grpc_cc_library(
],
external_deps = [
"absl/base:core_headers",
"absl/log:check",
"absl/time",
"absl/types:optional",
],
@ -1930,7 +1942,10 @@ grpc_cc_library(
hdrs = [
"lib/event_engine/posix_engine/lockfree_event.h",
],
external_deps = ["absl/status"],
external_deps = [
"absl/log:check",
"absl/status",
],
deps = [
"gpr_atm",
"posix_event_engine_closure",
@ -2024,6 +2039,7 @@ grpc_cc_library(
"absl/base:core_headers",
"absl/container:inlined_vector",
"absl/functional:function_ref",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2060,6 +2076,7 @@ grpc_cc_library(
"absl/container:inlined_vector",
"absl/functional:any_invocable",
"absl/functional:function_ref",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2152,6 +2169,7 @@ grpc_cc_library(
"absl/container:flat_hash_map",
"absl/functional:any_invocable",
"absl/hash",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2191,7 +2209,10 @@ grpc_cc_library(
name = "event_engine_utils",
srcs = ["lib/event_engine/utils.cc"],
hdrs = ["lib/event_engine/utils.h"],
external_deps = ["absl/strings"],
external_deps = [
"absl/log:check",
"absl/strings",
],
deps = [
"time",
"//:event_engine_base_hdrs",
@ -2209,6 +2230,7 @@ grpc_cc_library(
],
external_deps = [
"absl/cleanup",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2240,6 +2262,7 @@ grpc_cc_library(
],
external_deps = [
"absl/cleanup",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2266,6 +2289,7 @@ grpc_cc_library(
external_deps = [
"absl/base:core_headers",
"absl/functional:any_invocable",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2301,6 +2325,7 @@ grpc_cc_library(
"absl/container:flat_hash_map",
"absl/functional:any_invocable",
"absl/hash",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2342,6 +2367,7 @@ grpc_cc_library(
srcs = ["lib/event_engine/windows/windows_engine.cc"],
hdrs = ["lib/event_engine/windows/windows_engine.h"],
external_deps = [
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2395,6 +2421,7 @@ grpc_cc_library(
external_deps = [
"absl/base:core_headers",
"absl/functional:any_invocable",
"absl/log:check",
"absl/status",
"absl/strings:str_format",
],
@ -2423,6 +2450,7 @@ grpc_cc_library(
external_deps = [
"absl/cleanup",
"absl/functional:any_invocable",
"absl/log:check",
"absl/status",
"absl/strings:str_format",
],
@ -2450,6 +2478,7 @@ grpc_cc_library(
],
external_deps = [
"absl/base:core_headers",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings:str_format",
@ -2483,6 +2512,7 @@ grpc_cc_library(
],
external_deps = [
"absl/container:flat_hash_map",
"absl/log:check",
"absl/strings",
"absl/strings:str_format",
],
@ -2516,6 +2546,7 @@ grpc_cc_library(
"lib/event_engine/tcp_socket_utils.h",
],
external_deps = [
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2730,6 +2761,7 @@ grpc_cc_library(
"absl/container:flat_hash_map",
"absl/functional:any_invocable",
"absl/hash",
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -3012,7 +3044,10 @@ grpc_cc_library(
"service_config/service_config.h",
"service_config/service_config_call_data.h",
],
external_deps = ["absl/strings"],
external_deps = [
"absl/log:check",
"absl/strings",
],
language = "c++",
deps = [
"arena",
@ -3106,6 +3141,7 @@ grpc_cc_library(
],
external_deps = [
"absl/functional:any_invocable",
"absl/log:check",
],
language = "c++",
deps = [
@ -3177,6 +3213,7 @@ grpc_cc_library(
"client_channel/config_selector.h",
],
external_deps = [
"absl/log:check",
"absl/status",
"absl/strings",
],
@ -3504,6 +3541,7 @@ grpc_cc_library(
"client_channel/http_proxy_mapper.h",
],
external_deps = [
"absl/log:check",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -4441,6 +4479,7 @@ grpc_cc_library(
],
external_deps = [
"absl/base:core_headers",
"absl/log:check",
"absl/meta:type_traits",
"absl/random",
"absl/status",
@ -5596,7 +5635,10 @@ grpc_cc_library(
grpc_cc_library(
name = "down_cast",
hdrs = ["lib/gprpp/down_cast.h"],
external_deps = ["absl/base:config"],
external_deps = [
"absl/base:config",
"absl/log:check",
],
deps = ["//:gpr"],
)

@ -22,6 +22,7 @@
#include <atomic>
#include <cstdint>
#include "absl/log/check.h"
#include "absl/status/statusor.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
@ -355,8 +356,8 @@ void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) {
std::string ServerNode::RenderServerSockets(intptr_t start_socket_id,
intptr_t max_results) {
GPR_ASSERT(start_socket_id >= 0);
GPR_ASSERT(max_results >= 0);
CHECK_GE(start_socket_id, 0);
CHECK_GE(max_results, 0);
// If user does not set max_results, we choose 500.
size_t pagination_limit = max_results == 0 ? 500 : max_results;
Json::Object object;

@ -24,6 +24,8 @@
#include <utility>
#include <vector>
#include "absl/log/check.h"
#include <grpc/grpc.h>
#include <grpc/support/json.h>
#include <grpc/support/log.h>
@ -56,9 +58,9 @@ void ChannelzRegistry::InternalRegister(BaseNode* node) {
}
void ChannelzRegistry::InternalUnregister(intptr_t uuid) {
GPR_ASSERT(uuid >= 1);
CHECK_GE(uuid, 1);
MutexLock lock(&mu_);
GPR_ASSERT(uuid <= uuid_generator_);
CHECK(uuid <= uuid_generator_);
node_map_.erase(uuid);
}

@ -30,6 +30,7 @@
#include <vector>
#include "absl/cleanup/cleanup.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/cord.h"
@ -458,8 +459,8 @@ class DynamicTerminationFilter final {
static grpc_error_handle Init(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(args->is_last);
GPR_ASSERT(elem->filter == &kFilterVtable);
CHECK(args->is_last);
CHECK(elem->filter == &kFilterVtable);
new (elem->channel_data) DynamicTerminationFilter(args->channel_args);
return absl::OkStatus();
}
@ -644,7 +645,7 @@ class ClientChannelFilter::SubchannelWrapper final
}
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper");
#ifndef NDEBUG
GPR_DEBUG_ASSERT(chand_->work_serializer_->RunningInWorkSerializer());
DCHECK(chand_->work_serializer_->RunningInWorkSerializer());
#endif
if (chand_->channelz_node_ != nullptr) {
auto* subchannel_node = subchannel_->channelz_node();
@ -673,7 +674,7 @@ class ClientChannelFilter::SubchannelWrapper final
auto* subchannel_node = subchannel_->channelz_node();
if (subchannel_node != nullptr) {
auto it = chand_->subchannel_refcount_map_.find(subchannel_.get());
GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
CHECK(it != chand_->subchannel_refcount_map_.end());
--it->second;
if (it->second == 0) {
chand_->channelz_node_->RemoveChildSubchannel(
@ -700,7 +701,7 @@ class ClientChannelFilter::SubchannelWrapper final
if (subchannel_node != nullptr) {
auto it =
chand_->subchannel_refcount_map_.find(subchannel_.get());
GPR_ASSERT(it != chand_->subchannel_refcount_map_.end());
CHECK(it != chand_->subchannel_refcount_map_.end());
--it->second;
if (it->second == 0) {
chand_->channelz_node_->RemoveChildSubchannel(
@ -718,7 +719,7 @@ class ClientChannelFilter::SubchannelWrapper final
std::unique_ptr<ConnectivityStateWatcherInterface> watcher) override
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
auto& watcher_wrapper = watcher_map_[watcher.get()];
GPR_ASSERT(watcher_wrapper == nullptr);
CHECK_EQ(watcher_wrapper, nullptr);
watcher_wrapper = new WatcherWrapper(
std::move(watcher),
RefAsSubclass<SubchannelWrapper>(DEBUG_LOCATION, "WatcherWrapper"));
@ -730,7 +731,7 @@ class ClientChannelFilter::SubchannelWrapper final
void CancelConnectivityStateWatch(ConnectivityStateWatcherInterface* watcher)
override ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
auto it = watcher_map_.find(watcher);
GPR_ASSERT(it != watcher_map_.end());
CHECK(it != watcher_map_.end());
subchannel_->CancelConnectivityStateWatch(it->second);
watcher_map_.erase(it);
}
@ -747,7 +748,7 @@ class ClientChannelFilter::SubchannelWrapper final
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*chand_->work_serializer_) {
static_cast<InternalSubchannelDataWatcherInterface*>(watcher.get())
->SetSubchannel(subchannel_.get());
GPR_ASSERT(data_watchers_.insert(std::move(watcher)).second);
CHECK(data_watchers_.insert(std::move(watcher)).second);
}
void CancelDataWatcher(DataWatcherInterface* watcher) override
@ -923,7 +924,7 @@ ClientChannelFilter::ExternalConnectivityWatcher::ExternalConnectivityWatcher(
{
MutexLock lock(&chand_->external_watchers_mu_);
// Will be deleted when the watch is complete.
GPR_ASSERT(chand->external_watchers_[on_complete] == nullptr);
CHECK(chand->external_watchers_[on_complete] == nullptr);
// Store a ref to the watcher in the external_watchers_ map.
chand->external_watchers_[on_complete] =
RefAsSubclass<ExternalConnectivityWatcher>(
@ -1201,9 +1202,9 @@ class ClientChannelFilter::ClientChannelControlHelper final
grpc_error_handle ClientChannelFilter::Init(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(args->is_last);
GPR_ASSERT(elem->filter == &kFilterVtableWithPromises ||
elem->filter == &kFilterVtableWithoutPromises);
CHECK(args->is_last);
CHECK(elem->filter == &kFilterVtableWithPromises ||
elem->filter == &kFilterVtableWithoutPromises);
grpc_error_handle error;
new (elem->channel_data) ClientChannelFilter(args, &error);
return error;
@ -1449,7 +1450,7 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
// - A channel arg, in which case we check that the specified policy exists
// and accepts an empty config. If not, we revert to using pick_first
// lb_policy
GPR_ASSERT(lb_policy_config.ok());
CHECK(lb_policy_config.ok());
return std::move(*lb_policy_config);
}
@ -1729,7 +1730,7 @@ void ClientChannelFilter::UpdateServiceConfigInDataPlaneLocked() {
}
RefCountedPtr<DynamicFilters> dynamic_filters =
DynamicFilters::Create(new_args, std::move(filters));
GPR_ASSERT(dynamic_filters != nullptr);
CHECK(dynamic_filters != nullptr);
// Grab data plane lock to update service config.
//
// We defer unreffing the old values (and deallocating memory) until
@ -1760,7 +1761,7 @@ void ClientChannelFilter::CreateResolverLocked() {
std::make_unique<ResolverResultHandler>(this));
// Since the validity of the args was checked when the channel was created,
// CreateResolver() must return a non-null result.
GPR_ASSERT(resolver_ != nullptr);
CHECK(resolver_ != nullptr);
UpdateStateLocked(GRPC_CHANNEL_CONNECTING, absl::Status(),
"started resolving");
resolver_->StartLocked();
@ -1869,7 +1870,7 @@ T HandlePickResult(
}
auto* drop_pick =
absl::get_if<LoadBalancingPolicy::PickResult::Drop>(&result->result);
GPR_ASSERT(drop_pick != nullptr);
CHECK_NE(drop_pick, nullptr);
return drop_func(drop_pick);
}
@ -1963,7 +1964,7 @@ void ClientChannelFilter::StartTransportOpLocked(grpc_transport_op* op) {
}
} else {
// Disconnect.
GPR_ASSERT(disconnect_error_.ok());
CHECK(disconnect_error_.ok());
disconnect_error_ = op->disconnect_with_error;
UpdateStateAndPickerLocked(
GRPC_CHANNEL_SHUTDOWN, absl::Status(), "shutdown from API",
@ -1981,7 +1982,7 @@ void ClientChannelFilter::StartTransportOpLocked(grpc_transport_op* op) {
void ClientChannelFilter::StartTransportOp(grpc_channel_element* elem,
grpc_transport_op* op) {
auto* chand = static_cast<ClientChannelFilter*>(elem->channel_data);
GPR_ASSERT(op->set_accept_stream == false);
CHECK(op->set_accept_stream == false);
// Handle bind_pollset.
if (op->bind_pollset != nullptr) {
grpc_pollset_set_add_pollset(chand->interested_parties_, op->bind_pollset);
@ -2227,7 +2228,7 @@ ClientChannelFilter::FilterBasedCallData::~FilterBasedCallData() {
CSliceUnref(path_);
// Make sure there are no remaining pending batches.
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
GPR_ASSERT(pending_batches_[i] == nullptr);
CHECK_EQ(pending_batches_[i], nullptr);
}
}
@ -2389,7 +2390,7 @@ void ClientChannelFilter::FilterBasedCallData::PendingBatchesAdd(
chand(), this, idx);
}
grpc_transport_stream_op_batch*& pending = pending_batches_[idx];
GPR_ASSERT(pending == nullptr);
CHECK_EQ(pending, nullptr);
pending = batch;
}
@ -2409,7 +2410,7 @@ void ClientChannelFilter::FilterBasedCallData::FailPendingBatchInCallCombiner(
void ClientChannelFilter::FilterBasedCallData::PendingBatchesFail(
grpc_error_handle error,
YieldCallCombinerPredicate yield_call_combiner_predicate) {
GPR_ASSERT(!error.ok());
CHECK(!error.ok());
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
@ -2958,11 +2959,11 @@ ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool was_queued) {
bool ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(
LoadBalancingPolicy::SubchannelPicker* picker, grpc_error_handle* error) {
GPR_ASSERT(connected_subchannel_ == nullptr);
CHECK(connected_subchannel_ == nullptr);
// Perform LB pick.
LoadBalancingPolicy::PickArgs pick_args;
Slice* path = send_initial_metadata()->get_pointer(HttpPathMetadata());
GPR_ASSERT(path != nullptr);
CHECK_NE(path, nullptr);
pick_args.path = path->as_string_view();
LbCallState lb_call_state(this);
pick_args.call_state = &lb_call_state;
@ -2978,7 +2979,7 @@ bool ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(
"chand=%p lb_call=%p: LB pick succeeded: subchannel=%p",
chand_, this, complete_pick->subchannel.get());
}
GPR_ASSERT(complete_pick->subchannel != nullptr);
CHECK(complete_pick->subchannel != nullptr);
// Grab a ref to the connected subchannel while we're still
// holding the data plane mutex.
SubchannelWrapper* subchannel =
@ -3066,7 +3067,7 @@ ClientChannelFilter::FilterBasedLoadBalancedCall::
~FilterBasedLoadBalancedCall() {
// Make sure there are no remaining pending batches.
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
GPR_ASSERT(pending_batches_[i] == nullptr);
CHECK_EQ(pending_batches_[i], nullptr);
}
if (on_call_destruction_complete_ != nullptr) {
ExecCtx::Run(DEBUG_LOCATION, on_call_destruction_complete_,
@ -3109,7 +3110,7 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::PendingBatchesAdd(
"chand=%p lb_call=%p: adding pending batch at index %" PRIuPTR,
chand(), this, idx);
}
GPR_ASSERT(pending_batches_[idx] == nullptr);
CHECK_EQ(pending_batches_[idx], nullptr);
pending_batches_[idx] = batch;
}
@ -3129,7 +3130,7 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::
void ClientChannelFilter::FilterBasedLoadBalancedCall::PendingBatchesFail(
grpc_error_handle error,
YieldCallCombinerPredicate yield_call_combiner_predicate) {
GPR_ASSERT(!error.ok());
CHECK(!error.ok());
failure_error_ = error;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
size_t num_batches = 0;
@ -3491,7 +3492,7 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::RetryPickLocked() {
void ClientChannelFilter::FilterBasedLoadBalancedCall::CreateSubchannelCall() {
Slice* path = send_initial_metadata()->get_pointer(HttpPathMetadata());
GPR_ASSERT(path != nullptr);
CHECK_NE(path, nullptr);
SubchannelCall::Args call_args = {
connected_subchannel()->Ref(), pollent_, path->Ref(), /*start_time=*/0,
deadline_, arena_,

@ -22,6 +22,7 @@
#include <utility>
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include <grpc/support/log.h>
@ -61,7 +62,7 @@ class ClientChannelServiceConfigCallData final : public ServiceConfigCallData {
: ServiceConfigCallData(arena, call_context) {}
void SetOnCommit(absl::AnyInvocable<void()> on_commit) {
GPR_ASSERT(on_commit_ == nullptr);
CHECK(on_commit_ == nullptr);
on_commit_ = std::move(on_commit);
}

@ -24,6 +24,7 @@
#include <utility>
#include <vector>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
@ -97,14 +98,14 @@ class DefaultConfigSelector final : public ConfigSelector {
// The client channel code ensures that this will never be null.
// If neither the resolver nor the client application provide a
// config, a default empty config will be used.
GPR_DEBUG_ASSERT(service_config_ != nullptr);
DCHECK(service_config_ != nullptr);
}
const char* name() const override { return "default"; }
absl::Status GetCallConfig(GetCallConfigArgs args) override {
Slice* path = args.initial_metadata->get_pointer(HttpPathMetadata());
GPR_ASSERT(path != nullptr);
CHECK_NE(path, nullptr);
auto* parsed_method_configs =
service_config_->GetMethodParsedConfigVector(path->c_slice());
args.service_config_call_data->SetServiceConfig(service_config_,

@ -23,6 +23,7 @@
#include <new>
#include <utility>
#include "absl/log/check.h"
#include "absl/status/statusor.h"
#include <grpc/support/log.h>
@ -82,8 +83,8 @@ void DynamicFilters::Call::StartTransportStreamOpBatch(
}
void DynamicFilters::Call::SetAfterCallStackDestroy(grpc_closure* closure) {
GPR_ASSERT(after_call_stack_destroy_ == nullptr);
GPR_ASSERT(closure != nullptr);
CHECK_EQ(after_call_stack_destroy_, nullptr);
CHECK_NE(closure, nullptr);
after_call_stack_destroy_ = closure;
}

@ -27,6 +27,7 @@
#include <string>
#include <utility>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/ascii.h"
@ -107,7 +108,7 @@ bool AddressIncluded(
///
absl::optional<std::string> GetHttpProxyServer(
const ChannelArgs& args, absl::optional<std::string>* user_cred) {
GPR_ASSERT(user_cred != nullptr);
CHECK_NE(user_cred, nullptr);
absl::StatusOr<URI> uri;
// We check the following places to determine the HTTP proxy to use, stopping
// at the first one that is set:
@ -141,7 +142,7 @@ absl::optional<std::string> GetHttpProxyServer(
size_t authority_nstrs;
gpr_string_split(uri->authority().c_str(), "@", &authority_strs,
&authority_nstrs);
GPR_ASSERT(authority_nstrs != 0); // should have at least 1 string
CHECK_NE(authority_nstrs, 0u); // should have at least 1 string
absl::optional<std::string> proxy_name;
if (authority_nstrs == 1) {
// User cred not present in authority

@ -22,6 +22,8 @@
#include <utility>
#include "absl/log/check.h"
#include <grpc/support/log.h>
#include "src/core/client_channel/subchannel.h"
@ -34,7 +36,7 @@ RefCountedPtr<Subchannel> LocalSubchannelPool::RegisterSubchannel(
// Because this pool is only accessed under the client channel's work
// serializer, and because FindSubchannel is checked before invoking
// RegisterSubchannel, no such subchannel should exist in the map.
GPR_ASSERT(it == subchannel_map_.end());
CHECK(it == subchannel_map_.end());
subchannel_map_[key] = constructed.get();
return constructed;
}
@ -45,8 +47,8 @@ void LocalSubchannelPool::UnregisterSubchannel(const SubchannelKey& key,
// Because this subchannel pool is accessed only under the client
// channel's work serializer, any subchannel created by RegisterSubchannel
// will be deleted from the map in UnregisterSubchannel.
GPR_ASSERT(it != subchannel_map_.end());
GPR_ASSERT(it->second == subchannel);
CHECK(it != subchannel_map_.end());
CHECK(it->second == subchannel);
subchannel_map_.erase(it);
}

@ -24,6 +24,7 @@
#include <new>
#include "absl/log/check.h"
#include "absl/types/optional.h"
#include <grpc/event_engine/event_engine.h>
@ -92,8 +93,8 @@ class RetryFilter final {
static grpc_error_handle Init(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(args->is_last);
GPR_ASSERT(elem->filter == &kVtable);
CHECK(args->is_last);
CHECK(elem->filter == &kVtable);
grpc_error_handle error;
new (elem->channel_data) RetryFilter(args->channel_args, &error);
return error;

@ -21,6 +21,7 @@
#include <memory>
#include <new>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
@ -1577,7 +1578,7 @@ RetryFilter::LegacyCallData::~LegacyCallData() {
CSliceUnref(path_);
// Make sure there are no remaining pending batches.
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
GPR_ASSERT(pending_batches_[i].batch == nullptr);
CHECK_EQ(pending_batches_[i].batch, nullptr);
}
}
@ -1826,7 +1827,7 @@ RetryFilter::LegacyCallData::PendingBatchesAdd(
chand_, this, idx);
}
PendingBatch* pending = &pending_batches_[idx];
GPR_ASSERT(pending->batch == nullptr);
CHECK_EQ(pending->batch, nullptr);
pending->batch = batch;
pending->send_ops_cached = false;
// Update state in calld about pending batches.
@ -1910,7 +1911,7 @@ void RetryFilter::LegacyCallData::FailPendingBatchInCallCombiner(
// This is called via the call combiner, so access to calld is synchronized.
void RetryFilter::LegacyCallData::PendingBatchesFail(grpc_error_handle error) {
GPR_ASSERT(!error.ok());
CHECK(!error.ok());
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
size_t num_batches = 0;
for (size_t i = 0; i < GPR_ARRAY_SIZE(pending_batches_); ++i) {
@ -1991,7 +1992,7 @@ void RetryFilter::LegacyCallData::StartRetryTimer(
// Compute backoff delay.
Duration next_attempt_timeout;
if (server_pushback.has_value()) {
GPR_ASSERT(*server_pushback >= Duration::Zero());
CHECK(*server_pushback >= Duration::Zero());
next_attempt_timeout = *server_pushback;
retry_backoff_.Reset();
} else {

@ -26,6 +26,7 @@
#include <new>
#include <utility>
#include "absl/log/check.h"
#include "absl/status/statusor.h"
#include "absl/strings/cord.h"
#include "absl/strings/str_cat.h"
@ -148,7 +149,7 @@ ArenaPromise<ServerMetadataHandle> ConnectedSubchannel::MakeCallPromise(
[self = Ref()](ServerMetadataHandle metadata) {
channelz::SubchannelNode* channelz_subchannel =
self->channelz_subchannel();
GPR_ASSERT(channelz_subchannel != nullptr);
CHECK_NE(channelz_subchannel, nullptr);
if (metadata->get(GrpcStatusMetadata())
.value_or(GRPC_STATUS_UNKNOWN) != GRPC_STATUS_OK) {
channelz_subchannel->RecordCallFailed();
@ -160,7 +161,7 @@ ArenaPromise<ServerMetadataHandle> ConnectedSubchannel::MakeCallPromise(
[self = Ref()]() {
channelz::SubchannelNode* channelz_subchannel =
self->channelz_subchannel();
GPR_ASSERT(channelz_subchannel != nullptr);
CHECK_NE(channelz_subchannel, nullptr);
channelz_subchannel->RecordCallFailed();
});
}
@ -219,8 +220,8 @@ grpc_call_stack* SubchannelCall::GetCallStack() {
}
void SubchannelCall::SetAfterCallStackDestroy(grpc_closure* closure) {
GPR_ASSERT(after_call_stack_destroy_ == nullptr);
GPR_ASSERT(closure != nullptr);
CHECK_EQ(after_call_stack_destroy_, nullptr);
CHECK_NE(closure, nullptr);
after_call_stack_destroy_ = closure;
}
@ -275,7 +276,7 @@ void SubchannelCall::MaybeInterceptRecvTrailingMetadata(
GRPC_CLOSURE_INIT(&recv_trailing_metadata_ready_, RecvTrailingMetadataReady,
this, grpc_schedule_on_exec_ctx);
// save some state needed for the interception callback.
GPR_ASSERT(recv_trailing_metadata_ == nullptr);
CHECK_EQ(recv_trailing_metadata_, nullptr);
recv_trailing_metadata_ =
batch->payload->recv_trailing_metadata.recv_trailing_metadata;
original_recv_trailing_metadata_ =
@ -301,12 +302,12 @@ void GetCallStatus(grpc_status_code* status, Timestamp deadline,
void SubchannelCall::RecvTrailingMetadataReady(void* arg,
grpc_error_handle error) {
SubchannelCall* call = static_cast<SubchannelCall*>(arg);
GPR_ASSERT(call->recv_trailing_metadata_ != nullptr);
CHECK_NE(call->recv_trailing_metadata_, nullptr);
grpc_status_code status = GRPC_STATUS_OK;
GetCallStatus(&status, call->deadline_, call->recv_trailing_metadata_, error);
channelz::SubchannelNode* channelz_subchannel =
call->connected_subchannel_->channelz_subchannel();
GPR_ASSERT(channelz_subchannel != nullptr);
CHECK_NE(channelz_subchannel, nullptr);
if (status == GRPC_STATUS_OK) {
channelz_subchannel->RecordCallSucceeded();
} else {
@ -520,7 +521,7 @@ RefCountedPtr<Subchannel> Subchannel::Create(
const grpc_resolved_address& address, const ChannelArgs& args) {
SubchannelKey key(address, args);
auto* subchannel_pool = args.GetObject<SubchannelPoolInterface>();
GPR_ASSERT(subchannel_pool != nullptr);
CHECK_NE(subchannel_pool, nullptr);
RefCountedPtr<Subchannel> c = subchannel_pool->FindSubchannel(key);
if (c != nullptr) {
return c;
@ -628,7 +629,7 @@ void Subchannel::Orphaned() {
}
{
MutexLock lock(&mu_);
GPR_ASSERT(!shutdown_);
CHECK(!shutdown_);
shutdown_ = true;
connector_.reset();
connected_subchannel_.reset();

@ -23,6 +23,8 @@
#include <utility>
#include "absl/log/check.h"
#include <grpc/status.h>
#include <grpc/support/log.h>
@ -110,7 +112,7 @@ void SubchannelStreamClient::StartCall() {
void SubchannelStreamClient::StartCallLocked() {
if (event_handler_ == nullptr) return;
GPR_ASSERT(call_state_ == nullptr);
CHECK(call_state_ == nullptr);
if (event_handler_ != nullptr) {
event_handler_->OnCallStartLocked(this);
}
@ -235,7 +237,7 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
send_initial_metadata_.Set(
HttpPathMetadata(),
subchannel_stream_client_->event_handler_->GetPathLocked());
GPR_ASSERT(error.ok());
CHECK(error.ok());
payload_.send_initial_metadata.send_initial_metadata =
&send_initial_metadata_;
batch_.send_initial_metadata = true;
@ -444,7 +446,7 @@ void SubchannelStreamClient::CallState::CallEndedLocked(bool retry) {
if (this == subchannel_stream_client_->call_state_.get()) {
subchannel_stream_client_->call_state_.reset();
if (retry) {
GPR_ASSERT(subchannel_stream_client_->event_handler_ != nullptr);
CHECK(subchannel_stream_client_->event_handler_ != nullptr);
if (seen_response_.load(std::memory_order_acquire)) {
// If the call fails after we've gotten a successful response, reset
// the backoff and restart the call immediately.

@ -52,6 +52,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/hash/hash.h"
#include "absl/log/check.h"
#include "absl/strings/match.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
@ -229,8 +230,8 @@ AresResolver::AresResolver(
}
AresResolver::~AresResolver() {
GPR_ASSERT(fd_node_list_.empty());
GPR_ASSERT(callback_map_.empty());
CHECK(fd_node_list_.empty());
CHECK(callback_map_.empty());
ares_destroy(channel_);
}
@ -246,7 +247,7 @@ void AresResolver::Orphan() {
if (!fd_node->already_shutdown) {
GRPC_ARES_RESOLVER_TRACE_LOG("resolver: %p shutdown fd: %s", this,
fd_node->polled_fd->GetName());
GPR_ASSERT(fd_node->polled_fd->ShutdownLocked(
CHECK(fd_node->polled_fd->ShutdownLocked(
absl::CancelledError("AresResolver::Orphan")));
fd_node->already_shutdown = true;
}
@ -513,7 +514,7 @@ void AresResolver::MaybeStartTimerLocked() {
void AresResolver::OnReadable(FdNode* fd_node, absl::Status status) {
grpc_core::MutexLock lock(&mutex_);
GPR_ASSERT(fd_node->readable_registered);
CHECK(fd_node->readable_registered);
fd_node->readable_registered = false;
GRPC_ARES_RESOLVER_TRACE_LOG("OnReadable: fd: %d; request: %p; status: %s",
fd_node->as, this, status.ToString().c_str());
@ -532,7 +533,7 @@ void AresResolver::OnReadable(FdNode* fd_node, absl::Status status) {
void AresResolver::OnWritable(FdNode* fd_node, absl::Status status) {
grpc_core::MutexLock lock(&mutex_);
GPR_ASSERT(fd_node->writable_registered);
CHECK(fd_node->writable_registered);
fd_node->writable_registered = false;
GRPC_ARES_RESOLVER_TRACE_LOG("OnWritable: fd: %d; request:%p; status: %s",
fd_node->as, this, status.ToString().c_str());
@ -582,7 +583,7 @@ void AresResolver::OnHostbynameDoneLocked(void* arg, int status,
int /*timeouts*/,
struct hostent* hostent) {
auto* hostname_qa = static_cast<HostnameQueryArg*>(arg);
GPR_ASSERT(hostname_qa->pending_requests-- > 0);
CHECK_GT(hostname_qa->pending_requests--, 0);
auto* ares_resolver = hostname_qa->ares_resolver;
if (status != ARES_SUCCESS) {
std::string error_msg =
@ -643,9 +644,9 @@ void AresResolver::OnHostbynameDoneLocked(void* arg, int status,
if (hostname_qa->pending_requests == 0) {
auto nh =
ares_resolver->callback_map_.extract(hostname_qa->callback_map_id);
GPR_ASSERT(!nh.empty());
GPR_ASSERT(absl::holds_alternative<
EventEngine::DNSResolver::LookupHostnameCallback>(nh.mapped()));
CHECK(!nh.empty());
CHECK(absl::holds_alternative<
EventEngine::DNSResolver::LookupHostnameCallback>(nh.mapped()));
auto callback = absl::get<EventEngine::DNSResolver::LookupHostnameCallback>(
std::move(nh.mapped()));
if (!hostname_qa->result.empty() || hostname_qa->error_status.ok()) {
@ -670,10 +671,9 @@ void AresResolver::OnSRVQueryDoneLocked(void* arg, int status, int /*timeouts*/,
std::unique_ptr<QueryArg> qa(static_cast<QueryArg*>(arg));
auto* ares_resolver = qa->ares_resolver;
auto nh = ares_resolver->callback_map_.extract(qa->callback_map_id);
GPR_ASSERT(!nh.empty());
GPR_ASSERT(
absl::holds_alternative<EventEngine::DNSResolver::LookupSRVCallback>(
nh.mapped()));
CHECK(!nh.empty());
CHECK(absl::holds_alternative<EventEngine::DNSResolver::LookupSRVCallback>(
nh.mapped()));
auto callback = absl::get<EventEngine::DNSResolver::LookupSRVCallback>(
std::move(nh.mapped()));
auto fail = [&](absl::string_view prefix) {
@ -726,10 +726,9 @@ void AresResolver::OnTXTDoneLocked(void* arg, int status, int /*timeouts*/,
std::unique_ptr<QueryArg> qa(static_cast<QueryArg*>(arg));
auto* ares_resolver = qa->ares_resolver;
auto nh = ares_resolver->callback_map_.extract(qa->callback_map_id);
GPR_ASSERT(!nh.empty());
GPR_ASSERT(
absl::holds_alternative<EventEngine::DNSResolver::LookupTXTCallback>(
nh.mapped()));
CHECK(!nh.empty());
CHECK(absl::holds_alternative<EventEngine::DNSResolver::LookupTXTCallback>(
nh.mapped()));
auto callback = absl::get<EventEngine::DNSResolver::LookupTXTCallback>(
std::move(nh.mapped()));
auto fail = [&](absl::string_view prefix) {

@ -20,6 +20,8 @@
#include <CoreFoundation/CoreFoundation.h>
#include "absl/log/check.h"
#include <grpc/support/cpu.h>
#include "src/core/lib/event_engine/cf_engine/cf_engine.h"
@ -68,7 +70,7 @@ CFEventEngine::~CFEventEngine() {
HandleToString(handle).c_str());
}
}
GPR_ASSERT(GPR_LIKELY(known_handles_.empty()));
CHECK(GPR_LIKELY(known_handles_.empty()));
timer_manager_.Shutdown();
}
thread_pool_->Quiesce();

@ -18,6 +18,7 @@
#include <AvailabilityMacros.h>
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
#include "absl/log/check.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
@ -153,7 +154,7 @@ void DNSServiceResolverImpl::ResolveCallback(
grpc_core::ReleasableMutexLock lock(&that->request_mu_);
auto request_it = that->requests_.find(sdRef);
GPR_ASSERT(request_it != that->requests_.end());
CHECK(request_it != that->requests_.end());
if (errorCode != kDNSServiceErr_NoError &&
errorCode != kDNSServiceErr_NoSuchRecord) {

@ -23,6 +23,7 @@
#include <dns_sd.h>
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include <grpc/event_engine/event_engine.h>
@ -47,7 +48,7 @@ class DNSServiceResolverImpl
explicit DNSServiceResolverImpl(std::shared_ptr<CFEventEngine> engine)
: engine_(std::move((engine))) {}
~DNSServiceResolverImpl() override {
GPR_ASSERT(requests_.empty());
CHECK(requests_.empty());
dispatch_release(queue_);
}

@ -14,6 +14,8 @@
#include "src/core/lib/event_engine/forkable.h"
#include "absl/log/check.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -43,7 +45,7 @@ void ObjectGroupForkHandler::RegisterForkable(
std::shared_ptr<Forkable> forkable, GRPC_UNUSED void (*prepare)(void),
GRPC_UNUSED void (*parent)(void), GRPC_UNUSED void (*child)(void)) {
if (IsForkEnabled()) {
GPR_ASSERT(!is_forking_);
CHECK(!is_forking_);
forkables_.emplace_back(forkable);
#ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
if (!std::exchange(registered_, true)) {
@ -55,7 +57,7 @@ void ObjectGroupForkHandler::RegisterForkable(
void ObjectGroupForkHandler::Prefork() {
if (IsForkEnabled()) {
GPR_ASSERT(!std::exchange(is_forking_, true));
CHECK(!std::exchange(is_forking_, true));
GRPC_FORK_TRACE_LOG_STRING("PrepareFork");
for (auto it = forkables_.begin(); it != forkables_.end();) {
auto shared = it->lock();
@ -71,7 +73,7 @@ void ObjectGroupForkHandler::Prefork() {
void ObjectGroupForkHandler::PostforkParent() {
if (IsForkEnabled()) {
GPR_ASSERT(is_forking_);
CHECK(is_forking_);
GRPC_FORK_TRACE_LOG_STRING("PostforkParent");
for (auto it = forkables_.begin(); it != forkables_.end();) {
auto shared = it->lock();
@ -88,7 +90,7 @@ void ObjectGroupForkHandler::PostforkParent() {
void ObjectGroupForkHandler::PostforkChild() {
if (IsForkEnabled()) {
GPR_ASSERT(is_forking_);
CHECK(is_forking_);
GRPC_FORK_TRACE_LOG_STRING("PostforkChild");
for (auto it = forkables_.begin(); it != forkables_.end();) {
auto shared = it->lock();

@ -18,6 +18,7 @@
#include <atomic>
#include <memory>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -353,14 +354,14 @@ Epoll1Poller::Epoll1Poller(Scheduler* scheduler)
: scheduler_(scheduler), was_kicked_(false), closed_(false) {
g_epoll_set_.epfd = EpollCreateAndCloexec();
wakeup_fd_ = *CreateWakeupFd();
GPR_ASSERT(wakeup_fd_ != nullptr);
GPR_ASSERT(g_epoll_set_.epfd >= 0);
CHECK(wakeup_fd_ != nullptr);
CHECK_GE(g_epoll_set_.epfd, 0);
gpr_log(GPR_INFO, "grpc epoll fd: %d", g_epoll_set_.epfd);
struct epoll_event ev;
ev.events = static_cast<uint32_t>(EPOLLIN | EPOLLET);
ev.data.ptr = wakeup_fd_.get();
GPR_ASSERT(epoll_ctl(g_epoll_set_.epfd, EPOLL_CTL_ADD, wakeup_fd_->ReadFd(),
&ev) == 0);
CHECK(epoll_ctl(g_epoll_set_.epfd, EPOLL_CTL_ADD, wakeup_fd_->ReadFd(),
&ev) == 0);
g_epoll_set_.num_events = 0;
g_epoll_set_.cursor = 0;
ForkPollerListAddPoller(this);
@ -438,7 +439,7 @@ bool Epoll1Poller::ProcessEpollEvents(int max_epoll_events_to_handle,
struct epoll_event* ev = &g_epoll_set_.events[c];
void* data_ptr = ev->data.ptr;
if (data_ptr == wakeup_fd_.get()) {
GPR_ASSERT(wakeup_fd_->ConsumeWakeup().ok());
CHECK(wakeup_fd_->ConsumeWakeup().ok());
was_kicked = true;
} else {
Epoll1EventHandle* handle = reinterpret_cast<Epoll1EventHandle*>(
@ -557,7 +558,7 @@ void Epoll1Poller::Kick() {
return;
}
was_kicked_ = true;
GPR_ASSERT(wakeup_fd_->Wakeup().ok());
CHECK(wakeup_fd_->Wakeup().ok());
}
std::shared_ptr<Epoll1Poller> MakeEpoll1Poller(Scheduler* scheduler) {

@ -23,6 +23,7 @@
#include "absl/container/inlined_vector.h"
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -339,7 +340,7 @@ EventHandle* PollPoller::CreateHandle(int fd, absl::string_view /*name*/,
bool track_err) {
// Avoid unused-parameter warning for debug-only parameter
(void)track_err;
GPR_DEBUG_ASSERT(track_err == false);
DCHECK(track_err == false);
PollEventHandle* handle = new PollEventHandle(fd, shared_from_this());
ForkFdListAddHandle(handle);
// We need to send a kick to the thread executing Work(..) so that it can
@ -359,7 +360,7 @@ void PollEventHandle::OrphanHandle(PosixEngineClosure* on_done, int* release_fd,
if (release_fd != nullptr) {
*release_fd = fd_;
}
GPR_ASSERT(!is_orphaned_);
CHECK(!is_orphaned_);
is_orphaned_ = true;
// Perform shutdown operations if not already done so.
if (!is_shutdown_) {
@ -573,7 +574,7 @@ void PollPoller::KickExternal(bool ext) {
}
was_kicked_ = true;
was_kicked_ext_ = ext;
GPR_ASSERT(wakeup_fd_->Wakeup().ok());
CHECK(wakeup_fd_->Wakeup().ok());
}
void PollPoller::Kick() { KickExternal(true); }
@ -612,7 +613,7 @@ PollPoller::PollPoller(Scheduler* scheduler)
poll_handles_list_head_(nullptr),
closed_(false) {
wakeup_fd_ = *CreateWakeupFd();
GPR_ASSERT(wakeup_fd_ != nullptr);
CHECK(wakeup_fd_ != nullptr);
ForkPollerListAddPoller(this);
}
@ -625,15 +626,15 @@ PollPoller::PollPoller(Scheduler* scheduler, bool use_phony_poll)
poll_handles_list_head_(nullptr),
closed_(false) {
wakeup_fd_ = *CreateWakeupFd();
GPR_ASSERT(wakeup_fd_ != nullptr);
CHECK(wakeup_fd_ != nullptr);
ForkPollerListAddPoller(this);
}
PollPoller::~PollPoller() {
// Assert that no active handles are present at the time of destruction.
// They should have been orphaned before reaching this state.
GPR_ASSERT(num_poll_handles_ == 0);
GPR_ASSERT(poll_handles_list_head_ == nullptr);
CHECK_EQ(num_poll_handles_, 0);
CHECK_EQ(poll_handles_list_head_, nullptr);
}
Poller::WorkResult PollPoller::Work(
@ -685,7 +686,7 @@ Poller::WorkResult PollPoller::Work(
// There shouldn't be any orphaned fds at this point. This is because
// prior to marking a handle as orphaned it is first removed from
// poll handle list for the poller under the poller lock.
GPR_ASSERT(!head->IsOrphaned());
CHECK(!head->IsOrphaned());
if (!head->IsPollhup()) {
pfds[pfd_count].fd = head->WrappedFd();
watchers[pfd_count] = head;
@ -761,7 +762,7 @@ Poller::WorkResult PollPoller::Work(
}
} else {
if (pfds[0].revents & kPollinCheck) {
GPR_ASSERT(wakeup_fd_->ConsumeWakeup().ok());
CHECK(wakeup_fd_->ConsumeWakeup().ok());
}
for (i = 1; i < pfd_count; i++) {
PollEventHandle* head = watchers[i];

@ -16,6 +16,7 @@
#include <atomic>
#include <cstdint>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include <grpc/support/atm.h>
@ -78,7 +79,7 @@ void LockfreeEvent::DestroyEvent() {
if (curr & kShutdownBit) {
grpc_core::internal::StatusFreeHeapPtr(curr & ~kShutdownBit);
} else {
GPR_ASSERT(curr == kClosureNotReady || curr == kClosureReady);
CHECK(curr == kClosureNotReady || curr == kClosureReady);
}
// we CAS in a shutdown, no error value here. If this event is interacted
// with post-deletion (see the note in the constructor) we want the bit

@ -26,6 +26,7 @@
#include <type_traits>
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -245,7 +246,7 @@ msg_iovlen_type TcpZerocopySendRecord::PopulateIovs(size_t* unwind_slice_idx,
++(out_offset_.slice_idx);
out_offset_.byte_idx = 0;
}
GPR_DEBUG_ASSERT(iov_size > 0);
DCHECK_GT(iov_size, 0u);
return iov_size;
}
@ -314,8 +315,8 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
iov[i].iov_len = slice.length();
}
GPR_ASSERT(incoming_buffer_->Length() != 0);
GPR_DEBUG_ASSERT(min_progress_size_ > 0);
CHECK_NE(incoming_buffer_->Length(), 0u);
DCHECK_GT(min_progress_size_, 0);
do {
// Assume there is something on the queue. If we receive TCP_INQ from
@ -371,12 +372,11 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
}
AddToEstimate(static_cast<size_t>(read_bytes));
GPR_DEBUG_ASSERT((size_t)read_bytes <=
incoming_buffer_->Length() - total_read_bytes);
DCHECK((size_t)read_bytes <= incoming_buffer_->Length() - total_read_bytes);
#ifdef GRPC_HAVE_TCP_INQ
if (inq_capable_) {
GPR_DEBUG_ASSERT(!(msg.msg_flags & MSG_CTRUNC));
DCHECK(!(msg.msg_flags & MSG_CTRUNC));
struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
for (; cmsg != nullptr; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_TCP && cmsg->cmsg_type == TCP_CM_INQ &&
@ -419,7 +419,7 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) {
FinishEstimate();
}
GPR_DEBUG_ASSERT(total_read_bytes > 0);
DCHECK_GT(total_read_bytes, 0u);
status = absl::OkStatus();
if (grpc_core::IsTcpFrameSizeTuningEnabled()) {
// Update min progress size based on the total number of bytes read in
@ -595,7 +595,7 @@ bool PosixEndpointImpl::Read(absl::AnyInvocable<void(absl::Status)> on_read,
const EventEngine::Endpoint::ReadArgs* args) {
grpc_core::ReleasableMutexLock lock(&read_mu_);
GRPC_EVENT_ENGINE_ENDPOINT_TRACE("Endpoint[%p]: Read", this);
GPR_ASSERT(read_cb_ == nullptr);
CHECK(read_cb_ == nullptr);
incoming_buffer_ = buffer;
incoming_buffer_->Clear();
incoming_buffer_->Swap(last_read_buffer_);
@ -670,8 +670,8 @@ TcpZerocopySendRecord* PosixEndpointImpl::TcpGetSendZerocopyRecord(
}
if (zerocopy_send_record != nullptr) {
zerocopy_send_record->PrepareForSends(buf);
GPR_DEBUG_ASSERT(buf.Count() == 0);
GPR_DEBUG_ASSERT(buf.Length() == 0);
DCHECK_EQ(buf.Count(), 0u);
DCHECK_EQ(buf.Length(), 0u);
outgoing_byte_idx_ = 0;
outgoing_buffer_ = nullptr;
}
@ -758,10 +758,10 @@ void PosixEndpointImpl::ZerocopyDisableAndWaitForRemaining() {
// Reads \a cmsg to process zerocopy control messages.
void PosixEndpointImpl::ProcessZerocopy(struct cmsghdr* cmsg) {
GPR_DEBUG_ASSERT(cmsg);
DCHECK(cmsg);
auto serr = reinterpret_cast<struct sock_extended_err*>(CMSG_DATA(cmsg));
GPR_DEBUG_ASSERT(serr->ee_errno == 0);
GPR_DEBUG_ASSERT(serr->ee_origin == SO_EE_ORIGIN_ZEROCOPY);
DCHECK_EQ(serr->ee_errno, 0u);
DCHECK(serr->ee_origin == SO_EE_ORIGIN_ZEROCOPY);
const uint32_t lo = serr->ee_info;
const uint32_t hi = serr->ee_data;
for (uint32_t seq = lo; seq <= hi; ++seq) {
@ -771,7 +771,7 @@ void PosixEndpointImpl::ProcessZerocopy(struct cmsghdr* cmsg) {
// both; if so, batch the unref/put.
TcpZerocopySendRecord* record =
tcp_zerocopy_send_ctx_->ReleaseSendRecord(seq);
GPR_DEBUG_ASSERT(record);
DCHECK(record);
UnrefMaybePutZerocopySendRecord(record);
}
if (tcp_zerocopy_send_ctx_->UpdateZeroCopyOptMemStateAfterFree()) {
@ -1057,7 +1057,7 @@ bool PosixEndpointImpl::TcpFlush(absl::Status& status) {
outgoing_slice_idx++;
outgoing_byte_idx_ = 0;
}
GPR_ASSERT(iov_size > 0);
CHECK_GT(iov_size, 0u);
msg.msg_name = nullptr;
msg.msg_namelen = 0;
@ -1100,7 +1100,7 @@ bool PosixEndpointImpl::TcpFlush(absl::Status& status) {
}
}
GPR_ASSERT(outgoing_byte_idx_ == 0);
CHECK_EQ(outgoing_byte_idx_, 0u);
bytes_counter_ += sent_length;
trailing = sending_length - static_cast<size_t>(sent_length);
while (trailing > 0) {
@ -1139,7 +1139,7 @@ void PosixEndpointImpl::HandleWrite(absl::Status status) {
? TcpFlushZerocopy(current_zerocopy_send_, status)
: TcpFlush(status);
if (!flush_result) {
GPR_DEBUG_ASSERT(status.ok());
DCHECK(status.ok());
handle_->NotifyOnWrite(on_write_);
} else {
GRPC_EVENT_ENGINE_ENDPOINT_TRACE("Endpoint[%p]: Write complete: %s", this,
@ -1158,9 +1158,9 @@ bool PosixEndpointImpl::Write(
absl::Status status = absl::OkStatus();
TcpZerocopySendRecord* zerocopy_send_record = nullptr;
GPR_ASSERT(write_cb_ == nullptr);
GPR_DEBUG_ASSERT(current_zerocopy_send_ == nullptr);
GPR_DEBUG_ASSERT(data != nullptr);
CHECK(write_cb_ == nullptr);
DCHECK_EQ(current_zerocopy_send_, nullptr);
DCHECK_NE(data, nullptr);
GRPC_EVENT_ENGINE_ENDPOINT_TRACE("Endpoint[%p]: Write %" PRIdPTR " bytes",
this, data->Length());
@ -1191,7 +1191,7 @@ bool PosixEndpointImpl::Write(
outgoing_buffer_arg_ = args->google_specific;
}
if (outgoing_buffer_arg_) {
GPR_ASSERT(poller_->CanTrackErrors());
CHECK(poller_->CanTrackErrors());
}
bool flush_result = zerocopy_send_record != nullptr
@ -1266,7 +1266,7 @@ PosixEndpointImpl::PosixEndpointImpl(EventHandle* handle,
engine_(engine) {
PosixSocketWrapper sock(handle->WrappedFd());
fd_ = handle_->WrappedFd();
GPR_ASSERT(options.resource_quota != nullptr);
CHECK(options.resource_quota != nullptr);
auto peer_addr_string = sock.PeerAddressString();
mem_quota_ = options.resource_quota->memory_quota();
memory_owner_ = mem_quota_->CreateMemoryOwner();
@ -1348,7 +1348,7 @@ std::unique_ptr<PosixEndpoint> CreatePosixEndpoint(
EventHandle* handle, PosixEngineClosure* on_shutdown,
std::shared_ptr<EventEngine> engine, MemoryAllocator&& allocator,
const PosixTcpOptions& options) {
GPR_DEBUG_ASSERT(handle != nullptr);
DCHECK_NE(handle, nullptr);
return std::make_unique<PosixEndpoint>(handle, on_shutdown, std::move(engine),
std::move(allocator), options);
}

@ -29,6 +29,7 @@
#include "absl/container/flat_hash_map.h"
#include "absl/functional/any_invocable.h"
#include "absl/hash/hash.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -130,7 +131,7 @@ class TcpZerocopySendRecord {
// sendmsg() failed or when tcp_write() is done.
bool Unref() {
const intptr_t prior = ref_.fetch_sub(1, std::memory_order_acq_rel);
GPR_DEBUG_ASSERT(prior > 0);
DCHECK_GT(prior, 0);
if (prior == 1) {
AllSendsComplete();
return true;
@ -145,9 +146,9 @@ class TcpZerocopySendRecord {
};
void DebugAssertEmpty() {
GPR_DEBUG_ASSERT(buf_.Count() == 0);
GPR_DEBUG_ASSERT(buf_.Length() == 0);
GPR_DEBUG_ASSERT(ref_.load(std::memory_order_relaxed) == 0);
DCHECK_EQ(buf_.Count(), 0u);
DCHECK_EQ(buf_.Length(), 0u);
DCHECK_EQ(ref_.load(std::memory_order_relaxed), 0);
}
// When all sendmsg() calls associated with this tcp_write() have been
@ -155,7 +156,7 @@ class TcpZerocopySendRecord {
// for each sendmsg()) and all reference counts have been dropped, drop our
// reference to the underlying data since we no longer need it.
void AllSendsComplete() {
GPR_DEBUG_ASSERT(ref_.load(std::memory_order_relaxed) == 0);
DCHECK_EQ(ref_.load(std::memory_order_relaxed), 0);
buf_.Clear();
}
@ -236,7 +237,7 @@ class TcpZerocopySendCtx {
--last_send_;
if (ReleaseSendRecord(last_send_)->Unref()) {
// We should still be holding the ref taken by tcp_write().
GPR_DEBUG_ASSERT(0);
DCHECK(0);
}
}
@ -274,8 +275,7 @@ class TcpZerocopySendCtx {
// same time.
void PutSendRecord(TcpZerocopySendRecord* record) {
grpc_core::MutexLock lock(&mu_);
GPR_DEBUG_ASSERT(record >= send_records_ &&
record < send_records_ + max_sends_);
DCHECK(record >= send_records_ && record < send_records_ + max_sends_);
PutSendRecordLocked(record);
}
@ -332,7 +332,7 @@ class TcpZerocopySendCtx {
zcopy_enobuf_state_ = OptMemState::kCheck;
return false;
}
GPR_DEBUG_ASSERT(zcopy_enobuf_state_ != OptMemState::kCheck);
DCHECK(zcopy_enobuf_state_ != OptMemState::kCheck);
if (zcopy_enobuf_state_ == OptMemState::kFull) {
// A previous sendmsg attempt was blocked by ENOBUFS. Return true to
// mark the fd as writable so the next write attempt could be made.
@ -423,7 +423,7 @@ class TcpZerocopySendCtx {
TcpZerocopySendRecord* ReleaseSendRecordLocked(uint32_t seq)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
auto iter = ctx_lookup_.find(seq);
GPR_DEBUG_ASSERT(iter != ctx_lookup_.end());
DCHECK(iter != ctx_lookup_.end());
TcpZerocopySendRecord* record = iter->second;
ctx_lookup_.erase(iter);
return record;
@ -443,7 +443,7 @@ class TcpZerocopySendCtx {
void PutSendRecordLocked(TcpZerocopySendRecord* record)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
GPR_DEBUG_ASSERT(free_send_records_size_ < max_sends_);
DCHECK(free_send_records_size_ < max_sends_);
free_send_records_[free_send_records_size_] = record;
free_send_records_size_++;
}

@ -25,6 +25,7 @@
#include "absl/cleanup/cleanup.h"
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
@ -142,7 +143,7 @@ void AsyncConnect::OnWritable(absl::Status status)
absl::StatusOr<std::unique_ptr<EventEngine::Endpoint>> ep;
mu_.Lock();
GPR_ASSERT(fd_ != nullptr);
CHECK_NE(fd_, nullptr);
fd = std::exchange(fd_, nullptr);
bool connect_cancelled = connect_cancelled_;
if (fd->IsHandleShutdown() && status.ok()) {
@ -334,7 +335,7 @@ PosixEnginePollerManager::PosixEnginePollerManager(
poller_state_(PollerState::kExternal),
executor_(nullptr),
trigger_shutdown_called_(false) {
GPR_DEBUG_ASSERT(poller_ != nullptr);
DCHECK_NE(poller_, nullptr);
}
void PosixEnginePollerManager::Run(
@ -351,7 +352,7 @@ void PosixEnginePollerManager::Run(absl::AnyInvocable<void()> cb) {
}
void PosixEnginePollerManager::TriggerShutdown() {
GPR_DEBUG_ASSERT(trigger_shutdown_called_ == false);
DCHECK(trigger_shutdown_called_ == false);
trigger_shutdown_called_ = true;
// If the poller is external, dont try to shut it down. Otherwise
// set poller state to PollerState::kShuttingDown.
@ -467,7 +468,7 @@ PosixEventEngine::~PosixEventEngine() {
this, HandleToString(handle).c_str());
}
}
GPR_ASSERT(GPR_LIKELY(known_handles_.empty()));
CHECK(GPR_LIKELY(known_handles_.empty()));
}
timer_manager_->Shutdown();
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
@ -592,7 +593,7 @@ bool PosixEventEngine::CancelConnect(EventEngine::ConnectionHandle handle) {
auto it = shard->pending_connections.find(connection_handle);
if (it != shard->pending_connections.end()) {
ac = it->second;
GPR_ASSERT(ac != nullptr);
CHECK_NE(ac, nullptr);
// Trying to acquire ac->mu here would could cause a deadlock because
// the OnWritable method tries to acquire the two mutexes used
// here in the reverse order. But we dont need to acquire ac->mu before
@ -639,7 +640,7 @@ EventEngine::ConnectionHandle PosixEventEngine::Connect(
const EndpointConfig& args, MemoryAllocator memory_allocator,
Duration timeout) {
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
GPR_ASSERT(poller_manager_ != nullptr);
CHECK_NE(poller_manager_, nullptr);
PosixTcpOptions options = TcpOptionsFromEndpointConfig(args);
absl::StatusOr<PosixSocketWrapper::PosixSocketCreateResult> socket =
PosixSocketWrapper::CreateAndPrepareTcpClientSocket(options, addr);
@ -661,9 +662,9 @@ PosixEventEngine::CreatePosixEndpointFromFd(int fd,
const EndpointConfig& config,
MemoryAllocator memory_allocator) {
#if GRPC_PLATFORM_SUPPORTS_POSIX_POLLING
GPR_DEBUG_ASSERT(fd > 0);
DCHECK_GT(fd, 0);
PosixEventPoller* poller = poller_manager_->Poller();
GPR_DEBUG_ASSERT(poller != nullptr);
DCHECK_NE(poller, nullptr);
EventHandle* handle =
poller->CreateHandle(fd, "tcp-client", poller->CanTrackErrors());
return CreatePosixEndpoint(handle, nullptr, shared_from_this(),

@ -31,6 +31,7 @@
#include <utility>
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/types/optional.h"
@ -79,7 +80,7 @@ absl::StatusOr<int> PosixEngineListenerImpl::Bind(
EventEngine::ResolvedAddress res_addr = addr;
EventEngine::ResolvedAddress addr6_v4mapped;
int requested_port = ResolvedAddressGetPort(res_addr);
GPR_ASSERT(addr.size() <= EventEngine::ResolvedAddress::MAX_SIZE_BYTES);
CHECK(addr.size() <= EventEngine::ResolvedAddress::MAX_SIZE_BYTES);
UnlinkIfUnixDomainSocket(addr);
/// Check if this is a wildcard port, and if so, try to keep the port the same
@ -303,7 +304,7 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::Shutdown() {
absl::Status PosixEngineListenerImpl::Start() {
grpc_core::MutexLock lock(&this->mu_);
// Start each asynchronous acceptor.
GPR_ASSERT(!this->started_);
CHECK(!this->started_);
this->started_ = true;
for (auto it = acceptors_.begin(); it != acceptors_.end(); it++) {
(*it)->Start();

@ -22,6 +22,7 @@
#include <string>
#include "absl/cleanup/cleanup.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_replace.h"
@ -137,7 +138,7 @@ absl::Status PrepareSocket(const PosixTcpOptions& options,
ListenerSocket& socket) {
ResolvedAddress sockname_temp;
int fd = socket.sock.Fd();
GPR_ASSERT(fd >= 0);
CHECK_GE(fd, 0);
bool close_fd = true;
socket.zero_copy_enabled = false;
socket.port = 0;
@ -226,7 +227,7 @@ absl::StatusOr<ListenerSocket> CreateAndPrepareListenerSocket(
socket.addr = addr;
}
GRPC_RETURN_IF_ERROR(PrepareSocket(options, socket));
GPR_ASSERT(socket.port > 0);
CHECK_GT(socket.port, 0);
return socket;
}
@ -359,8 +360,8 @@ absl::StatusOr<int> ListenerContainerAddWildcardAddresses(
}
return assigned_port;
} else {
GPR_ASSERT(!v6_sock.ok());
GPR_ASSERT(!v4_sock.ok());
CHECK(!v6_sock.ok());
CHECK(!v4_sock.ok());
return absl::FailedPreconditionError(absl::StrCat(
"Failed to add any wildcard listeners: ", v6_sock.status().message(),
v4_sock.status().message()));

@ -48,6 +48,7 @@
#include <atomic>
#include <cstring>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include <grpc/support/log.h>
@ -662,7 +663,7 @@ void PosixSocketWrapper::TrySetSocketTcpUserTimeout(
// Set a socket using a grpc_socket_mutator
absl::Status PosixSocketWrapper::SetSocketMutator(
grpc_fd_usage usage, grpc_socket_mutator* mutator) {
GPR_ASSERT(mutator);
CHECK(mutator);
if (!grpc_socket_mutator_mutate_fd(mutator, fd_, usage)) {
return absl::Status(absl::StatusCode::kInternal,
"grpc_socket_mutator failed.");

@ -19,6 +19,7 @@
#include <string>
#include <utility>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -161,7 +162,7 @@ void UnlinkIfUnixDomainSocket(
class PosixSocketWrapper {
public:
explicit PosixSocketWrapper(int fd) : fd_(fd) { GPR_ASSERT(fd_ > 0); }
explicit PosixSocketWrapper(int fd) : fd_(fd) { CHECK_GT(fd_, 0); }
PosixSocketWrapper() : fd_(-1){};

@ -21,6 +21,7 @@
#include <memory>
#include <utility>
#include "absl/log/check.h"
#include "absl/time/time.h"
#include "absl/types/optional.h"
@ -68,8 +69,8 @@ void TimerManager::MainLoop() {
grpc_core::Timestamp next = grpc_core::Timestamp::InfFuture();
absl::optional<std::vector<experimental::EventEngine::Closure*>>
check_result = timer_list_->TimerCheck(&next);
GPR_ASSERT(check_result.has_value() &&
"ERROR: More than one MainLoop is running.");
CHECK(check_result.has_value())
<< "ERROR: More than one MainLoop is running.";
bool timers_found = !check_result->empty();
if (timers_found) {
RunSomeTimers(std::move(*check_result));
@ -145,7 +146,7 @@ void TimerManager::Kick() {
void TimerManager::RestartPostFork() {
grpc_core::MutexLock lock(&mu_);
GPR_ASSERT(GPR_LIKELY(shutdown_));
CHECK(GPR_LIKELY(shutdown_));
if (grpc_event_engine_timer_trace.enabled()) {
gpr_log(GPR_DEBUG, "TimerManager::%p restarting after shutdown", this);
}

@ -16,6 +16,8 @@
#include <string.h>
#include "absl/log/check.h"
#include <grpc/event_engine/event_engine.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -30,8 +32,8 @@ namespace experimental {
EventEngine::ResolvedAddress::ResolvedAddress(const sockaddr* address,
socklen_t size)
: size_(size) {
GPR_DEBUG_ASSERT(size >= 0);
GPR_ASSERT(static_cast<size_t>(size) <= sizeof(address_));
DCHECK_GE(size, 0u);
CHECK(static_cast<size_t>(size) <= sizeof(address_));
memcpy(&address_, address, size);
}

@ -19,6 +19,8 @@
#include <string>
#include <utility>
#include "absl/log/check.h"
#include <grpc/event_engine/slice.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
@ -48,7 +50,7 @@ Slice CopyConstructors<Slice>::FromCopiedString(std::string s) {
MutableSlice::MutableSlice(const grpc_slice& slice)
: slice_detail::BaseSlice(slice) {
GPR_DEBUG_ASSERT(slice.refcount == nullptr || slice.refcount->IsUnique());
DCHECK(slice.refcount == nullptr || slice.refcount->IsUnique());
}
MutableSlice::~MutableSlice() { grpc_core::CSliceUnref(c_slice()); }

@ -53,6 +53,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
@ -223,7 +224,7 @@ bool ResolvedAddressIsV4Mapped(
bool ResolvedAddressToV4Mapped(
const EventEngine::ResolvedAddress& resolved_addr,
EventEngine::ResolvedAddress* resolved_addr6_out) {
GPR_ASSERT(&resolved_addr != resolved_addr6_out);
CHECK(&resolved_addr != resolved_addr6_out);
const sockaddr* addr = resolved_addr.address();
sockaddr_in6* addr6_out = const_cast<sockaddr_in6*>(
reinterpret_cast<const sockaddr_in6*>(resolved_addr6_out->address()));
@ -245,7 +246,8 @@ EventEngine::ResolvedAddress ResolvedAddressMakeWild6(int port) {
EventEngine::ResolvedAddress resolved_wild_out;
sockaddr_in6* wild_out = reinterpret_cast<sockaddr_in6*>(
const_cast<sockaddr*>(resolved_wild_out.address()));
GPR_ASSERT(port >= 0 && port < 65536);
CHECK_GE(port, 0);
CHECK_LT(port, 65536);
memset(wild_out, 0, sizeof(sockaddr_in6));
wild_out->sin6_family = AF_INET6;
wild_out->sin6_port = htons(static_cast<uint16_t>(port));
@ -258,7 +260,8 @@ EventEngine::ResolvedAddress ResolvedAddressMakeWild4(int port) {
EventEngine::ResolvedAddress resolved_wild_out;
sockaddr_in* wild_out = reinterpret_cast<sockaddr_in*>(
const_cast<sockaddr*>(resolved_wild_out.address()));
GPR_ASSERT(port >= 0 && port < 65536);
CHECK_GE(port, 0);
CHECK_LT(port, 65536);
memset(wild_out, 0, sizeof(sockaddr_in));
wild_out->sin_family = AF_INET;
wild_out->sin_port = htons(static_cast<uint16_t>(port));
@ -294,12 +297,14 @@ void ResolvedAddressSetPort(EventEngine::ResolvedAddress& resolved_addr,
sockaddr* addr = const_cast<sockaddr*>(resolved_addr.address());
switch (addr->sa_family) {
case AF_INET:
GPR_ASSERT(port >= 0 && port < 65536);
CHECK_GE(port, 0);
CHECK_LT(port, 65536);
(reinterpret_cast<sockaddr_in*>(addr))->sin_port =
htons(static_cast<uint16_t>(port));
return;
case AF_INET6:
GPR_ASSERT(port >= 0 && port < 65536);
CHECK_GE(port, 0);
CHECK_LT(port, 65536);
(reinterpret_cast<sockaddr_in6*>(addr))->sin6_port =
htons(static_cast<uint16_t>(port));
return;
@ -445,7 +450,7 @@ absl::StatusOr<EventEngine::ResolvedAddress> URIToResolvedAddress(
uri.status().ToString().c_str());
}
GRPC_RETURN_IF_ERROR(uri.status());
GPR_ASSERT(grpc_parse_uri(*uri, &addr));
CHECK(grpc_parse_uri(*uri, &addr));
return EventEngine::ResolvedAddress(
reinterpret_cast<const sockaddr*>(addr.addr), addr.len);
}

@ -26,6 +26,7 @@
#include <utility>
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "absl/types/optional.h"
@ -183,7 +184,7 @@ WorkStealingThreadPool::WorkStealingThreadPool(size_t reserve_threads)
void WorkStealingThreadPool::Quiesce() { pool_->Quiesce(); }
WorkStealingThreadPool::~WorkStealingThreadPool() {
GPR_ASSERT(pool_->IsQuiesced());
CHECK(pool_->IsQuiesced());
}
void WorkStealingThreadPool::Run(absl::AnyInvocable<void()> callback) {
@ -237,7 +238,7 @@ void WorkStealingThreadPool::WorkStealingThreadPoolImpl::Start() {
void WorkStealingThreadPool::WorkStealingThreadPoolImpl::Run(
EventEngine::Closure* closure) {
GPR_DEBUG_ASSERT(quiesced_.load(std::memory_order_relaxed) == false);
DCHECK(quiesced_.load(std::memory_order_relaxed) == false);
if (g_local_queue != nullptr && g_local_queue->owner() == this) {
g_local_queue->Add(closure);
} else {
@ -280,7 +281,7 @@ void WorkStealingThreadPool::WorkStealingThreadPoolImpl::Quiesce() {
if (!threads_were_shut_down.ok() && g_log_verbose_failures) {
DumpStacksAndCrash();
}
GPR_ASSERT(queue_.Empty());
CHECK(queue_.Empty());
quiesced_.store(true, std::memory_order_relaxed);
lifeguard_.BlockUntilShutdownAndReset();
}
@ -293,14 +294,14 @@ bool WorkStealingThreadPool::WorkStealingThreadPoolImpl::SetThrottled(
void WorkStealingThreadPool::WorkStealingThreadPoolImpl::SetShutdown(
bool is_shutdown) {
auto was_shutdown = shutdown_.exchange(is_shutdown);
GPR_ASSERT(is_shutdown != was_shutdown);
CHECK(is_shutdown != was_shutdown);
work_signal_.SignalAll();
}
void WorkStealingThreadPool::WorkStealingThreadPoolImpl::SetForking(
bool is_forking) {
auto was_forking = forking_.exchange(is_forking);
GPR_ASSERT(is_forking != was_forking);
CHECK(is_forking != was_forking);
}
bool WorkStealingThreadPool::WorkStealingThreadPoolImpl::IsForking() {
@ -507,7 +508,7 @@ void WorkStealingThreadPool::ThreadState::ThreadBody() {
} else if (pool_->IsShutdown()) {
FinishDraining();
}
GPR_ASSERT(g_local_queue->Empty());
CHECK(g_local_queue->Empty());
pool_->theft_registry()->Unenroll(g_local_queue);
delete g_local_queue;
if (g_log_verbose_failures) {

@ -23,6 +23,7 @@
#include <ares.h>
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
@ -132,8 +133,8 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
shutdown_called_);
grpc_core::CSliceUnref(read_buf_);
grpc_core::CSliceUnref(write_buf_);
GPR_ASSERT(read_closure_ == nullptr);
GPR_ASSERT(write_closure_ == nullptr);
CHECK(read_closure_ == nullptr);
CHECK(write_closure_ == nullptr);
if (!shutdown_called_) {
winsocket_->Shutdown(DEBUG_LOCATION, "~GrpcPolledFdWindows");
}
@ -141,15 +142,15 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
void RegisterForOnReadableLocked(
absl::AnyInvocable<void(absl::Status)> read_closure) override {
GPR_ASSERT(read_closure_ == nullptr);
CHECK(read_closure_ == nullptr);
read_closure_ = std::move(read_closure);
grpc_core::CSliceUnref(read_buf_);
GPR_ASSERT(!read_buf_has_data_);
CHECK(!read_buf_has_data_);
read_buf_ = GRPC_SLICE_MALLOC(kReadBufferSize);
if (connect_done_) {
ContinueRegisterForOnReadableLocked();
} else {
GPR_ASSERT(pending_continue_register_for_on_readable_locked_ == false);
CHECK(pending_continue_register_for_on_readable_locked_ == false);
pending_continue_register_for_on_readable_locked_ = true;
}
}
@ -160,16 +161,16 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
GRPC_ARES_RESOLVER_TRACE_LOG(
"fd:|%s| RegisterForOnWriteableLocked called", GetName());
} else {
GPR_ASSERT(socket_type_ == SOCK_STREAM);
CHECK(socket_type_ == SOCK_STREAM);
GRPC_ARES_RESOLVER_TRACE_LOG(
"fd:|%s| RegisterForOnWriteableLocked called tcp_write_state_: %d "
"connect_done_: %d",
GetName(), tcp_write_state_, connect_done_);
}
GPR_ASSERT(write_closure_ == nullptr);
CHECK(write_closure_ == nullptr);
write_closure_ = std::move(write_closure);
if (!connect_done_) {
GPR_ASSERT(!pending_continue_register_for_on_writeable_locked_);
CHECK(!pending_continue_register_for_on_writeable_locked_);
pending_continue_register_for_on_writeable_locked_ = true;
} else {
ContinueRegisterForOnWriteableLocked();
@ -179,7 +180,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
bool IsFdStillReadableLocked() override { return read_buf_has_data_; }
bool ShutdownLocked(absl::Status error) override {
GPR_ASSERT(!shutdown_called_);
CHECK(!shutdown_called_);
if (!absl::IsCancelled(error)) {
return false;
}
@ -223,7 +224,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
// c-ares overloads this recv_from virtual socket function to receive
// data on both UDP and TCP sockets, and from is nullptr for TCP.
if (from != nullptr) {
GPR_ASSERT(*from_len <= recv_from_source_addr_len_);
CHECK(*from_len <= recv_from_source_addr_len_);
memcpy(from, &recv_from_source_addr_, recv_from_source_addr_len_);
*from_len = recv_from_source_addr_len_;
}
@ -291,7 +292,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
"fd:|%s| ContinueRegisterForOnReadableLocked "
"wsa_connect_error_:%d",
GetName(), wsa_connect_error_);
GPR_ASSERT(connect_done_);
CHECK(connect_done_);
if (wsa_connect_error_ != 0) {
ScheduleAndNullReadClosure(GRPC_WSA_ERROR(wsa_connect_error_, "connect"));
return;
@ -328,7 +329,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
"fd:|%s| ContinueRegisterForOnWriteableLocked "
"wsa_connect_error_:%d",
GetName(), wsa_connect_error_);
GPR_ASSERT(connect_done_);
CHECK(connect_done_);
if (wsa_connect_error_ != 0) {
ScheduleAndNullWriteClosure(
GRPC_WSA_ERROR(wsa_connect_error_, "connect"));
@ -338,7 +339,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
ScheduleAndNullWriteClosure(absl::OkStatus());
return;
}
GPR_ASSERT(socket_type_ == SOCK_STREAM);
CHECK(socket_type_ == SOCK_STREAM);
int wsa_error_code = 0;
switch (tcp_write_state_) {
case WRITE_IDLE:
@ -386,7 +387,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
// Therefore, the sendv handler for UDP sockets must only attempt
// to write everything inline.
GRPC_ARES_RESOLVER_TRACE_LOG("fd:|%s| SendVUDP called", GetName());
GPR_ASSERT(GRPC_SLICE_LENGTH(write_buf_) == 0);
CHECK_EQ(GRPC_SLICE_LENGTH(write_buf_), 0);
grpc_core::CSliceUnref(write_buf_);
write_buf_ = FlattenIovec(iov, iov_count);
DWORD bytes_sent = 0;
@ -434,12 +435,12 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
// send again. If c-ares still needs to send even more data, we'll get
// to it eventually.
grpc_slice currently_attempted = FlattenIovec(iov, iov_count);
GPR_ASSERT(GRPC_SLICE_LENGTH(currently_attempted) >=
GRPC_SLICE_LENGTH(write_buf_));
CHECK(GRPC_SLICE_LENGTH(currently_attempted) >=
GRPC_SLICE_LENGTH(write_buf_));
ares_ssize_t total_sent = 0;
for (size_t i = 0; i < GRPC_SLICE_LENGTH(write_buf_); i++) {
GPR_ASSERT(GRPC_SLICE_START_PTR(currently_attempted)[i] ==
GRPC_SLICE_START_PTR(write_buf_)[i]);
CHECK(GRPC_SLICE_START_PTR(currently_attempted)[i] ==
GRPC_SLICE_START_PTR(write_buf_)[i]);
total_sent++;
}
grpc_core::CSliceUnref(currently_attempted);
@ -458,9 +459,9 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
" pending_register_for_writeable:%d",
GetName(), pending_continue_register_for_on_readable_locked_,
pending_continue_register_for_on_writeable_locked_);
GPR_ASSERT(!connect_done_);
CHECK(!connect_done_);
connect_done_ = true;
GPR_ASSERT(wsa_connect_error_ == 0);
CHECK_EQ(wsa_connect_error_, 0);
if (shutdown_called_) {
wsa_connect_error_ = WSA_OPERATION_ABORTED;
} else {
@ -469,7 +470,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
BOOL wsa_success = WSAGetOverlappedResult(
winsocket_->raw_socket(), winsocket_->write_info()->overlapped(),
&transferred_bytes, FALSE, &flags);
GPR_ASSERT(transferred_bytes == 0);
CHECK_EQ(transferred_bytes, 0);
if (!wsa_success) {
wsa_connect_error_ = WSAGetLastError();
char* msg = gpr_format_message(wsa_connect_error_);
@ -491,8 +492,8 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
int ConnectUDP(WSAErrorContext* wsa_error_ctx, const struct sockaddr* target,
ares_socklen_t target_len) {
GRPC_ARES_RESOLVER_TRACE_LOG("fd:%s ConnectUDP", GetName());
GPR_ASSERT(!connect_done_);
GPR_ASSERT(wsa_connect_error_ == 0);
CHECK(!connect_done_);
CHECK_EQ(wsa_connect_error_, 0);
SOCKET s = winsocket_->raw_socket();
int out =
WSAConnect(s, target, target_len, nullptr, nullptr, nullptr, nullptr);
@ -620,7 +621,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
void OnIocpWriteable() {
grpc_core::MutexLock lock(mu_);
GRPC_ARES_RESOLVER_TRACE_LOG("OnIocpWriteableInner. fd:|%s|", GetName());
GPR_ASSERT(socket_type_ == SOCK_STREAM);
CHECK(socket_type_ == SOCK_STREAM);
absl::Status error;
if (winsocket_->write_info()->result().wsa_error != 0) {
error = GRPC_WSA_ERROR(winsocket_->write_info()->result().wsa_error,
@ -631,7 +632,7 @@ class GrpcPolledFdWindows : public GrpcPolledFd {
GetName(), winsocket_->write_info()->result().wsa_error,
grpc_core::StatusToString(error).c_str());
}
GPR_ASSERT(tcp_write_state_ == WRITE_PENDING);
CHECK(tcp_write_state_ == WRITE_PENDING);
if (error.ok()) {
tcp_write_state_ = WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY;
write_buf_ = grpc_slice_sub_no_ref(
@ -712,7 +713,7 @@ class CustomSockFuncs {
GRPC_ARES_RESOLVER_TRACE_LOG(
"fd:|%s| created with params af:%d type:%d protocol:%d",
polled_fd->GetName(), af, type, protocol);
GPR_ASSERT(self->sockets_.insert({s, std::move(polled_fd)}).second);
CHECK(self->sockets_.insert({s, std::move(polled_fd)}).second);
return s;
}
@ -722,7 +723,7 @@ class CustomSockFuncs {
GrpcPolledFdFactoryWindows* self =
static_cast<GrpcPolledFdFactoryWindows*>(user_data);
auto it = self->sockets_.find(as);
GPR_ASSERT(it != self->sockets_.end());
CHECK(it != self->sockets_.end());
return it->second->Connect(&wsa_error_ctx, target, target_len);
}
@ -732,7 +733,7 @@ class CustomSockFuncs {
GrpcPolledFdFactoryWindows* self =
static_cast<GrpcPolledFdFactoryWindows*>(user_data);
auto it = self->sockets_.find(as);
GPR_ASSERT(it != self->sockets_.end());
CHECK(it != self->sockets_.end());
return it->second->SendV(&wsa_error_ctx, iov, iovec_count);
}
@ -743,7 +744,7 @@ class CustomSockFuncs {
GrpcPolledFdFactoryWindows* self =
static_cast<GrpcPolledFdFactoryWindows*>(user_data);
auto it = self->sockets_.find(as);
GPR_ASSERT(it != self->sockets_.end());
CHECK(it != self->sockets_.end());
return it->second->RecvFrom(&wsa_error_ctx, data, data_len, flags, from,
from_len);
}
@ -802,7 +803,7 @@ void GrpcPolledFdFactoryWindows::Initialize(grpc_core::Mutex* mutex,
std::unique_ptr<GrpcPolledFd> GrpcPolledFdFactoryWindows::NewGrpcPolledFdLocked(
ares_socket_t as) {
auto it = sockets_.find(as);
GPR_ASSERT(it != sockets_.end());
CHECK(it != sockets_.end());
return std::make_unique<GrpcPolledFdWrapper>(it->second.get());
}

@ -17,6 +17,7 @@
#include <chrono>
#include "absl/log/check.h"
#include "absl/strings/str_format.h"
#include <grpc/support/alloc.h>
@ -37,7 +38,7 @@ IOCP::IOCP(ThreadPool* thread_pool) noexcept
: thread_pool_(thread_pool),
iocp_handle_(CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr,
(ULONG_PTR) nullptr, 0)) {
GPR_ASSERT(iocp_handle_);
CHECK(iocp_handle_);
WSASocketFlagsInit();
}
@ -54,7 +55,7 @@ std::unique_ptr<WinSocket> IOCP::Watch(SOCKET socket) {
GRPC_WSA_ERROR(WSAGetLastError(), "Unable to add socket to iocp")
.ToString());
}
GPR_ASSERT(ret == iocp_handle_);
CHECK(ret == iocp_handle_);
return wrapped_socket;
}
@ -65,7 +66,7 @@ void IOCP::Shutdown() {
while (outstanding_kicks_.load() > 0) {
Work(std::chrono::hours(42), []() {});
}
GPR_ASSERT(CloseHandle(iocp_handle_));
CHECK(CloseHandle(iocp_handle_));
}
Poller::WorkResult IOCP::Work(EventEngine::Duration timeout,
@ -81,7 +82,8 @@ Poller::WorkResult IOCP::Work(EventEngine::Duration timeout,
GRPC_EVENT_ENGINE_POLLER_TRACE("IOCP::%p deadline exceeded", this);
return Poller::WorkResult::kDeadlineExceeded;
}
GPR_ASSERT(completion_key && overlapped);
CHECK(completion_key);
CHECK(overlapped);
if (overlapped == &kick_overlap_) {
GRPC_EVENT_ENGINE_POLLER_TRACE("IOCP::%p kicked", this);
outstanding_kicks_.fetch_sub(1);
@ -100,7 +102,7 @@ Poller::WorkResult IOCP::Work(EventEngine::Duration timeout,
// about to register for notification of an overlapped event.
auto* socket = reinterpret_cast<WinSocket*>(completion_key);
WinSocket::OpState* info = socket->GetOpInfoForOverlapped(overlapped);
GPR_ASSERT(info != nullptr);
CHECK_NE(info, nullptr);
info->GetOverlappedResult();
info->SetReady();
schedule_poll_again();
@ -109,9 +111,9 @@ Poller::WorkResult IOCP::Work(EventEngine::Duration timeout,
void IOCP::Kick() {
outstanding_kicks_.fetch_add(1);
GPR_ASSERT(PostQueuedCompletionStatus(
iocp_handle_, 0, reinterpret_cast<ULONG_PTR>(&kick_token_),
&kick_overlap_));
CHECK(PostQueuedCompletionStatus(iocp_handle_, 0,
reinterpret_cast<ULONG_PTR>(&kick_token_),
&kick_overlap_));
}
DWORD IOCP::GetDefaultSocketFlags() {

@ -14,6 +14,8 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WINDOWS
#include "absl/log/check.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log_windows.h>
@ -45,7 +47,7 @@ WinSocket::WinSocket(SOCKET socket, ThreadPool* thread_pool) noexcept
write_info_(this) {}
WinSocket::~WinSocket() {
GPR_ASSERT(is_shutdown_.load());
CHECK(is_shutdown_.load());
GRPC_EVENT_ENGINE_ENDPOINT_TRACE("WinSocket::%p destroyed", this);
}
@ -94,7 +96,7 @@ void WinSocket::NotifyOnReady(OpState& info, EventEngine::Closure* closure) {
return;
};
// It is an error if any notification is already registered for this socket.
GPR_ASSERT(std::exchange(info.closure_, closure) == nullptr);
CHECK_EQ(std::exchange(info.closure_, closure), nullptr);
}
void WinSocket::NotifyOnRead(EventEngine::Closure* on_read) {
@ -106,11 +108,11 @@ void WinSocket::NotifyOnWrite(EventEngine::Closure* on_write) {
}
void WinSocket::UnregisterReadCallback() {
GPR_ASSERT(std::exchange(read_info_.closure_, nullptr) != nullptr);
CHECK_NE(std::exchange(read_info_.closure_, nullptr), nullptr);
}
void WinSocket::UnregisterWriteCallback() {
GPR_ASSERT(std::exchange(write_info_.closure_, nullptr) != nullptr);
CHECK_NE(std::exchange(write_info_.closure_, nullptr), nullptr);
}
// ---- WinSocket::OpState ----
@ -124,7 +126,7 @@ void WinSocket::OpState::SetReady() {
auto* closure = std::exchange(closure_, nullptr);
// If an IOCP event is returned for a socket, and no callback has been
// registered for notification, this is invalid usage.
GPR_ASSERT(closure != nullptr);
CHECK_NE(closure, nullptr);
win_socket_->thread_pool_->Run(closure);
}

@ -17,6 +17,7 @@
#include "absl/cleanup/cleanup.h"
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
@ -85,7 +86,7 @@ void WindowsEndpoint::AsyncIOState::DoTcpRead(SliceBuffer* buffer) {
return;
}
// Prepare the WSABUF struct
GPR_ASSERT(buffer->Count() <= kMaxWSABUFCount);
CHECK(buffer->Count() <= kMaxWSABUFCount);
WSABUF wsa_buffers[kMaxWSABUFCount];
for (size_t i = 0; i < buffer->Count(); i++) {
auto& slice = buffer->MutableSliceAt(i);
@ -164,11 +165,11 @@ bool WindowsEndpoint::Write(absl::AnyInvocable<void(absl::Status)> on_writable,
peer_address_string_.c_str(), str.length(), str.data());
}
}
GPR_ASSERT(data->Count() <= UINT_MAX);
CHECK(data->Count() <= UINT_MAX);
absl::InlinedVector<WSABUF, kMaxWSABUFCount> buffers(data->Count());
for (size_t i = 0; i < data->Count(); i++) {
auto& slice = data->MutableSliceAt(i);
GPR_ASSERT(slice.size() <= ULONG_MAX);
CHECK(slice.size() <= ULONG_MAX);
buffers[i].len = slice.size();
buffers[i].buf = (char*)slice.begin();
}
@ -305,8 +306,8 @@ void WindowsEndpoint::HandleReadClosure::Run() {
buffer_->Swap(last_read_buffer_);
return ResetAndReturnCallback()(status);
}
GPR_DEBUG_ASSERT(result.bytes_transferred > 0);
GPR_DEBUG_ASSERT(result.bytes_transferred <= buffer_->Length());
DCHECK_GT(result.bytes_transferred, 0);
DCHECK(result.bytes_transferred <= buffer_->Length());
buffer_->MoveFirstNBytesIntoSliceBuffer(result.bytes_transferred,
last_read_buffer_);
if (buffer_->Length() == 0) {
@ -332,9 +333,9 @@ bool WindowsEndpoint::HandleReadClosure::MaybeFinishIfDataHasAlreadyBeenRead() {
void WindowsEndpoint::HandleReadClosure::DonateSpareSlices(
SliceBuffer* buffer) {
// Donee buffer must be empty.
GPR_ASSERT(buffer->Length() == 0);
CHECK_EQ(buffer->Length(), 0);
// HandleReadClosure must be in the reset state.
GPR_ASSERT(buffer_ == nullptr);
CHECK_EQ(buffer_, nullptr);
buffer->Swap(last_read_buffer_);
}
@ -352,7 +353,7 @@ void WindowsEndpoint::HandleWriteClosure::Run() {
if (result.wsa_error != 0) {
status = GRPC_WSA_ERROR(result.wsa_error, "WSASend");
} else {
GPR_ASSERT(result.bytes_transferred == buffer_->Length());
CHECK(result.bytes_transferred == buffer_->Length());
}
return ResetAndReturnCallback()(status);
}

@ -17,6 +17,7 @@
#include <memory>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
@ -114,7 +115,7 @@ WindowsEventEngine::WindowsEventEngine()
iocp_worker_(thread_pool_.get(), &iocp_) {
WSADATA wsaData;
int status = WSAStartup(MAKEWORD(2, 0), &wsaData);
GPR_ASSERT(status == 0);
CHECK_EQ(status, 0);
}
WindowsEventEngine::~WindowsEventEngine() {
@ -143,13 +144,13 @@ WindowsEventEngine::~WindowsEventEngine() {
task_mu_.Lock();
}
}
GPR_ASSERT(GPR_LIKELY(known_handles_.empty()));
CHECK(GPR_LIKELY(known_handles_.empty()));
task_mu_.Unlock();
}
iocp_.Kick();
iocp_worker_.WaitForShutdown();
iocp_.Shutdown();
GPR_ASSERT(WSACleanup() == 0);
CHECK_EQ(WSACleanup(), 0);
timer_manager_.Shutdown();
thread_pool_->Quiesce();
}
@ -369,7 +370,7 @@ EventEngine::ConnectionHandle WindowsEventEngine::Connect(
auto connection_state = std::make_shared<ConnectionState>();
grpc_core::MutexLock lock(&connection_state->mu);
connection_state->socket = iocp_.Watch(sock);
GPR_ASSERT(connection_state->socket != nullptr);
CHECK_NE(connection_state->socket, nullptr);
auto* info = connection_state->socket->write_info();
connection_state->address = address;
connection_state->allocator = std::move(memory_allocator);
@ -455,8 +456,8 @@ bool WindowsEventEngine::CancelConnectFromDeadlineTimer(
// Erase the connection handle, which is guaranteed to exist.
{
grpc_core::MutexLock lock(&connection_mu_);
GPR_ASSERT(known_connection_handles_.erase(
connection_state->connection_handle) == 1);
CHECK(known_connection_handles_.erase(
connection_state->connection_handle) == 1);
}
return CancelConnectInternalStateLocked(connection_state);
}

@ -15,6 +15,7 @@
#ifdef GPR_WINDOWS
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
@ -47,7 +48,7 @@ WindowsEventEngineListener::SinglePortSocketListener::AsyncIOState::
void WindowsEventEngineListener::SinglePortSocketListener::
OnAcceptCallbackWrapper::Run() {
GPR_ASSERT(io_state_ != nullptr);
CHECK_NE(io_state_, nullptr);
grpc_core::ReleasableMutexLock lock(&io_state_->mu);
if (io_state_->listener_socket->IsShutdown()) {
GRPC_EVENT_ENGINE_TRACE(
@ -124,7 +125,7 @@ WindowsEventEngineListener::SinglePortSocketListener::Create(
}
auto result = SinglePortSocketListener::PrepareListenerSocket(sock, addr);
GRPC_RETURN_IF_ERROR(result.status());
GPR_ASSERT(result->port >= 0);
CHECK_GE(result->port, 0);
// Using `new` to access non-public constructor
return absl::WrapUnique(new SinglePortSocketListener(
listener, AcceptEx, /*win_socket=*/listener->iocp_->Watch(sock),
@ -190,8 +191,8 @@ void WindowsEventEngineListener::SinglePortSocketListener::
ABSL_EXCLUSIVE_LOCKS_REQUIRED(io_state_->mu) {
if (do_close_socket) closesocket(io_state_->accept_socket);
io_state_->accept_socket = INVALID_SOCKET;
GPR_ASSERT(GRPC_LOG_IF_ERROR("SinglePortSocketListener::Start",
StartLocked()));
CHECK(GRPC_LOG_IF_ERROR("SinglePortSocketListener::Start",
StartLocked()));
};
const auto& overlapped_result =
io_state_->listener_socket->read_info()->result();
@ -265,7 +266,7 @@ absl::StatusOr<WindowsEventEngineListener::SinglePortSocketListener::
WindowsEventEngineListener::SinglePortSocketListener::PrepareListenerSocket(
SOCKET sock, const EventEngine::ResolvedAddress& addr) {
auto fail = [&](absl::Status error) -> absl::Status {
GPR_ASSERT(!error.ok());
CHECK(!error.ok());
auto addr_uri = ResolvedAddressToURI(addr);
error = grpc_error_set_int(
grpc_error_set_str(
@ -374,7 +375,7 @@ absl::StatusOr<int> WindowsEventEngineListener::Bind(
}
absl::Status WindowsEventEngineListener::Start() {
GPR_ASSERT(!started_.exchange(true));
CHECK(!started_.exchange(true));
grpc_core::MutexLock lock(&port_listeners_mu_);
for (auto& port_listener : port_listeners_) {
GRPC_RETURN_IF_ERROR(port_listener->Start());

@ -25,6 +25,7 @@
#include <string>
#include <utility>
#include "absl/log/check.h"
#include "absl/status/status.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
@ -141,7 +142,7 @@ std::string PercentEncode(absl::string_view str,
for (char c : str) {
if (!is_allowed_char(c)) {
std::string hex = absl::BytesToHexString(absl::string_view(&c, 1));
GPR_ASSERT(hex.size() == 2);
CHECK_EQ(hex.size(), 2u);
// BytesToHexString() returns lower case, but
// https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.2.1 says
// to prefer upper-case.

@ -324,7 +324,7 @@ grpc_objc_testing_library(
deps = [
"//:gpr_platform",
"//src/core:iomgr_port",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -35,7 +35,7 @@
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/resource_quota/api.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static gpr_mu g_mu;
static int g_connections_complete = 0;

@ -37,7 +37,7 @@
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/resource_quota/api.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#include <chrono>
#include <future>

@ -26,7 +26,7 @@
#import <grpc/grpc.h>
#import <grpc/grpc_cronet.h>
#import "test/core/end2end/cq_verifier.h"
#import "test/core/util/port.h"
#import "test/core/test_util/port.h"
#import <grpc/support/alloc.h>
#import <grpc/support/log.h>
@ -37,7 +37,7 @@
#import "src/core/lib/gprpp/env.h"
#import "src/core/lib/gprpp/host_port.h"
#import "test/core/end2end/data/ssl_test_data.h"
#import "test/core/util/test_config.h"
#import "test/core/test_util/test_config.h"
#if COCOAPODS
#import <openssl_grpc/ssl.h>

@ -24,7 +24,7 @@
#include "test/core/event_engine/test_suite/event_engine_test_framework.h"
#include "test/core/event_engine/test_suite/posix/oracle_event_engine_posix.h"
#include "test/core/event_engine/test_suite/tests/client_test.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
@interface EventEngineTimerTests : XCTestCase
@end

@ -24,7 +24,7 @@
#include "test/core/event_engine/test_suite/event_engine_test_framework.h"
#include "test/core/event_engine/test_suite/tests/dns_test.h"
#include "test/core/event_engine/test_suite/tests/timer_test.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
@interface EventEngineTimerTests : XCTestCase
@end

@ -53,7 +53,7 @@ pyx_library(
],
)
# Since `opentelemetry-sdk` and `opentelemetry-api` are non-hermetic,
# Since `opentelemetry-api` is non-hermetic,
# pyobservability is for internal use only.
py_library(
name = "_opentelemetry_observability",
@ -63,7 +63,6 @@ py_library(
"_open_telemetry_plugin.py",
],
deps = [
requirement("opentelemetry-sdk"),
requirement("opentelemetry-api"),
],
)

@ -290,7 +290,7 @@ setuptools.setup(
install_requires=[
"grpcio=={version}".format(version=grpc_version.VERSION),
"setuptools>=59.6.0",
"opentelemetry-api==1.21.0",
"opentelemetry-api>=1.21.0",
],
cmdclass={
"build_ext": BuildExt,

@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"])
py_library(
@ -34,6 +37,7 @@ py_test(
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_observability/grpc_observability:pyobservability",
"//src/python/grpcio_tests/tests/testing",
requirement("opentelemetry-sdk"),
],
)

@ -13,8 +13,10 @@
# limitations under the License.
"""Common code used throughout tests of gRPC."""
import ast
import collections
from concurrent import futures
import os
import threading
import grpc
@ -110,9 +112,12 @@ def test_server(max_workers=10, reuse_port=False):
These servers have SO_REUSEPORT disabled to prevent cross-talk.
"""
server_kwargs = os.environ.get("GRPC_ADDITIONAL_SERVER_KWARGS", "{}")
server_kwargs = ast.literal_eval(server_kwargs)
return grpc.server(
futures.ThreadPoolExecutor(max_workers=max_workers),
options=(("grpc.so_reuseport", int(reuse_port)),),
**server_kwargs,
)

@ -13,7 +13,7 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
load("//test/core/test_util:grpc_fuzzer.bzl", "grpc_fuzzer")
licenses(["notice"])
@ -33,7 +33,7 @@ grpc_cc_test(
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -48,7 +48,7 @@ grpc_cc_test(
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -62,7 +62,7 @@ grpc_fuzzer(
uses_polling = False,
deps = [
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -77,6 +77,6 @@ grpc_cc_test(
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -45,7 +45,7 @@
#include "src/core/lib/iomgr/port.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#ifdef GRPC_HAVE_UNIX_SOCKET

@ -43,7 +43,7 @@
#include "src/core/lib/iomgr/resolved_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/uri/uri_parser.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static void test_grpc_parse_ipv6_parity_with_getaddrinfo(
const char* target, const struct sockaddr_in6 result_from_getaddrinfo) {

@ -49,7 +49,7 @@
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace {

@ -13,7 +13,7 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
load("//test/core/test_util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
licenses(["notice"])
@ -42,6 +42,6 @@ grpc_proto_fuzzer(
uses_polling = False,
deps = [
"//src/core:avl",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -35,7 +35,7 @@ grpc_cc_test(
"//:exec_ctx",
"//:grpc",
"//src/core:time",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -27,7 +27,7 @@
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc {
namespace testing {

@ -46,7 +46,7 @@
#include "src/core/lib/surface/server.h"
#include "src/core/lib/transport/transport.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define MIN_HTTP2_FRAME_SIZE 9

@ -45,7 +45,7 @@ def grpc_bad_client_tests():
language = "C++",
testonly = 1,
deps = [
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
"//:grpc",
"//:gpr",
"//test/core/end2end:cq_verifier",

@ -27,7 +27,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define HEADER_FRAME_ID_1 \
"\x00\x00\xc9\x01\x05\x00\x00\x00\x01" /* headers: generated from \

@ -23,7 +23,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \

@ -23,7 +23,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {

@ -28,7 +28,7 @@
#include "src/core/lib/gprpp/time.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \

@ -31,7 +31,7 @@
#include "test/core/bad_client/bad_client.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static const char prefix[] =
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"

@ -22,7 +22,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \

@ -26,7 +26,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
#define ONE_SETTING_HDR "\x00\x00\x06\x04\x00\x00\x00\x00\x00"

@ -27,7 +27,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define APPEND_BUFFER(string, to_append) \
((string).append((to_append), sizeof(to_append) - 1))

@ -26,7 +26,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \

@ -21,7 +21,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \

@ -27,7 +27,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {

@ -25,7 +25,7 @@
#include "src/core/lib/surface/server.h"
#include "test/core/bad_client/bad_client.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#define PFX_STR \
"\x00\x00\x00\x04\x01\x00\x00\x00\x00" \

@ -31,6 +31,6 @@ grpc_cc_binary(
"//:grpc",
"//:server",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -61,7 +61,7 @@
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/server.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }

@ -39,8 +39,8 @@
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/host_port.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/port.h"
#include "test/core/test_util/test_config.h"
static void run_test(const char* target, size_t nops) {
grpc_channel_credentials* ssl_creds =

@ -37,8 +37,8 @@ def grpc_bad_ssl_tests():
"absl/log:check",
],
deps = [
"//test/core/util:grpc_test_util",
"//test/core/util:grpc_test_util_base",
"//test/core/test_util:grpc_test_util",
"//test/core/test_util:grpc_test_util_base",
"//:grpc",
],
)
@ -63,8 +63,8 @@ def grpc_bad_ssl_tests():
"//src/core/tsi/test_creds:server1.pem",
],
deps = [
"//test/core/util:grpc_test_util",
"//test/core/util:grpc_test_util_base",
"//test/core/test_util:grpc_test_util",
"//test/core/test_util:grpc_test_util_base",
"//:gpr",
"//:grpc",
"//:subprocess",

@ -25,8 +25,8 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "test/core/util/cmdline.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/cmdline.h"
#include "test/core/test_util/test_config.h"
// Common server implementation details for all servers in servers/.
// There's nothing *wrong* with these servers per-se, but they are

@ -31,7 +31,7 @@
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/error.h"
#include "test/core/bad_ssl/server_common.h"
#include "test/core/util/tls_utils.h"
#include "test/core/test_util/tls_utils.h"
#define CA_CERT_PATH "src/core/tsi/test_creds/ca.pem"
#define SERVER_CERT_PATH "src/core/tsi/test_creds/server1.pem"

@ -26,7 +26,7 @@
#include "src/core/lib/iomgr/error.h"
#include "test/core/bad_ssl/server_common.h"
#include "test/core/util/tls_utils.h"
#include "test/core/test_util/tls_utils.h"
// This server will present an untrusted cert to the connecting client,
// causing the SSL handshake to fail

@ -27,8 +27,8 @@ grpc_cc_test(
uses_polling = False,
deps = [
"//:grpc",
"//test/core/util:fake_stats_plugin",
"//test/core/util:grpc_test_util",
"//test/core/test_util:fake_stats_plugin",
"//test/core/test_util:grpc_test_util",
],
)
@ -46,7 +46,7 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -61,7 +61,7 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -77,7 +77,7 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//src/core:closure",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -95,7 +95,7 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -110,7 +110,7 @@ grpc_cc_test(
uses_polling = False,
deps = [
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -125,7 +125,7 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//test/core/promise:test_context",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -141,7 +141,7 @@ grpc_cc_test(
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -156,7 +156,7 @@ grpc_cc_test(
uses_polling = False,
deps = [
"//src/core:metrics",
"//test/core/util:fake_stats_plugin",
"//test/core/util:grpc_test_util",
"//test/core/test_util:fake_stats_plugin",
"//test/core/test_util:grpc_test_util",
],
)

@ -29,8 +29,8 @@
#include "src/core/lib/promise/context.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/util/fake_stats_plugin.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/fake_stats_plugin.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace {

@ -35,7 +35,7 @@
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {

@ -31,7 +31,7 @@
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace testing {

@ -29,7 +29,7 @@
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
static grpc_error_handle channel_init_func(grpc_channel_element* elem,
grpc_channel_element_args* args) {

@ -23,8 +23,8 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "test/core/util/fake_stats_plugin.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/fake_stats_plugin.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace {

@ -54,7 +54,7 @@
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/transport.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace {
class FakeTransport final : public grpc_core::Transport {

@ -30,7 +30,7 @@ grpc_cc_test(
"//:grpc",
"//:grpc++",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
"//test/cpp/util:channel_trace_proto_helper",
],
)
@ -48,7 +48,7 @@ grpc_cc_test(
"//:grpc++",
"//src/core:channel_args",
"//test/core/event_engine:event_engine_test_utils",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
"//test/cpp/util:channel_trace_proto_helper",
],
)
@ -66,6 +66,6 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//:grpc++",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -36,7 +36,7 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_writer.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#include "test/cpp/util/channel_trace_proto_helper.h"
namespace grpc_core {

@ -26,7 +26,7 @@
#include "gtest/gtest.h"
#include "src/core/channelz/channelz.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace channelz {

@ -50,7 +50,7 @@
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
#include "test/core/event_engine/event_engine_test_utils.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
#include "test/cpp/util/channel_trace_proto_helper.h"
using grpc_event_engine::experimental::GetDefaultEventEngine;

@ -29,7 +29,7 @@ grpc_cc_test(
"//:grpc_client_channel",
"//src/core:channel_args",
"//src/core:subchannel_pool_interface",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -45,7 +45,7 @@ grpc_cc_test(
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -62,7 +62,7 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)
@ -79,6 +79,6 @@ grpc_cc_test(
"//:gpr",
"//:grpc",
"//src/core:channel_args",
"//test/core/util:grpc_test_util",
"//test/core/test_util:grpc_test_util",
],
)

@ -29,7 +29,7 @@
#include "src/core/service_config/service_config.h"
#include "src/core/service_config/service_config_impl.h"
#include "src/core/service_config/service_config_parser.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace testing {

@ -26,7 +26,7 @@
#include "src/core/client_channel/subchannel_pool_interface.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace testing {

@ -32,7 +32,7 @@
#include "src/core/service_config/service_config.h"
#include "src/core/service_config/service_config_impl.h"
#include "src/core/service_config/service_config_parser.h"
#include "test/core/util/test_config.h"
#include "test/core/test_util/test_config.h"
namespace grpc_core {
namespace testing {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save