From cbd8383ac696fed2786c19b99fc7bf7f563ff0fc Mon Sep 17 00:00:00 2001 From: morningman Date: Wed, 4 May 2022 16:34:26 +0800 Subject: [PATCH] [fix](ut) fix a potential memory leak in BE ut ``` ==12681==ERROR: LeakSanitizer: detected memory leaks Direct leak of 128 byte(s) in 1 object(s) allocated from: #0 0x562b93d0fc57 in operator new(unsigned long) (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x16e02c57) #1 0x562b955fd176 in doris::ArrowWorkFlowTest::init_runtime_state() /root/doris/be/test/util/arrow/arrow_work_flow_test.cpp:92 #2 0x562b955fcf58 in doris::ArrowWorkFlowTest::init() /root/doris/be/test/util/arrow/arrow_work_flow_test.cpp:87 #3 0x562b9560ba7d in doris::ArrowWorkFlowTest::SetUp() /root/doris/be/test/util/arrow/arrow_work_flow_test.cpp:61 #4 0x562b9f38263c in void testing::internal::HandleSehExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) (/root/doris/be/ut_build_ASAN/test/ #5 0x562b9f37ca78 in void testing::internal::HandleExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) (/root/doris/be/ut_build_ASAN/test/ #6 0x562b9f3540e1 in testing::Test::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x224470e1) #7 0x562b9f354b7f in testing::TestInfo::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x22447b7f) #8 0x562b9f35543f in testing::TestSuite::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x2244843f) #9 0x562b9f364aff in testing::internal::UnitTestImpl::RunAllTests() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x22457aff) #10 0x562b9f3833ed in bool testing::internal::HandleSehExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (Impl::*)(), char const*) (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x224763ed) #11 0x562b9f37d932 in bool testing::internal::HandleExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), e/ut_build_ASAN/test/doris_be_test+0x22470932) #12 0x562b9f3632f4 in testing::UnitTest::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x224562f4) #13 0x562b95369a7c in RUN_ALL_TESTS() /var/local/thirdparty/installed/include/gtest/gtest.h:2490 #14 0x562b95366048 in main /root/doris/be/test/testutil/run_all_tests.cpp:43 #15 0x7f40dcbb6554 in __libc_start_main (/lib64/libc.so.6+0x22554) Direct leak of 104 byte(s) in 1 object(s) allocated from: #0 0x562b93d0fc57 in operator new(unsigned long) (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x16e02c57) #1 0x562b955fd213 in doris::ArrowWorkFlowTest::init_runtime_state() /root/doris/be/test/util/arrow/arrow_work_flow_test.cpp:93 #2 0x562b955fcf58 in doris::ArrowWorkFlowTest::init() /root/doris/be/test/util/arrow/arrow_work_flow_test.cpp:87 #3 0x562b9560ba7d in doris::ArrowWorkFlowTest::SetUp() /root/doris/be/test/util/arrow/arrow_work_flow_test.cpp:61 #4 0x562b9f38263c in void testing::internal::HandleSehExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) (/root/doris/be/ut_build_ASAN/test/ #5 0x562b9f37ca78 in void testing::internal::HandleExceptionsInMethodIfSupported(testing::Test*, void (testing::Test::*)(), char const*) (/root/doris/be/ut_build_ASAN/test/ #6 0x562b9f3540e1 in testing::Test::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x224470e1) #7 0x562b9f354b7f in testing::TestInfo::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x22447b7f) #8 0x562b9f35543f in testing::TestSuite::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x2244843f) #9 0x562b9f364aff in testing::internal::UnitTestImpl::RunAllTests() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x22457aff) #10 0x562b9f3833ed in bool testing::internal::HandleSehExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (Impl::*)(), char const*) (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x224763ed) #11 0x562b9f37d932 in bool testing::internal::HandleExceptionsInMethodIfSupported(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), e/ut_build_ASAN/test/doris_be_test+0x22470932) #12 0x562b9f3632f4 in testing::UnitTest::Run() (/root/doris/be/ut_build_ASAN/test/doris_be_test+0x224562f4) #13 0x562b95369a7c in RUN_ALL_TESTS() /var/local/thirdparty/installed/include/gtest/gtest.h:2490 #14 0x562b95366048 in main /root/doris/be/test/testutil/run_all_tests.cpp:43 #15 0x7f40dcbb6554 in __libc_start_main (/lib64/libc.so.6+0x22554) SUMMARY: AddressSanitizer: 232 byte(s) leaked in 2 allocation(s). ``` --- be/test/util/arrow/arrow_work_flow_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/be/test/util/arrow/arrow_work_flow_test.cpp b/be/test/util/arrow/arrow_work_flow_test.cpp index 1e22cc9fb99740..bb958b9c0ad67b 100644 --- a/be/test/util/arrow/arrow_work_flow_test.cpp +++ b/be/test/util/arrow/arrow_work_flow_test.cpp @@ -65,6 +65,7 @@ class ArrowWorkFlowTest : public testing::Test { EXPECT_EQ(system("rm -rf ./test_run"), 0); delete _state; + doris::ExecEnv::destroy(_exec_env); } void init();