Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix velox_aggregates_test memory leaks #5168

Closed

Conversation

billyean
Copy link

@billyean billyean commented Jun 7, 2023

We found memory leaks when we run tests on enabling VELOX_ENABLE_ADDRESS_SANITIZER, this small fix is for fixing this issue.

145: =================================================================
145: ==11813==ERROR: LeakSanitizer: detected memory leaks
145:
145: Direct leak of 288 byte(s) in 1 object(s) allocated from:
145: #0 0x7fcfb181fb2f in operator new(unsigned long, std::align_val_t) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:111
145: #1 0x555e53f00d24 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/include/c++/10/ext/new_allocator.h:112
145: #2 0x555e53efdd06 in std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /usr/include/c++/10/bits/alloc_traits.h:460
145: #3 0x555e53efb933 in std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, (__gnu_cxx::_Lock_policy)2> >&) /usr/include/c++/10/bits/allocated_ptr.h:97
145: #4 0x555e5fbc3d53 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, facebook::velox::memory::MemoryPool*&, int&, bool, std::shared_ptr<facebook::velox::Type const>&, long, facebook::velox::SimpleVectorStats, unsigned long>(facebook::velox::ConstantVector&, std::_Sp_alloc_shared_tag<std::allocator<facebook::velox::ConstantVector > >, facebook::velox::memory::MemoryPool&, int&, bool&&, std::shared_ptr<facebook::velox::Type const>&, long&&, facebook::velox::SimpleVectorStats&&, unsigned long&&) /usr/include/c++/10/bits/shared_ptr_base.h:680
145: #5 0x555e5fbac88d in std::__shared_ptr<facebook::velox::ConstantVector, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<facebook::velox::ConstantVector >, facebook::velox::memory::MemoryPool*&, int&, bool, std::shared_ptr<facebook::velox::Type const>&, long, facebook::velox::SimpleVectorStats, unsigned long>(std::_Sp_alloc_shared_tag<std::allocator<facebook::velox::ConstantVector > >, facebook::velox::memory::MemoryPool*&, int&, bool&&, std::shared_ptr<facebook::velox::Type const>&, long&&, facebook::velox::SimpleVectorStats&&, unsigned long&&) /usr/include/c++/10/bits/shared_ptr_base.h:1371
145: #6 0x555e5fb9f50d in std::shared_ptr<facebook::velox::ConstantVector >::shared_ptr<std::allocator<facebook::velox::ConstantVector >, facebook::velox::memory::MemoryPool*&, int&, bool, std::shared_ptr<facebook::velox::Type const>&, long, facebook::velox::SimpleVectorStats, unsigned long>(std::_Sp_alloc_shared_tag<std::allocator<facebook::velox::ConstantVector > >, facebook::velox::memory::MemoryPool*&, int&, bool&&, std::shared_ptr<facebook::velox::Type const>&, long&&, facebook::velox::SimpleVectorStats&&, unsigned long&&) /usr/include/c++/10/bits/shared_ptr.h:408
145: #7 0x555e5fb94ce0 in std::shared_ptr<facebook::velox::ConstantVector > std::allocate_shared<facebook::velox::ConstantVector, std::allocator<facebook::velox::ConstantVector >, facebook::velox::memory::MemoryPool*&, int&, bool, std::shared_ptr<facebook::velox::Type const>&, long, facebook::velox::SimpleVectorStats, unsigned long>(std::allocator<facebook::velox::ConstantVector > const&, facebook::velox::memory::MemoryPool*&, int&, bool&&, std::shared_ptr<facebook::velox::Type const>&, long&&, facebook::velox::SimpleVectorStats&&, unsigned long&&) /usr/include/c++/10/bits/shared_ptr.h:860
145: #8 0x555e5fb8ba58 in std::shared_ptr<facebook::velox::ConstantVector > std::make_shared<facebook::velox::ConstantVector, facebook::velox::memory::MemoryPool*&, int&, bool, std::shared_ptr<facebook::velox::Type const>&, long, facebook::velox::SimpleVectorStats, unsigned long>(facebook::velox::memory::MemoryPool*&, int&, bool&&, std::shared_ptr<facebook::velox::Type const>&, long&&, facebook::velox::SimpleVectorStats&&, unsigned long&&) /usr/include/c++/10/bits/shared_ptr.h:876
145: #9 0x555e5fb7bb4e in std::shared_ptrfacebook::velox::BaseVector facebook::velox::newConstant<(facebook::velox::TypeKind)4>(facebook::velox::variant&, int, facebook::velox::memory::MemoryPool*) ../../velox/vector/BaseVector.cpp:650
145: #10 0x555e5fb5861f in operator() ../../velox/vector/BaseVector.cpp:683
145: #11 0x555e5fb599b0 in operator() ../../velox/vector/BaseVector.cpp:683
145: #12 0x555e5fb59ba0 in facebook::velox::BaseVector::createConstant(facebook::velox::variant, int, facebook::velox::memory::MemoryPool*) ../../velox/vector/BaseVector.cpp:683
145: #13 0x555e53e9c3ac in std::shared_ptrfacebook::velox::BaseVector facebook::velox::test::VectorTestBase::makeConstant(long, int, std::shared_ptr<facebook::velox::Type const> const&) ../.././velox/vector/tests/utils/VectorTestBase.h:615
145: #14 0x555e53e84905 in operator() ../../velox/functions/prestosql/aggregates/tests/ApproxMostFrequentTest.cpp:144
145: #15 0x555e53e85d46 in TestBody ../../velox/functions/prestosql/aggregates/tests/ApproxMostFrequentTest.cpp:153
145: #16 0x555e5afc50a3 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const) ../../third_party/googletest/googletest/src/gtest.cc:2607
145: #17 0x555e5afb6f40 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const) ../../third_party/googletest/googletest/src/gtest.cc:2643
145: #18 0x555e5af57233 in testing::Test::Run() ../../third_party/googletest/googletest/src/gtest.cc:2682
145: #19 0x555e5af586c6 in testing::TestInfo::Run() ../../third_party/googletest/googletest/src/gtest.cc:2861
145: #20 0x555e5af597b4 in testing::TestSuite::Run() ../../third_party/googletest/googletest/src/gtest.cc:3015
145: #21 0x555e5af7de7a in testing::internal::UnitTestImpl::RunAllTests() ../../third_party/googletest/googletest/src/gtest.cc:5855
145: #22 0x555e5afc7665 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const) ../../third_party/googletest/googletest/src/gtest.cc:2607
145: #23 0x555e5afb93ed in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const) ../../third_party/googletest/googletest/src/gtest.cc:2643
145: #24 0x555e5af7aba1 in testing::UnitTest::Run() ../../third_party/googletest/googletest/src/gtest.cc:5438
145: #25 0x555e540fedbb in RUN_ALL_TESTS() ../../third_party/googletest/googletest/include/gtest/gtest.h:2490
145: #26 0x555e540feca6 in main ../../velox/functions/prestosql/aggregates/tests/Main.cpp:22
145: #27 0x7fcfb0bbfd09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26d09)
145:
145: SUMMARY: AddressSanitizer: 288 byte(s) leaked in 1 allocation(s).
155/157 Test #145: velox_aggregates_test ......................................................***Failed 595.78 sec

@netlify
Copy link

netlify bot commented Jun 7, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 8e50be8
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/647fde391cb2c80008dfb1ca

@facebook-github-bot
Copy link
Contributor

Hi @billyean!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 7, 2023
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@stale
Copy link

stale bot commented Sep 6, 2023

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the PR, make sure you've addressed reviewer comments, and rebase on the latest main. Thank you for your contributions!

@stale stale bot added the stale label Sep 6, 2023
@stale stale bot closed this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants