[end2end] Fix fuzzer found memory leak (#33264)

(this is a bug in the core e2e fuzzer infrastructure)
pull/33277/head
Craig Tiller 2 years ago committed by GitHub
parent a351817813
commit ea58add8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      test/core/end2end/end2end_test_corpus/clusterfuzz-testcase-minimized-core_end2end_test_fuzzer-4592933739233280
  2. 15
      test/core/end2end/end2end_tests.cc
  3. 2
      test/core/event_engine/event_engine_test_utils.cc
  4. 4
      test/core/event_engine/event_engine_test_utils.h

@ -0,0 +1,7 @@
test_id: 3405774848
event_engine_actions {
run_delay: 0
run_delay: 6399
run_delay: 4294967296
run_delay: 4294967296
}

@ -84,6 +84,13 @@ void CoreEnd2endTest::SetUp() {
void CoreEnd2endTest::TearDown() { void CoreEnd2endTest::TearDown() {
const bool do_shutdown = fixture_ != nullptr; const bool do_shutdown = fixture_ != nullptr;
std::shared_ptr<grpc_event_engine::experimental::EventEngine> ee;
// TODO(hork): locate the windows leak so we can enable end2end experiments.
#ifndef GPR_WINDOWS
if (grpc_is_initialized()) {
ee = grpc_event_engine::experimental::GetDefaultEventEngine();
}
#endif
ShutdownAndDestroyClient(); ShutdownAndDestroyClient();
ShutdownAndDestroyServer(); ShutdownAndDestroyServer();
cq_verifier_.reset(); cq_verifier_.reset();
@ -98,15 +105,11 @@ void CoreEnd2endTest::TearDown() {
cq_ = nullptr; cq_ = nullptr;
} }
fixture_.reset(); fixture_.reset();
// TODO(hork): locate the windows leak so we can enable end2end experiments.
#ifndef GPR_WINDOWS
// Creating an EventEngine requires gRPC initialization, which the NoOp test // Creating an EventEngine requires gRPC initialization, which the NoOp test
// does not do. Skip the EventEngine check if unnecessary. // does not do. Skip the EventEngine check if unnecessary.
if (grpc_is_initialized()) { if (ee != nullptr) {
quiesce_event_engine_( quiesce_event_engine_(std::move(ee));
grpc_event_engine::experimental::GetDefaultEventEngine());
} }
#endif
if (do_shutdown) { if (do_shutdown) {
grpc_shutdown_blocking(); grpc_shutdown_blocking();
// This will wait until gRPC shutdown has actually happened to make sure // This will wait until gRPC shutdown has actually happened to make sure

@ -75,7 +75,7 @@ std::string GetNextSendMessage() {
return tmp_s; return tmp_s;
} }
void WaitForSingleOwner(std::shared_ptr<EventEngine>&& engine) { void WaitForSingleOwner(std::shared_ptr<EventEngine> engine) {
while (engine.use_count() > 1) { while (engine.use_count() > 1) {
GRPC_LOG_EVERY_N_SEC(2, GPR_INFO, "engine.use_count() = %ld", GRPC_LOG_EVERY_N_SEC(2, GPR_INFO, "engine.use_count() = %ld",
engine.use_count()); engine.use_count());

@ -47,7 +47,9 @@ std::string GetNextSendMessage();
// Waits until the use_count of the EventEngine shared_ptr has reached 1 // Waits until the use_count of the EventEngine shared_ptr has reached 1
// and returns. // and returns.
void WaitForSingleOwner(std::shared_ptr<EventEngine>&& engine); // Callers must give up their ref, or this method will block forever.
// Usage: WaitForSingleOwner(std::move(engine))
void WaitForSingleOwner(std::shared_ptr<EventEngine> engine);
// A helper method to exchange data between two endpoints. It is assumed // A helper method to exchange data between two endpoints. It is assumed
// that both endpoints are connected. The data (specified as a string) is // that both endpoints are connected. The data (specified as a string) is

Loading…
Cancel
Save