Merge branch 'master' into work_serializer_dispatch_extend

pull/37883/head
Yousuk Seung 2 months ago
commit 04c4602b73
  1. 13
      bazel/experiments.bzl
  2. 6
      bazel/grpc_python_deps.bzl
  3. 2
      build_autogenerated.yaml
  4. 2
      examples/cpp/unix_abstract_sockets/README.md
  5. 2
      examples/cpp/xds/README.md
  6. 4
      examples/cpp/xds/xds_greeter_client.cc
  7. 5
      src/core/BUILD
  8. 84
      src/core/ext/transport/chaotic_good/server_transport.cc
  9. 5
      src/core/ext/transport/chaotic_good/server_transport.h
  10. 87
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  11. 3
      src/core/lib/event_engine/resolved_address.cc
  12. 16
      src/core/lib/event_engine/utils.cc
  13. 7
      src/core/lib/event_engine/utils.h
  14. 29
      src/core/lib/experiments/experiments.cc
  15. 11
      src/core/lib/experiments/experiments.h
  16. 8
      src/core/lib/experiments/experiments.yaml
  17. 2
      src/core/lib/experiments/rollouts.yaml
  18. 22
      src/core/lib/transport/call_filters.h
  19. 103
      src/core/server/server.cc
  20. 2
      src/cpp/README.md
  21. 2
      src/cpp/ext/filters/census/server_call_tracer.cc
  22. 2
      src/cpp/ext/gcp/observability_config.cc
  23. 2
      src/cpp/server/server_cc.cc
  24. 6
      src/cpp/thread_manager/thread_manager.h
  25. 2
      templates/test/cpp/naming/resolver_component_tests_defs.include
  26. 6
      test/core/end2end/BUILD
  27. 4
      test/core/end2end/grpc_core_end2end_test.bzl
  28. 2
      test/cpp/README-iOS.md
  29. 2
      test/cpp/cocoapods/Podfile
  30. 4
      test/cpp/end2end/async_end2end_test.cc
  31. 2
      test/cpp/end2end/cfstream_test.cc
  32. 2
      test/cpp/end2end/channelz_service_test.cc
  33. 2
      test/cpp/end2end/client_callback_end2end_test.cc
  34. 2
      test/cpp/end2end/client_lb_end2end_test.cc
  35. 2
      test/cpp/end2end/end2end_test.cc
  36. 2
      test/cpp/end2end/proto_server_reflection_test.cc
  37. 4
      test/cpp/end2end/xds/xds_outlier_detection_end2end_test.cc
  38. 12
      test/cpp/end2end/xds/xds_server.h
  39. 2
      test/cpp/interop/interop_client.h
  40. 4
      test/cpp/interop/istio_echo_server.cc
  41. 2
      test/cpp/interop/metrics_client.cc
  42. 2
      test/cpp/microbenchmarks/bm_event_engine_run.cc
  43. 6
      test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h
  44. 2
      test/cpp/naming/resolver_component_tests_runner.py
  45. 2
      test/cpp/naming/resolver_component_tests_runner_invoker.cc
  46. 2
      test/cpp/naming/utils/dns_server.py
  47. 2
      test/cpp/naming/utils/health_check.py
  48. 5
      test/cpp/qps/qps_json_driver.cc
  49. 8
      test/cpp/server/load_reporter/load_data_store_test.cc
  50. 4
      test/cpp/util/cli_call.h
  51. 2
      test/distrib/cpp/run_distrib_test_cmake.bat
  52. 2
      test/distrib/cpp/run_distrib_test_cmake_for_dll.bat
  53. 40
      tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh
  54. 48
      tools/run_tests/generated/tests.json

@ -23,6 +23,7 @@ EXPERIMENT_ENABLES = {
"event_engine_application_callbacks": "event_engine_application_callbacks",
"event_engine_client": "event_engine_client",
"event_engine_dns": "event_engine_dns",
"event_engine_dns_non_client_channel": "event_engine_dns_non_client_channel",
"event_engine_listener": "event_engine_listener",
"free_large_allocator": "free_large_allocator",
"local_connector_secure": "local_connector_secure",
@ -44,6 +45,7 @@ EXPERIMENT_ENABLES = {
EXPERIMENT_POLLERS = [
"event_engine_client",
"event_engine_dns",
"event_engine_dns_non_client_channel",
"event_engine_listener",
]
@ -53,6 +55,7 @@ EXPERIMENTS = {
},
"off": {
"core_end2end_test": [
"event_engine_dns_non_client_channel",
"local_connector_secure",
],
"endpoint_test": [
@ -102,6 +105,7 @@ EXPERIMENTS = {
},
"off": {
"core_end2end_test": [
"event_engine_dns_non_client_channel",
"local_connector_secure",
],
"endpoint_test": [
@ -135,16 +139,13 @@ EXPERIMENTS = {
},
"off": {
"core_end2end_test": [
"event_engine_client",
"event_engine_dns_non_client_channel",
"local_connector_secure",
],
"endpoint_test": [
"tcp_frame_size_tuning",
"tcp_rcv_lowat",
],
"event_engine_client_test": [
"event_engine_client",
],
"flow_control_test": [
"multiping",
"tcp_frame_size_tuning",
@ -160,6 +161,7 @@ EXPERIMENTS = {
"event_engine_dns",
],
"core_end2end_test": [
"event_engine_client",
"event_engine_listener",
"work_serializer_dispatch",
],
@ -169,6 +171,9 @@ EXPERIMENTS = {
"cpp_lb_end2end_test": [
"pick_first_new",
],
"event_engine_client_test": [
"event_engine_client",
],
"event_engine_listener_test": [
"event_engine_listener",
],

@ -38,9 +38,9 @@ def grpc_python_deps():
http_archive(
name = "cython",
build_file = "@com_github_grpc_grpc//third_party:cython.BUILD",
sha256 = "2ec7d66d23d6da2328fb24f5c1bec6c63a59ec2e91027766ab904f417e1078aa",
strip_prefix = "cython-3.0.11",
sha256 = "a2da56cc22be823acf49741b9aa3aa116d4f07fa8e8b35a3cb08b8447b37c607",
strip_prefix = "cython-0.29.35",
urls = [
"https://github.com/cython/cython/archive/3.0.11.tar.gz",
"https://github.com/cython/cython/archive/0.29.35.tar.gz",
],
)

@ -7481,6 +7481,7 @@ targets:
- name: cancel_after_invoke_test
gtest: true
build: test
run: false
language: c++
headers:
- src/core/ext/transport/chaotic_good/chaotic_good_transport.h
@ -7858,6 +7859,7 @@ targets:
- name: cancel_with_status_test
gtest: true
build: test
run: false
language: c++
headers:
- src/core/ext/transport/chaotic_good/chaotic_good_transport.h

@ -3,7 +3,7 @@ gRPC Unix Abstract Socket Example
This example shows how to use gRPC with Unix domain sockets in the abstract namespace.
gRPC uses the [`unix-abstract:abstract_path`](https://github.com/grpc/grpc/blob/c6844099218b147b0e374843e0a26745adc61ddb/doc/naming.md?plain=1#L44-L50) URI scheme to support this.
In this example, an socket with an embedded null character `grpc%00abstract` is created.
In this example, a socket with an embedded null character `grpc%00abstract` is created.
## Build and run the example

@ -6,7 +6,7 @@ This xDS example builds on the [Hello World Example](https://github.com/grpc/grp
The client takes two command-line arguments -
* target - By default, the client tries to connect to the xDS "xds:///helloworld:50051" and gRPC would use xDS to resolve this target and connect to the server backend. This can be overridden to change the target.
* secure - Bool value, defaults to true. When this is set, [XdsCredentials](https://github.com/grpc/proposal/blob/master/A29-xds-tls-security.md) will be used with a fallback on `InsecureChannelCredentials`. If unset, `InsecureChannelCredentials` will be used.
* xds-creds - Bool value, defaults to true. When this is set, [XdsCredentials](https://github.com/grpc/proposal/blob/master/A29-xds-tls-security.md) will be used with a fallback on `InsecureChannelCredentials`. If unset, `InsecureChannelCredentials` will be used.
The server takes three command-line arguments -
* port - Port on which the Hello World service is run. Defaults to 50051.

@ -34,7 +34,7 @@
#endif
ABSL_FLAG(std::string, target, "xds:///helloworld:50051", "Target string");
ABSL_FLAG(bool, secure, true, "Secure mode");
ABSL_FLAG(bool, xds_creds, true, "Secure mode");
using grpc::Channel;
using grpc::ClientContext;
@ -98,7 +98,7 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
GreeterClient greeter(grpc::CreateChannel(
absl::GetFlag(FLAGS_target),
absl::GetFlag(FLAGS_secure)
absl::GetFlag(FLAGS_xds_creds)
? grpc::XdsCredentials(grpc::InsecureChannelCredentials())
: grpc::InsecureChannelCredentials()));
std::string user("world");

@ -2371,9 +2371,11 @@ grpc_cc_library(
hdrs = ["lib/event_engine/utils.h"],
external_deps = [
"absl/log:check",
"absl/status:statusor",
"absl/strings",
],
deps = [
"notification",
"time",
"//:event_engine_base_hdrs",
"//:gpr_platform",
@ -7647,8 +7649,11 @@ grpc_cc_library(
"connection_quota",
"error",
"error_utils",
"event_engine_common",
"event_engine_extensions",
"event_engine_query_extensions",
"event_engine_tcp_socket_utils",
"event_engine_utils",
"grpc_insecure_credentials",
"handshaker_registry",
"iomgr_fwd",

@ -125,13 +125,14 @@ auto ChaoticGoodServerTransport::MaybePushFragmentIntoCall(
}
auto ChaoticGoodServerTransport::SendFragment(
ServerFragmentFrame frame, MpscSender<ServerFrame> outgoing_frames) {
ServerFragmentFrame frame, MpscSender<ServerFrame> outgoing_frames,
CallInitiator call_initiator) {
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD: SendFragment: frame=" << frame.ToString();
// Capture the call_initiator to ensure the underlying call spine is alive
// until the outgoing_frames.Send promise completes.
return Map(outgoing_frames.Send(std::move(frame)),
[](bool success) -> absl::Status {
[call_initiator](bool success) -> absl::Status {
if (!success) {
// Failed to send outgoing frame.
return absl::UnavailableError("Transport closed.");
@ -145,26 +146,27 @@ auto ChaoticGoodServerTransport::SendCallBody(
CallInitiator call_initiator) {
// Continuously send client frame with client to server
// messages.
return ForEach(OutgoingMessages(call_initiator),
// Capture the call_initator to ensure the underlying call
// spine is alive until the SendFragment promise completes.
[stream_id, outgoing_frames, aligned_bytes = aligned_bytes_](
MessageHandle message) mutable {
ServerFragmentFrame frame;
// Construct frame header (flags, header_length
// and trailer_length will be added in
// serialization).
const uint32_t message_length = message->payload()->Length();
const uint32_t padding =
message_length % aligned_bytes == 0
? 0
: aligned_bytes - (message_length % aligned_bytes);
CHECK_EQ((message_length + padding) % aligned_bytes, 0u);
frame.message = FragmentMessage(std::move(message), padding,
message_length);
frame.stream_id = stream_id;
return SendFragment(std::move(frame), outgoing_frames);
});
return ForEach(
OutgoingMessages(call_initiator),
// Capture the call_initator to ensure the underlying call
// spine is alive until the SendFragment promise completes.
[stream_id, outgoing_frames, call_initiator,
aligned_bytes = aligned_bytes_](MessageHandle message) mutable {
ServerFragmentFrame frame;
// Construct frame header (flags, header_length
// and trailer_length will be added in
// serialization).
const uint32_t message_length = message->payload()->Length();
const uint32_t padding =
message_length % aligned_bytes == 0
? 0
: aligned_bytes - message_length % aligned_bytes;
CHECK_EQ((message_length + padding) % aligned_bytes, 0u);
frame.message =
FragmentMessage(std::move(message), padding, message_length);
frame.stream_id = stream_id;
return SendFragment(std::move(frame), outgoing_frames, call_initiator);
});
}
auto ChaoticGoodServerTransport::SendCallInitialMetadataAndBody(
@ -185,7 +187,8 @@ auto ChaoticGoodServerTransport::SendCallInitialMetadataAndBody(
frame.headers = std::move(*md);
frame.stream_id = stream_id;
return TrySeq(
SendFragment(std::move(frame), outgoing_frames),
SendFragment(std::move(frame), outgoing_frames,
call_initiator),
SendCallBody(stream_id, outgoing_frames, call_initiator));
},
[]() { return absl::OkStatus(); });
@ -206,11 +209,15 @@ auto ChaoticGoodServerTransport::CallOutboundLoop(
return Empty{};
}),
call_initiator.PullServerTrailingMetadata(),
[stream_id, outgoing_frames](ServerMetadataHandle md) mutable {
// Capture the call_initator to ensure the underlying call_spine
// is alive until the SendFragment promise completes.
[stream_id, outgoing_frames,
call_initiator](ServerMetadataHandle md) mutable {
ServerFragmentFrame frame;
frame.trailers = std::move(md);
frame.stream_id = stream_id;
return SendFragment(std::move(frame), outgoing_frames);
return SendFragment(std::move(frame), outgoing_frames,
call_initiator);
}));
}
@ -302,11 +309,10 @@ auto ChaoticGoodServerTransport::ReadOneFrame(ChaoticGoodTransport& transport) {
call_initiator.has_value(),
[&call_initiator]() {
auto c = std::move(*call_initiator);
return c.SpawnWaitable("cancel_from_read",
[c]() mutable {
c.Cancel();
return absl::OkStatus();
});
return c.SpawnWaitable("cancel", [c]() mutable {
c.Cancel();
return absl::OkStatus();
});
},
[]() -> absl::Status { return absl::OkStatus(); });
}),
@ -391,7 +397,6 @@ void ChaoticGoodServerTransport::AbortWithError() {
// Close all the available pipes.
outgoing_frames_.MarkClosed();
ReleasableMutexLock lock(&mu_);
if (aborted_with_error_) return;
aborted_with_error_ = true;
StreamMap stream_map = std::move(stream_map_);
stream_map_.clear();
@ -401,19 +406,18 @@ void ChaoticGoodServerTransport::AbortWithError() {
lock.Release();
for (const auto& pair : stream_map) {
auto call_initiator = pair.second;
call_initiator.SpawnInfallible("cancel_from_transport_closed",
[call_initiator]() mutable {
call_initiator.Cancel();
return Empty{};
});
call_initiator.SpawnInfallible("cancel", [call_initiator]() mutable {
call_initiator.Cancel();
return Empty{};
});
}
}
absl::optional<CallInitiator> ChaoticGoodServerTransport::LookupStream(
uint32_t stream_id) {
MutexLock lock(&mu_);
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD " << this << " LookupStream " << stream_id;
MutexLock lock(&mu_);
auto it = stream_map_.find(stream_id);
if (it == stream_map_.end()) return absl::nullopt;
return it->second;
@ -421,9 +425,9 @@ absl::optional<CallInitiator> ChaoticGoodServerTransport::LookupStream(
absl::optional<CallInitiator> ChaoticGoodServerTransport::ExtractStream(
uint32_t stream_id) {
MutexLock lock(&mu_);
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD " << this << " ExtractStream " << stream_id;
MutexLock lock(&mu_);
auto it = stream_map_.find(stream_id);
if (it == stream_map_.end()) return absl::nullopt;
auto r = std::move(it->second);
@ -433,9 +437,9 @@ absl::optional<CallInitiator> ChaoticGoodServerTransport::ExtractStream(
absl::Status ChaoticGoodServerTransport::NewStream(
uint32_t stream_id, CallInitiator call_initiator) {
MutexLock lock(&mu_);
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD " << this << " NewStream " << stream_id;
MutexLock lock(&mu_);
if (aborted_with_error_) {
return absl::UnavailableError("Transport closed");
}
@ -454,7 +458,7 @@ absl::Status ChaoticGoodServerTransport::NewStream(
self->ExtractStream(stream_id);
if (call_initiator.has_value()) {
auto c = std::move(*call_initiator);
c.SpawnInfallible("cancel_from_on_done", [c]() mutable {
c.SpawnInfallible("cancel", [c]() mutable {
c.Cancel();
return Empty{};
});

@ -109,7 +109,8 @@ class ChaoticGoodServerTransport final : public ServerTransport {
auto SendCallBody(uint32_t stream_id, MpscSender<ServerFrame> outgoing_frames,
CallInitiator call_initiator);
static auto SendFragment(ServerFragmentFrame frame,
MpscSender<ServerFrame> outgoing_frames);
MpscSender<ServerFrame> outgoing_frames,
CallInitiator call_initiator);
auto CallOutboundLoop(uint32_t stream_id, CallInitiator call_initiator);
auto OnTransportActivityDone(absl::string_view activity);
auto TransportReadLoop(RefCountedPtr<ChaoticGoodTransport> transport);
@ -142,8 +143,8 @@ class ChaoticGoodServerTransport final : public ServerTransport {
Mutex mu_;
// Map of stream incoming server frames, key is stream_id.
StreamMap stream_map_ ABSL_GUARDED_BY(mu_);
uint32_t last_seen_new_stream_id_ = 0;
bool aborted_with_error_ ABSL_GUARDED_BY(mu_) = false;
uint32_t last_seen_new_stream_id_ = 0;
RefCountedPtr<Party> party_;
ConnectivityStateTracker state_tracker_ ABSL_GUARDED_BY(mu_){
"chaotic_good_server", GRPC_CHANNEL_READY};

@ -59,6 +59,9 @@
#include "src/core/lib/event_engine/channel_args_endpoint_config.h"
#include "src/core/lib/event_engine/extensions/supports_fd.h"
#include "src/core/lib/event_engine/query_extensions.h"
#include "src/core/lib/event_engine/resolved_address_internal.h"
#include "src/core/lib/event_engine/tcp_socket_utils.h"
#include "src/core/lib/event_engine/utils.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/event_engine_shims/endpoint.h"
@ -113,7 +116,8 @@ using AcceptorPtr = std::unique_ptr<grpc_tcp_server_acceptor, AcceptorDeleter>;
class Chttp2ServerListener : public Server::ListenerInterface {
public:
static grpc_error_handle Create(Server* server, grpc_resolved_address* addr,
static grpc_error_handle Create(Server* server,
const EventEngine::ResolvedAddress& addr,
const ChannelArgs& args,
Chttp2ServerArgsModifier args_modifier,
int* port_num);
@ -701,8 +705,9 @@ void Chttp2ServerListener::ActiveConnection::OnDrainGraceTimeExpiry() {
//
grpc_error_handle Chttp2ServerListener::Create(
Server* server, grpc_resolved_address* addr, const ChannelArgs& args,
Chttp2ServerArgsModifier args_modifier, int* port_num) {
Server* server, const EventEngine::ResolvedAddress& addr,
const ChannelArgs& args, Chttp2ServerArgsModifier args_modifier,
int* port_num) {
// Create Chttp2ServerListener.
OrphanablePtr<Chttp2ServerListener> listener =
MakeOrphanable<Chttp2ServerListener>(server, args, args_modifier,
@ -714,18 +719,24 @@ grpc_error_handle Chttp2ServerListener::Create(
&listener->tcp_server_shutdown_complete_, ChannelArgsEndpointConfig(args),
OnAccept, listener.get(), &listener->tcp_server_);
if (!error.ok()) return error;
// TODO(yijiem): remove this conversion when we remove all
// grpc_resolved_address usages.
grpc_resolved_address iomgr_addr =
grpc_event_engine::experimental::CreateGRPCResolvedAddress(addr);
if (listener->config_fetcher_ != nullptr) {
listener->resolved_address_ = *addr;
listener->resolved_address_ = iomgr_addr;
// TODO(yashykt): Consider binding so as to be able to return the port
// number.
} else {
error = grpc_tcp_server_add_port(listener->tcp_server_, addr, port_num);
error =
grpc_tcp_server_add_port(listener->tcp_server_, &iomgr_addr, port_num);
if (!error.ok()) return error;
}
// Create channelz node.
if (args.GetBool(GRPC_ARG_ENABLE_CHANNELZ)
.value_or(GRPC_ENABLE_CHANNELZ_DEFAULT)) {
auto string_address = grpc_sockaddr_to_uri(addr);
auto string_address =
grpc_event_engine::experimental::ResolvedAddressToString(addr);
if (!string_address.ok()) {
return GRPC_ERROR_CREATE(string_address.status().ToString());
}
@ -955,37 +966,53 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
args_modifier);
}
*port_num = -1;
absl::StatusOr<std::vector<grpc_resolved_address>> resolved_or;
absl::StatusOr<std::vector<EventEngine::ResolvedAddress>> results =
std::vector<EventEngine::ResolvedAddress>();
std::vector<grpc_error_handle> error_list;
std::string parsed_addr = URI::PercentDecode(addr);
absl::string_view parsed_addr_unprefixed{parsed_addr};
// Using lambda to avoid use of goto.
grpc_error_handle error = [&]() {
grpc_error_handle error;
if (absl::ConsumePrefix(&parsed_addr_unprefixed, kUnixUriPrefix)) {
resolved_or = grpc_resolve_unix_domain_address(parsed_addr_unprefixed);
} else if (absl::ConsumePrefix(&parsed_addr_unprefixed,
kUnixAbstractUriPrefix)) {
resolved_or =
grpc_resolve_unix_abstract_domain_address(parsed_addr_unprefixed);
} else if (absl::ConsumePrefix(&parsed_addr_unprefixed, kVSockUriPrefix)) {
resolved_or = grpc_resolve_vsock_address(parsed_addr_unprefixed);
if (absl::ConsumePrefix(&parsed_addr_unprefixed, kUnixUriPrefix) ||
absl::ConsumePrefix(&parsed_addr_unprefixed, kUnixAbstractUriPrefix) ||
absl::ConsumePrefix(&parsed_addr_unprefixed, kVSockUriPrefix)) {
absl::StatusOr<EventEngine::ResolvedAddress> result =
grpc_event_engine::experimental::URIToResolvedAddress(parsed_addr);
GRPC_RETURN_IF_ERROR(result.status());
results->push_back(*result);
} else {
resolved_or =
GetDNSResolver()->LookupHostnameBlocking(parsed_addr, "https");
}
if (!resolved_or.ok()) {
return absl_status_to_grpc_error(resolved_or.status());
if (IsEventEngineDnsNonClientChannelEnabled()) {
absl::StatusOr<std::unique_ptr<EventEngine::DNSResolver>> ee_resolver =
args.GetObjectRef<EventEngine>()->GetDNSResolver(
EventEngine::DNSResolver::ResolverOptions());
GRPC_RETURN_IF_ERROR(ee_resolver.status());
results = grpc_event_engine::experimental::LookupHostnameBlocking(
ee_resolver->get(), parsed_addr, "https");
} else {
// TODO(yijiem): Remove this after event_engine_dns_non_client_channel
// is fully enabled.
absl::StatusOr<std::vector<grpc_resolved_address>> iomgr_results =
GetDNSResolver()->LookupHostnameBlocking(parsed_addr, "https");
GRPC_RETURN_IF_ERROR(iomgr_results.status());
for (const auto& addr : *iomgr_results) {
results->push_back(
grpc_event_engine::experimental::CreateResolvedAddress(addr));
}
}
}
GRPC_RETURN_IF_ERROR(results.status());
// Create a listener for each resolved address.
for (auto& addr : *resolved_or) {
for (EventEngine::ResolvedAddress& addr : *results) {
// If address has a wildcard port (0), use the same port as a previous
// listener.
if (*port_num != -1 && grpc_sockaddr_get_port(&addr) == 0) {
grpc_sockaddr_set_port(&addr, *port_num);
if (*port_num != -1 &&
grpc_event_engine::experimental::ResolvedAddressGetPort(addr) == 0) {
grpc_event_engine::experimental::ResolvedAddressSetPort(addr,
*port_num);
}
int port_temp = -1;
error = Chttp2ServerListener::Create(server, &addr, args, args_modifier,
error = Chttp2ServerListener::Create(server, addr, args, args_modifier,
&port_temp);
if (!error.ok()) {
error_list.push_back(error);
@ -997,17 +1024,17 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
}
}
}
if (error_list.size() == resolved_or->size()) {
if (error_list.size() == results->size()) {
std::string msg = absl::StrFormat(
"No address added out of total %" PRIuPTR " resolved for '%s'",
resolved_or->size(), addr);
results->size(), addr);
return GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(),
error_list.size());
} else if (!error_list.empty()) {
std::string msg = absl::StrFormat(
"Only %" PRIuPTR " addresses added out of total %" PRIuPTR
" resolved",
resolved_or->size() - error_list.size(), resolved_or->size());
std::string msg =
absl::StrFormat("Only %" PRIuPTR
" addresses added out of total %" PRIuPTR " resolved",
results->size() - error_list.size(), results->size());
error = GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(),
error_list.size());
LOG(INFO) << "WARNING: " << StatusToString(error);

@ -48,6 +48,9 @@ EventEngine::ResolvedAddress CreateResolvedAddress(
grpc_resolved_address CreateGRPCResolvedAddress(
const EventEngine::ResolvedAddress& ra) {
static_assert(
GRPC_MAX_SOCKADDR_SIZE == EventEngine::ResolvedAddress::MAX_SIZE_BYTES,
"size should match");
grpc_resolved_address grpc_addr;
memset(&grpc_addr, 0, sizeof(grpc_resolved_address));
memcpy(grpc_addr.addr, ra.address(), ra.size());

@ -20,6 +20,7 @@
#include <algorithm>
#include "absl/strings/str_cat.h"
#include "src/core/util/notification.h"
#include "src/core/util/time.h"
namespace grpc_event_engine {
@ -38,5 +39,20 @@ grpc_core::Timestamp ToTimestamp(grpc_core::Timestamp now,
grpc_core::Duration::Milliseconds(1);
}
absl::StatusOr<std::vector<EventEngine::ResolvedAddress>>
LookupHostnameBlocking(EventEngine::DNSResolver* dns_resolver,
absl::string_view name, absl::string_view default_port) {
absl::StatusOr<std::vector<EventEngine::ResolvedAddress>> results;
grpc_core::Notification done;
dns_resolver->LookupHostname(
[&](absl::StatusOr<std::vector<EventEngine::ResolvedAddress>> addresses) {
results = std::move(addresses);
done.Notify();
},
name, default_port);
done.WaitForNotification();
return results;
}
} // namespace experimental
} // namespace grpc_event_engine

@ -19,7 +19,10 @@
#include <stdint.h>
#include <string>
#include <vector>
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "src/core/util/time.h"
namespace grpc_event_engine {
@ -36,6 +39,10 @@ std::string HandleToString(const Handle& handle) {
grpc_core::Timestamp ToTimestamp(grpc_core::Timestamp now,
EventEngine::Duration delta);
absl::StatusOr<std::vector<EventEngine::ResolvedAddress>>
LookupHostnameBlocking(EventEngine::DNSResolver* dns_resolver,
absl::string_view name, absl::string_view default_port);
} // namespace experimental
} // namespace grpc_event_engine

@ -41,6 +41,11 @@ const char* const additional_constraints_event_engine_client = "{}";
const char* const description_event_engine_dns =
"If set, use EventEngine DNSResolver for client channel resolution";
const char* const additional_constraints_event_engine_dns = "{}";
const char* const description_event_engine_dns_non_client_channel =
"If set, use EventEngine DNSResolver in other places besides client "
"channel.";
const char* const additional_constraints_event_engine_dns_non_client_channel =
"{}";
const char* const description_event_engine_listener =
"Use EventEngine listeners instead of iomgr's grpc_tcp_server";
const char* const additional_constraints_event_engine_listener = "{}";
@ -118,6 +123,10 @@ const ExperimentMetadata g_experiment_metadata[] = {
additional_constraints_event_engine_client, nullptr, 0, false, true},
{"event_engine_dns", description_event_engine_dns,
additional_constraints_event_engine_dns, nullptr, 0, false, false},
{"event_engine_dns_non_client_channel",
description_event_engine_dns_non_client_channel,
additional_constraints_event_engine_dns_non_client_channel, nullptr, 0,
false, false},
{"event_engine_listener", description_event_engine_listener,
additional_constraints_event_engine_listener, nullptr, 0, false, true},
{"free_large_allocator", description_free_large_allocator,
@ -182,6 +191,11 @@ const char* const additional_constraints_event_engine_client = "{}";
const char* const description_event_engine_dns =
"If set, use EventEngine DNSResolver for client channel resolution";
const char* const additional_constraints_event_engine_dns = "{}";
const char* const description_event_engine_dns_non_client_channel =
"If set, use EventEngine DNSResolver in other places besides client "
"channel.";
const char* const additional_constraints_event_engine_dns_non_client_channel =
"{}";
const char* const description_event_engine_listener =
"Use EventEngine listeners instead of iomgr's grpc_tcp_server";
const char* const additional_constraints_event_engine_listener = "{}";
@ -259,6 +273,10 @@ const ExperimentMetadata g_experiment_metadata[] = {
additional_constraints_event_engine_client, nullptr, 0, true, true},
{"event_engine_dns", description_event_engine_dns,
additional_constraints_event_engine_dns, nullptr, 0, true, false},
{"event_engine_dns_non_client_channel",
description_event_engine_dns_non_client_channel,
additional_constraints_event_engine_dns_non_client_channel, nullptr, 0,
false, false},
{"event_engine_listener", description_event_engine_listener,
additional_constraints_event_engine_listener, nullptr, 0, true, true},
{"free_large_allocator", description_free_large_allocator,
@ -323,6 +341,11 @@ const char* const additional_constraints_event_engine_client = "{}";
const char* const description_event_engine_dns =
"If set, use EventEngine DNSResolver for client channel resolution";
const char* const additional_constraints_event_engine_dns = "{}";
const char* const description_event_engine_dns_non_client_channel =
"If set, use EventEngine DNSResolver in other places besides client "
"channel.";
const char* const additional_constraints_event_engine_dns_non_client_channel =
"{}";
const char* const description_event_engine_listener =
"Use EventEngine listeners instead of iomgr's grpc_tcp_server";
const char* const additional_constraints_event_engine_listener = "{}";
@ -397,9 +420,13 @@ const ExperimentMetadata g_experiment_metadata[] = {
additional_constraints_event_engine_application_callbacks, nullptr, 0,
true, true},
{"event_engine_client", description_event_engine_client,
additional_constraints_event_engine_client, nullptr, 0, false, true},
additional_constraints_event_engine_client, nullptr, 0, true, true},
{"event_engine_dns", description_event_engine_dns,
additional_constraints_event_engine_dns, nullptr, 0, true, false},
{"event_engine_dns_non_client_channel",
description_event_engine_dns_non_client_channel,
additional_constraints_event_engine_dns_non_client_channel, nullptr, 0,
false, false},
{"event_engine_listener", description_event_engine_listener,
additional_constraints_event_engine_listener, nullptr, 0, true, true},
{"free_large_allocator", description_free_large_allocator,

@ -65,6 +65,7 @@ inline bool IsClientPrivacyEnabled() { return false; }
inline bool IsEventEngineApplicationCallbacksEnabled() { return true; }
inline bool IsEventEngineClientEnabled() { return false; }
inline bool IsEventEngineDnsEnabled() { return false; }
inline bool IsEventEngineDnsNonClientChannelEnabled() { return false; }
inline bool IsEventEngineListenerEnabled() { return false; }
inline bool IsFreeLargeAllocatorEnabled() { return false; }
inline bool IsLocalConnectorSecureEnabled() { return false; }
@ -97,6 +98,7 @@ inline bool IsEventEngineApplicationCallbacksEnabled() { return true; }
inline bool IsEventEngineClientEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
inline bool IsEventEngineDnsEnabled() { return true; }
inline bool IsEventEngineDnsNonClientChannelEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER
inline bool IsEventEngineListenerEnabled() { return true; }
inline bool IsFreeLargeAllocatorEnabled() { return false; }
@ -126,9 +128,11 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; }
inline bool IsClientPrivacyEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_APPLICATION_CALLBACKS
inline bool IsEventEngineApplicationCallbacksEnabled() { return true; }
inline bool IsEventEngineClientEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
inline bool IsEventEngineClientEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
inline bool IsEventEngineDnsEnabled() { return true; }
inline bool IsEventEngineDnsNonClientChannelEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER
inline bool IsEventEngineListenerEnabled() { return true; }
inline bool IsFreeLargeAllocatorEnabled() { return false; }
@ -161,6 +165,7 @@ enum ExperimentIds {
kExperimentIdEventEngineApplicationCallbacks,
kExperimentIdEventEngineClient,
kExperimentIdEventEngineDns,
kExperimentIdEventEngineDnsNonClientChannel,
kExperimentIdEventEngineListener,
kExperimentIdFreeLargeAllocator,
kExperimentIdLocalConnectorSecure,
@ -203,6 +208,10 @@ inline bool IsEventEngineClientEnabled() {
inline bool IsEventEngineDnsEnabled() {
return IsExperimentEnabled<kExperimentIdEventEngineDns>();
}
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS_NON_CLIENT_CHANNEL
inline bool IsEventEngineDnsNonClientChannelEnabled() {
return IsExperimentEnabled<kExperimentIdEventEngineDnsNonClientChannel>();
}
#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER
inline bool IsEventEngineListenerEnabled() {
return IsExperimentEnabled<kExperimentIdEventEngineListener>();

@ -77,6 +77,14 @@
test_tags: ["cancel_ares_query_test", "resolver_component_tests_runner_invoker"]
allow_in_fuzzing_config: false
uses_polling: true
- name: event_engine_dns_non_client_channel
description:
If set, use EventEngine DNSResolver in other places besides client channel.
expiry: 2025/03/01
owner: yijiem@google.com
test_tags: ["core_end2end_test"]
allow_in_fuzzing_config: false
uses_polling: true
- name: event_engine_listener
description: Use EventEngine listeners instead of iomgr's grpc_tcp_server
expiry: 2025/03/01

@ -59,7 +59,7 @@
default:
# not tested on iOS at all
ios: broken
posix: false
posix: true
windows: true
- name: event_engine_dns
default:

@ -400,6 +400,28 @@ struct AddOpImpl<FilterType, T,
}
};
// void $INTERCEPTOR_NAME(const $VALUE_TYPE&)
template <typename FilterType, typename T,
void (FilterType::Call::*impl)(const typename T::element_type&)>
struct AddOpImpl<FilterType, T,
void (FilterType::Call::*)(const typename T::element_type&),
impl> {
static void Add(FilterType* channel_data, size_t call_offset, Layout<T>& to) {
to.Add(0, 0,
Operator<T>{
channel_data,
call_offset,
[](void*, void* call_data, void*, T value) -> Poll<ResultOr<T>> {
(static_cast<typename FilterType::Call*>(call_data)->*impl)(
*value);
return ResultOr<T>{std::move(value), nullptr};
},
nullptr,
nullptr,
});
}
};
// void $INTERCEPTOR_NAME($VALUE_TYPE&, FilterType*)
template <typename FilterType, typename T,
void (FilterType::Call::*impl)(typename T::element_type&,

@ -813,60 +813,55 @@ absl::StatusOr<ClientMetadataHandle> CheckClientMetadata(
} // namespace
auto Server::MatchAndPublishCall(CallHandler call_handler) {
call_handler.SpawnGuardedUntilCallCompletes(
"request_matcher", [this, call_handler]() mutable {
return TrySeq(
// Wait for initial metadata to pass through all filters
Map(call_handler.PullClientInitialMetadata(), CheckClientMetadata),
// Match request with requested call
[this, call_handler](ClientMetadataHandle md) mutable {
auto* registered_method = static_cast<RegisteredMethod*>(
md->get(GrpcRegisteredMethod()).value_or(nullptr));
RequestMatcherInterface* rm;
grpc_server_register_method_payload_handling payload_handling =
GRPC_SRM_PAYLOAD_NONE;
if (registered_method == nullptr) {
rm = unregistered_request_matcher_.get();
} else {
payload_handling = registered_method->payload_handling;
rm = registered_method->matcher.get();
}
auto maybe_read_first_message = If(
payload_handling == GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER,
[call_handler]() mutable {
return call_handler.PullMessage();
},
[]() -> ValueOrFailure<absl::optional<MessageHandle>> {
return ValueOrFailure<absl::optional<MessageHandle>>(
absl::nullopt);
});
return TryJoin<absl::StatusOr>(
std::move(maybe_read_first_message), rm->MatchRequest(0),
[md = std::move(md)]() mutable {
return ValueOrFailure<ClientMetadataHandle>(std::move(md));
});
},
// Publish call to cq
[call_handler,
this](std::tuple<absl::optional<MessageHandle>,
RequestMatcherInterface::MatchResult,
ClientMetadataHandle>
r) {
RequestMatcherInterface::MatchResult& mr = std::get<1>(r);
auto md = std::move(std::get<2>(r));
auto* rc = mr.TakeCall();
rc->Complete(std::move(std::get<0>(r)), *md);
grpc_call* call =
MakeServerCall(call_handler, std::move(md), this,
rc->cq_bound_to_call, rc->initial_metadata);
*rc->call = call;
return Map(
WaitForCqEndOp(false, rc->tag, absl::OkStatus(), mr.cq()),
[rc = std::unique_ptr<RequestedCall>(rc)](Empty) {
return absl::OkStatus();
});
});
});
call_handler.SpawnGuarded("request_matcher", [this, call_handler]() mutable {
return TrySeq(
// Wait for initial metadata to pass through all filters
Map(call_handler.PullClientInitialMetadata(), CheckClientMetadata),
// Match request with requested call
[this, call_handler](ClientMetadataHandle md) mutable {
auto* registered_method = static_cast<RegisteredMethod*>(
md->get(GrpcRegisteredMethod()).value_or(nullptr));
RequestMatcherInterface* rm;
grpc_server_register_method_payload_handling payload_handling =
GRPC_SRM_PAYLOAD_NONE;
if (registered_method == nullptr) {
rm = unregistered_request_matcher_.get();
} else {
payload_handling = registered_method->payload_handling;
rm = registered_method->matcher.get();
}
auto maybe_read_first_message = If(
payload_handling == GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER,
[call_handler]() mutable { return call_handler.PullMessage(); },
[]() -> ValueOrFailure<absl::optional<MessageHandle>> {
return ValueOrFailure<absl::optional<MessageHandle>>(
absl::nullopt);
});
return TryJoin<absl::StatusOr>(
std::move(maybe_read_first_message), rm->MatchRequest(0),
[md = std::move(md)]() mutable {
return ValueOrFailure<ClientMetadataHandle>(std::move(md));
});
},
// Publish call to cq
[call_handler, this](std::tuple<absl::optional<MessageHandle>,
RequestMatcherInterface::MatchResult,
ClientMetadataHandle>
r) {
RequestMatcherInterface::MatchResult& mr = std::get<1>(r);
auto md = std::move(std::get<2>(r));
auto* rc = mr.TakeCall();
rc->Complete(std::move(std::get<0>(r)), *md);
grpc_call* call =
MakeServerCall(call_handler, std::move(md), this,
rc->cq_bound_to_call, rc->initial_metadata);
*rc->call = call;
return Map(WaitForCqEndOp(false, rc->tag, absl::OkStatus(), mr.cq()),
[rc = std::unique_ptr<RequestedCall>(rc)](Empty) {
return absl::OkStatus();
});
});
});
}
absl::StatusOr<RefCountedPtr<UnstartedCallDestination>>

@ -18,7 +18,7 @@ Therefore, gRPC supports several major build systems, which should satisfy most
them.
.
* Best Effort: We do not have continous integration tests for these, but we are
* Best Effort: We do not have continuous integration tests for these, but we are
fairly confident that gRPC C++ would work on them. We will make our best
effort to support them, and we welcome patches for such platforms, but we
might need to declare bankruptcy on some issues.

@ -194,7 +194,7 @@ class OpenCensusServerCallTracer : public grpc_core::ServerCallTracer {
absl::Duration elapsed_time_;
uint64_t recv_message_count_;
uint64_t sent_message_count_;
// Buffer needed for grpc_slice to reference it when adding metatdata to
// Buffer needed for grpc_slice to reference it when adding metadata to
// response.
char stats_buf_[kMaxServerStatsLen];
// TODO(roth, ctiller): Won't need atomic here once chttp2 is migrated

@ -75,7 +75,7 @@ absl::StatusOr<std::string> GetGcpObservabilityConfigContents() {
// Tries to get the GCP Project ID from environment variables, or returns an
// empty string if not found.
std::string GetProjectIdFromGcpEnvVar() {
// First check GCP_PROEJCT
// First check GCP_PROJECT
absl::optional<std::string> project_id = grpc_core::GetEnv("GCP_PROJECT");
if (project_id.has_value() && !project_id->empty()) {
return project_id.value();

@ -530,7 +530,7 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
grpc::internal::InterceptorBatchMethodsImpl interceptor_methods_;
// ServerContextWrapper allows ManualConstructor while using a private
// contructor of ServerContext via this friend class.
// constructor of ServerContext via this friend class.
struct ServerContextWrapper {
ServerContext ctx;

@ -42,10 +42,10 @@ class ThreadManager {
// "Polls" for new work.
// If the return value is WORK_FOUND:
// - The implementaion of PollForWork() MAY set some opaque identifier to
// - The implementation of PollForWork() MAY set some opaque identifier to
// (identify the work item found) via the '*tag' parameter
// - The implementaion MUST set the value of 'ok' to 'true' or 'false'. A
// value of 'false' indicates some implemenation specific error (that is
// - The implementation MUST set the value of 'ok' to 'true' or 'false'. A
// value of 'false' indicates some implementation specific error (that is
// neither SHUTDOWN nor TIMEOUT)
// - ThreadManager does not interpret the values of 'tag' and 'ok'
// - ThreadManager WILL call DoWork() and pass '*tag' and 'ok' as input to

@ -92,7 +92,7 @@ def wait_until_dns_server_is_up(args,
dns_server_subprocess.kill()
dns_server_subprocess.wait()
test_runner_log(('Failed to reach DNS server over TCP and/or UDP. '
'Exitting without running tests.'))
'Exiting without running tests.'))
test_runner_log('======= DNS server stdout '
'(merged stdout and stderr) =============')
with open(dns_server_subprocess_output, 'r') as l:

@ -312,6 +312,7 @@ grpc_core_end2end_test(
grpc_core_end2end_test(
name = "cancel_after_invoke",
flaky = True,
shard_count = 50,
)
@ -324,7 +325,10 @@ grpc_core_end2end_test(name = "cancel_before_invoke")
grpc_core_end2end_test(name = "cancel_in_a_vacuum")
grpc_core_end2end_test(name = "cancel_with_status")
grpc_core_end2end_test(
name = "cancel_with_status",
flaky = True,
)
grpc_core_end2end_test(name = "channelz")

@ -25,13 +25,14 @@ END2END_TEST_DATA = [
"//src/core/tsi/test_creds:server1.pem",
]
def grpc_core_end2end_test(name, shard_count = 10, tags = []):
def grpc_core_end2end_test(name, shard_count = 10, tags = [], flaky = False):
"""Generate one core end2end test
Args:
name: name of the test, must correspond to a "test/name.cc" file
shard_count: per bazel
tags: per bazel
flaky: per bazel
"""
if len(name) > 60:
@ -112,6 +113,7 @@ def grpc_core_end2end_test(name, shard_count = 10, tags = []):
"%s_library" % name,
],
tags = ["core_end2end_test", "thready_tsan"] + tags,
flaky = flaky,
)
grpc_proto_fuzzer(

@ -5,7 +5,7 @@ However, it's ok to call `::testing::InitGoogleTest` in `main`, as `GTMGoogleTes
`grpc::testing::TestEnvironment` can also be called from `main`, as it does some test initialization (install crash handler, seed RNG) that's not strictly required to run testcases on iOS.
## Porting exising C++ tests to run on iOS
## Porting existing C++ tests to run on iOS
Please follow these guidelines when porting tests to run on iOS:

@ -25,7 +25,7 @@ post_install do |installer|
# CocoaPods creates duplicated library targets of gRPC-Core when the test targets include
# non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core'
# and require the same error suppresion.
# and require the same error suppression.
if target.name.start_with?('gRPC-Core')
target.build_configurations.each do |config|
# TODO(zyc): Remove this setting after the issue is resolved

@ -234,7 +234,7 @@ bool plugin_has_sync_methods(std::unique_ptr<ServerBuilderPlugin>& plugin) {
}
// This class disables the server builder plugins that may add sync services to
// the server. If there are sync services, UnimplementedRpc test will triger
// the server. If there are sync services, UnimplementedRpc test will trigger
// the sync unknown rpc routine on the server side, rather than the async one
// that needs to be tested here.
class ServerBuilderSyncPluginDisabler : public grpc::ServerBuilderOption {
@ -322,7 +322,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
}
cq_ = builder.AddCompletionQueue();
// TODO(zyc): make a test option to choose wheather sync plugins should be
// TODO(zyc): make a test option to choose whether sync plugins should be
// deleted
std::unique_ptr<ServerBuilderOption> sync_plugin_disabler(
new ServerBuilderSyncPluginDisabler());

@ -312,7 +312,7 @@ std::vector<TestScenario> CreateTestScenarios() {
INSTANTIATE_TEST_SUITE_P(CFStreamTest, CFStreamTest,
::testing::ValuesIn(CreateTestScenarios()));
// gRPC should automatically detech network flaps (without enabling keepalives)
// gRPC should automatically detect network flaps (without enabling keepalives)
// when CFStream is enabled
TEST_P(CFStreamTest, NetworkTransition) {
auto channel = BuildChannel();

@ -216,7 +216,7 @@ class ChannelzServerTest : public ::testing::TestWithParam<CredentialsType> {
backends_.clear();
proxy_service_.reset();
// Ensure all pending callbacks are handled before finishing the test
// to ensure hygene between test cases.
// to ensure hygiene between test cases.
// (requires any grpc-object-holding values be cleared out first).
grpc_event_engine::experimental::WaitForSingleOwner(
grpc_event_engine::experimental::GetDefaultEventEngine());

@ -1055,7 +1055,7 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelDuring) {
}
}
// Server to cancel after writing all the respones to the stream but before
// Server to cancel after writing all the responses to the stream but before
// returning to the client
TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelAfter) {
ResetStub();

@ -1021,7 +1021,7 @@ TEST_F(PickFirstTest, BackOffMinReconnect) {
const grpc_core::Duration waited =
grpc_core::Duration::FromTimespec(gpr_time_sub(t1, t0));
VLOG(2) << "Waited " << waited.millis() << " milliseconds";
// We should have waited at least kMinReconnectBackOffMs. We substract one to
// We should have waited at least kMinReconnectBackOffMs. We subtract one to
// account for test and precision accuracy drift.
EXPECT_GE(waited.millis(),
(kMinReconnectBackOffMs * grpc_test_slowdown_factor()) - 1);

@ -786,7 +786,7 @@ TEST_P(End2endServerTryCancelTest, ResponseStreamServerCancelDuring) {
TestResponseStreamServerCancel(CANCEL_DURING_PROCESSING);
}
// Server to cancel after writing all the respones to the stream but before
// Server to cancel after writing all the responses to the stream but before
// returning to the client
TEST_P(End2endServerTryCancelTest, ResponseStreamServerCancelAfter) {
TestResponseStreamServerCancel(CANCEL_AFTER_PROCESSING);

@ -147,7 +147,7 @@ TEST_F(ProtoServerReflectionTest, CheckResponseWithLocalDescriptorPool) {
std::vector<std::string> services;
desc_db_->GetServices(&services);
// The service list has at least one service (reflection servcie).
// The service list has at least one service (reflection service).
EXPECT_TRUE(!services.empty());
for (auto it = services.begin(); it != services.end(); ++it) {

@ -185,7 +185,7 @@ TEST_P(OutlierDetectionTest, SuccessRateMaxPercent) {
EXPECT_LE(absl::Now(), deadline);
if (absl::Now() >= deadline) break;
}
// 1 backend should be ejected, trafficed picked up by another backend.
// 1 backend should be ejected, traffic picked up by another backend.
// No other backend should be ejected.
ResetBackendCounters();
CheckRpcSendOk(DEBUG_LOCATION, 100, rpc_options);
@ -599,7 +599,7 @@ TEST_P(OutlierDetectionTest, FailurePercentageMaxPercentage) {
EXPECT_LE(absl::Now(), deadline);
if (absl::Now() >= deadline) break;
}
// 1 backend should be ejected, trafficed picked up by another backend.
// 1 backend should be ejected, traffic picked up by another backend.
// No other backend should be ejected.
ResetBackendCounters();
CheckRpcSendOk(DEBUG_LOCATION, 100, rpc_options);

@ -131,9 +131,9 @@ class AdsServiceImpl
// Sets a callback to be invoked on request messages with respoonse_nonce
// set. The callback is passed the resource type and version.
void SetCheckVersionCallback(
std::function<void(absl::string_view, int)> check_version_callack) {
std::function<void(absl::string_view, int)> check_version_callback) {
grpc_core::MutexLock lock(&ads_mu_);
check_version_callack_ = std::move(check_version_callack);
check_version_callback_ = std::move(check_version_callback);
}
// Get the list of response state for each resource type.
@ -368,9 +368,9 @@ class AdsServiceImpl
CHECK(absl::SimpleAtoi(request.version_info(),
&client_resource_type_version));
}
if (check_version_callack_ != nullptr) {
check_version_callack_(request.type_url(),
client_resource_type_version);
if (check_version_callback_ != nullptr) {
check_version_callback_(request.type_url(),
client_resource_type_version);
}
} else {
int client_nonce;
@ -586,7 +586,7 @@ class AdsServiceImpl
resource_type_response_state_ ABSL_GUARDED_BY(ads_mu_);
std::set<std::string /*resource_type*/> resource_types_to_ignore_
ABSL_GUARDED_BY(ads_mu_);
std::function<void(absl::string_view, int)> check_version_callack_
std::function<void(absl::string_view, int)> check_version_callback_
ABSL_GUARDED_BY(ads_mu_);
// An instance data member containing the current state of all resources.
// Note that an entry will exist whenever either of the following is true:

@ -116,7 +116,7 @@ class InteropClient {
public:
typedef std::function<std::shared_ptr<Channel>()> ChannelCreationFunc;
// If new_stub_every_call = true, pointer to a new instance of
// TestServce::Stub is returned by Get() everytime it is called
// TestService::Stub is returned by Get() everytime it is called
ServiceStub(ChannelCreationFunc channel_creation_func,
bool new_stub_every_call);

@ -151,11 +151,11 @@ void RunServer(const std::set<int>& grpc_ports, const std::set<int>& xds_ports,
int main(int argc, char** argv) {
// Preprocess argv, for two things:
// 1. merge duplciate flags. So "--grpc=8080 --grpc=9090" becomes
// 1. merge duplicate flags. So "--grpc=8080 --grpc=9090" becomes
// "--grpc=8080,9090".
// 2. replace '-' to '_'. So "--istio-version=123" becomes
// "--istio_version=123".
// 3. remove --version since that is specially interpretted by absl
// 3. remove --version since that is specially interpreted by absl
std::map<std::string, std::vector<std::string>> argv_dict;
for (int i = 0; i < argc; i++) {
std::string arg(argv[i]);

@ -32,7 +32,7 @@
int kDeadlineSecs = 10;
ABSL_FLAG(std::string, metrics_server_address, "localhost:8081",
"The metrics server addresses in the fomrat <hostname>:<port>");
"The metrics server addresses in the format <hostname>:<port>");
// TODO(Capstan): Consider using absl::Duration
ABSL_FLAG(int32_t, deadline_secs, kDeadlineSecs,
"The deadline (in seconds) for RCP call");

@ -100,7 +100,7 @@ void BM_EventEngine_RunClosure(benchmark::State& state) {
int cb_count = state.range(0);
grpc_core::Notification* signal = new grpc_core::Notification();
std::atomic_int count{0};
// Ignore leaks from this closure. For simplicty, this closure is not deleted
// Ignore leaks from this closure. For simplicity, this closure is not deleted
// because the closure may still be executing after the EventEngine is
// destroyed. This is because the default posix EventEngine's thread pool may
// get destroyed separately from the EventEngine.

@ -42,7 +42,7 @@ static void* tag(intptr_t x) { return reinterpret_cast<void*>(x); }
// Repeatedly makes Streaming Bidi calls (exchanging a configurable number of
// messages in each call) in a loop on a single channel
//
// First parmeter (i.e state.range(0)): Message size (in bytes) to use
// First parameter (i.e state.range(0)): Message size (in bytes) to use
// Second parameter (i.e state.range(1)): Number of ping pong messages.
// Note: One ping-pong means two messages (one from client to server and
// the other from server to client):
@ -138,7 +138,7 @@ static void BM_StreamingPingPong(benchmark::State& state) {
}
// Repeatedly sends ping pong messages in a single streaming Bidi call in a loop
// First parmeter (i.e state.range(0)): Message size (in bytes) to use
// First parameter (i.e state.range(0)): Message size (in bytes) to use
template <class Fixture, class ClientContextMutator, class ServerContextMutator>
static void BM_StreamingPingPongMsgs(benchmark::State& state) {
const int msg_size = state.range(0);
@ -229,7 +229,7 @@ static void BM_StreamingPingPongMsgs(benchmark::State& state) {
// sendmsg syscalls for streaming by coalescing 1. initial metadata with first
// message; 2. final streaming message with trailing metadata.
//
// First parmeter (i.e state.range(0)): Message size (in bytes) to use
// First parameter (i.e state.range(0)): Message size (in bytes) to use
// Second parameter (i.e state.range(1)): Number of ping pong messages.
// Note: One ping-pong means two messages (one from client to server and
// the other from server to client):

@ -92,7 +92,7 @@ def wait_until_dns_server_is_up(args,
dns_server_subprocess.kill()
dns_server_subprocess.wait()
test_runner_log(('Failed to reach DNS server over TCP and/or UDP. '
'Exitting without running tests.'))
'Exiting without running tests.'))
test_runner_log('======= DNS server stdout '
'(merged stdout and stderr) =============')
with open(dns_server_subprocess_output, 'r') as l:

@ -112,7 +112,7 @@ int main(int argc, char** argv) {
test_srcdir.value() +
absl::GetFlag(FLAGS_grpc_test_directory_relative_to_test_srcdir) +
std::string("/test/cpp/naming");
// Invoke bazel's executeable links to the .sh and .py scripts (don't use
// Invoke bazel's executable links to the .sh and .py scripts (don't use
// the .sh and .py suffixes) to make
// sure that we're using bazel's test environment.
result = grpc::testing::InvokeResolverComponentTestsRunner(

@ -154,7 +154,7 @@ def flush_stdout_loop():
sys.stdout.flush()
time.sleep(sleep_time)
num_timeouts_so_far += 1
print("Process timeout reached, or cancelled. Exitting 0.")
print("Process timeout reached, or cancelled. Exiting 0.")
os.kill(os.getpid(), signal.SIGTERM)

@ -86,7 +86,7 @@ def wait_until_dns_server_is_up(args):
test_runner_log(
(
"Failed to reach DNS server over TCP and/or UDP. "
"Exitting without running tests."
"Exiting without running tests."
)
)
sys.exit(1)

@ -103,8 +103,9 @@ ConstructPerWorkerCredentialTypesMap() {
}
size_t comma = next_entry.find(',');
if (comma == std::string::npos) {
LOG(ERROR) << "Expectd --per_worker_credential_types to be a list of the "
"form: 'addr1,cred_type1;addr2,cred_type2;...' into.";
LOG(ERROR)
<< "Expected --per_worker_credential_types to be a list of the "
"form: 'addr1,cred_type1;addr2,cred_type2;...' into.";
abort();
}
std::string addr = next_entry.substr(0, comma);

@ -132,7 +132,7 @@ TEST_F(LoadDataStoreTest, ReassignOrphanStores) {
auto assigned_to_lb_id_4 =
load_data_store.GetAssignedStores(kHostname2, kLbId4);
// There is no active LB for the first host now. kLbId4 is active but
// it's for the second host, so it wll NOT adopt the orphaned stores.
// it's for the second host, so it will NOT adopt the orphaned stores.
EXPECT_FALSE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_4,
kHostname1, kLbId1, kLoadKey1));
EXPECT_FALSE(PerBalancerStoresContains(load_data_store, assigned_to_lb_id_4,
@ -187,16 +187,16 @@ TEST_F(LoadDataStoreTest, OrphanAssignmentIsSticky) {
// Close the assigned_lb_id, orphaned_lb_id will be re-assigned again.
load_data_store.ReportStreamClosed(kHostname1, assigned_lb_id);
active_lb_ids.erase(assigned_lb_id);
size_t orphaned_lb_id_occurences = 0;
size_t orphaned_lb_id_occurrences = 0;
for (const auto& lb_id : active_lb_ids) {
if (PerBalancerStoresContains(
load_data_store,
load_data_store.GetAssignedStores(kHostname1, lb_id), kHostname1,
orphaned_lb_id, kLoadKey1)) {
orphaned_lb_id_occurences++;
orphaned_lb_id_occurrences++;
}
}
EXPECT_EQ(orphaned_lb_id_occurences, 1U);
EXPECT_EQ(orphaned_lb_id_occurrences, 1U);
}
TEST_F(LoadDataStoreTest, HostTemporarilyLoseAllStreams) {

@ -80,7 +80,7 @@ class CliCall final {
void WritesDoneAndWait();
// Thread-safe Read. Blockingly receive a generic response message. Notify
// writes if they are finished when this read is waiting for a resposne.
// writes if they are finished when this read is waiting for a response.
bool ReadAndMaybeNotifyWrite(
std::string* response,
IncomingMetadataContainer* server_initial_metadata);
@ -97,7 +97,7 @@ class CliCall final {
grpc::CompletionQueue cq_;
gpr_mu write_mu_;
gpr_cv write_cv_; // Protected by write_mu_;
bool write_done_; // Portected by write_mu_;
bool write_done_; // Protected by write_mu_;
};
} // namespace testing

@ -19,7 +19,7 @@ cd /d %~dp0\..\..\..
@rem is on PATH. To avoid picking up the older version protoc.exe, we change the path to something non-existent.
set PATH=%PATH:ProtoC=DontPickupProtoC%
@rem Install into ./testinstall, but use absolute path and foward slashes
@rem Install into ./testinstall, but use absolute path and forward slashes
set INSTALL_DIR=%cd:\=/%/testinstall
@rem Download OpenSSL-Win32 originally installed from https://slproweb.com/products/Win32OpenSSL.html

@ -19,7 +19,7 @@ cd /d %~dp0\..\..\..
@rem is on PATH. To avoid picking up the older version protoc.exe, we change the path to something non-existent.
set PATH=%PATH:ProtoC=DontPickupProtoC%
@rem Install into ./testinstall, but use absolute path and foward slashes
@rem Install into ./testinstall, but use absolute path and forward slashes
set INSTALL_DIR=%cd:\=/%/testinstall
@rem Download OpenSSL-Win32 originally installed from https://slproweb.com/products/Win32OpenSSL.html

@ -1,40 +0,0 @@
#!/usr/bin/env bash
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
set -ex
echo $ANDROID_HOME
echo $ANDROID_NDK_HOME
# Android platforms only works with Bazel >= 7.0
export OVERRIDE_BAZEL_VERSION=7.3.1
python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_binder_example_app
bazel_binder_example_app/bazel_wrapper \
--bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc \
build \
--extra_toolchains=@androidndk//:all \
--android_platforms=//bazel/platforms/android:x86_64,//bazel/platforms/android:armeabi-v7a,//bazel/platforms/android:arm64-v8a \
//examples/android/binder/java/io/grpc/binder/cpp/exampleclient:app \
//examples/android/binder/java/io/grpc/binder/cpp/exampleserver:app
# Make sure the Java code that will be invoked by binder transport
# implementation builds
python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_binder_connection_helper
bazel_binder_connection_helper/bazel_wrapper \
--bazelrc=tools/remote_build/include/test_locally_with_resultstore_results.bazelrc \
build \
--define=use_strict_warning=true \
@binder_transport_android_helper//io/grpc/binder/cpp:connection_helper

@ -1515,30 +1515,6 @@
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "cancel_after_invoke_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
@ -1659,30 +1635,6 @@
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "cancel_with_status_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,

Loading…
Cancel
Save