From 16d4c4c869e8cf383bdd786200cb925e2829ef39 Mon Sep 17 00:00:00 2001 From: xiaoxmeng Date: Thu, 11 Apr 2024 19:17:29 -0700 Subject: [PATCH] Wait for all the tasks to be deleted before reset memory system (#9458) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/9458 Reviewed By: tanjialiang Differential Revision: D56041868 Pulled By: xiaoxmeng fbshipit-source-id: 92cad676014a612abdfe60501465cc3e196252d1 --- velox/common/memory/tests/MemoryCapExceededTest.cpp | 1 - velox/exec/tests/HashJoinTest.cpp | 5 ----- velox/exec/tests/MultiFragmentTest.cpp | 2 -- velox/exec/tests/OperatorUtilsTest.cpp | 1 - velox/exec/tests/TableWriteTest.cpp | 5 ----- velox/exec/tests/TaskTest.cpp | 5 ----- velox/exec/tests/ValuesTest.cpp | 1 - velox/exec/tests/utils/OperatorTestBase.cpp | 1 + 8 files changed, 1 insertion(+), 20 deletions(-) diff --git a/velox/common/memory/tests/MemoryCapExceededTest.cpp b/velox/common/memory/tests/MemoryCapExceededTest.cpp index 848df1e102df1..6960d751857d6 100644 --- a/velox/common/memory/tests/MemoryCapExceededTest.cpp +++ b/velox/common/memory/tests/MemoryCapExceededTest.cpp @@ -37,7 +37,6 @@ class MemoryCapExceededTest : public OperatorTestBase, } void TearDown() override { - waitForAllTasksToBeDeleted(); OperatorTestBase::TearDown(); FLAGS_velox_suppress_memory_capacity_exceeding_error_message = false; } diff --git a/velox/exec/tests/HashJoinTest.cpp b/velox/exec/tests/HashJoinTest.cpp index b859f86351b64..84f9c6370cc18 100644 --- a/velox/exec/tests/HashJoinTest.cpp +++ b/velox/exec/tests/HashJoinTest.cpp @@ -792,11 +792,6 @@ class HashJoinTest : public HiveConnectorTestBase { .allowLazyVector = false}; } - void TearDown() override { - waitForAllTasksToBeDeleted(); - HiveConnectorTestBase::TearDown(); - } - // Make splits with each plan node having a number of source files. SplitInput makeSpiltInput( const std::vector& nodeIds, diff --git a/velox/exec/tests/MultiFragmentTest.cpp b/velox/exec/tests/MultiFragmentTest.cpp index 3e8f4c03517b2..110729da88501 100644 --- a/velox/exec/tests/MultiFragmentTest.cpp +++ b/velox/exec/tests/MultiFragmentTest.cpp @@ -47,8 +47,6 @@ class MultiFragmentTest : public HiveConnectorTestBase { } void TearDown() override { - waitForAllTasksToBeDeleted(); - // There might be lingering exchange source on executor even after all tasks // are deleted. This can cause memory leak because exchange source holds // reference to memory pool. We need to make sure they are properly cleaned. diff --git a/velox/exec/tests/OperatorUtilsTest.cpp b/velox/exec/tests/OperatorUtilsTest.cpp index 24ce90dd7480f..c0abaa5f22263 100644 --- a/velox/exec/tests/OperatorUtilsTest.cpp +++ b/velox/exec/tests/OperatorUtilsTest.cpp @@ -31,7 +31,6 @@ class OperatorUtilsTest : public OperatorTestBase { driverCtx_.reset(); driver_.reset(); task_.reset(); - waitForAllTasksToBeDeleted(); OperatorTestBase::TearDown(); } diff --git a/velox/exec/tests/TableWriteTest.cpp b/velox/exec/tests/TableWriteTest.cpp index 23fc416e08ab9..5e688f793fda4 100644 --- a/velox/exec/tests/TableWriteTest.cpp +++ b/velox/exec/tests/TableWriteTest.cpp @@ -248,11 +248,6 @@ class TableWriteTest : public HiveConnectorTestBase { HiveConnectorTestBase::SetUp(); } - void TearDown() override { - waitForAllTasksToBeDeleted(); - HiveConnectorTestBase::TearDown(); - } - std::shared_ptr assertQueryWithWriterConfigs( const core::PlanNodePtr& plan, std::vector> filePaths, diff --git a/velox/exec/tests/TaskTest.cpp b/velox/exec/tests/TaskTest.cpp index 3bf0a1d487a6b..7963c9ad2a160 100644 --- a/velox/exec/tests/TaskTest.cpp +++ b/velox/exec/tests/TaskTest.cpp @@ -460,11 +460,6 @@ class TestBadMemoryTranslator : public exec::Operator::PlanNodeTranslator { class TaskTest : public HiveConnectorTestBase { protected: - void TearDown() override { - waitForAllTasksToBeDeleted(); - HiveConnectorTestBase::TearDown(); - } - static std::pair, std::vector> executeSingleThreaded( core::PlanFragment plan, diff --git a/velox/exec/tests/ValuesTest.cpp b/velox/exec/tests/ValuesTest.cpp index f9d79872af45c..368fb17bfb521 100644 --- a/velox/exec/tests/ValuesTest.cpp +++ b/velox/exec/tests/ValuesTest.cpp @@ -26,7 +26,6 @@ namespace facebook::velox::exec::test { class ValuesTest : public OperatorTestBase { protected: void TearDown() override { - waitForAllTasksToBeDeleted(); input_.reset(); input2_.reset(); OperatorTestBase::TearDown(); diff --git a/velox/exec/tests/utils/OperatorTestBase.cpp b/velox/exec/tests/utils/OperatorTestBase.cpp index 7ad53cc8889a4..9c59dd09c853a 100644 --- a/velox/exec/tests/utils/OperatorTestBase.cpp +++ b/velox/exec/tests/utils/OperatorTestBase.cpp @@ -103,6 +103,7 @@ void OperatorTestBase::SetUp() { } void OperatorTestBase::TearDown() { + waitForAllTasksToBeDeleted(); pool_.reset(); rootPool_.reset(); resetMemory();