Bug #89439 LeakSanitizer errors on GCS unit tests
Submitted: 26 Jan 2018 14:35 Modified: 11 Apr 2018 16:05
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Group Replication Severity:S3 (Non-critical)
Version:8.0.4 OS:Any
Assigned to: CPU Architecture:Any
Tags: addresssanitizer, asan, leaksanitizer, lsan

[26 Jan 2018 14:35] Laurynas Biveinis
Description:
On a system where AddressSanitizer includes LeakSanitizer (e.g. Ubuntu 17.10), GCS unit tests will report errors:

34/45 Test #34: gcs_parameters ...........................***Failed    0.49 sec
...
=================================================================
==1676==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 240 byte(s) in 2 object(s) allocated from:
    #0 0x7f9c934cb458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
    #1 0x55a44d0f915f in Gcs_ip_whitelist::add_address(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc:726
    #2 0x55a44d108c0b in Gcs_ip_whitelist::configure(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc:627
    #3 0x55a44cf118f9 in Gcs_xcom_interface::initialize_xcom(Gcs_interface_parameters const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_interface.cc:884
    #4 0x55a44cf1e28e in Gcs_xcom_interface::initialize(Gcs_interface_parameters const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_interface.cc:337
    #5 0x55a44cda863a in gcs_parameters_unittest::GcsParametersTest_ParametersCompression_Test::TestBody() /home/laurynas/mysql-8.0.4/rapid/unittest/gunit/libmysqlgcs/xcom/gcs_parameters-t.cc:113
    #6 0x55a44d58d7c0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2402
    #7 0x55a44d58d7c0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2438
    #8 0x55a44d58e47d in testing::Test::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2474
    #9 0x55a44d58f7bf in testing::TestInfo::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2656
    #10 0x55a44d5910bd in testing::TestCase::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2774
    #11 0x55a44d59434a in testing::internal::UnitTestImpl::RunAllTests() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:4649
    #12 0x55a44d596280 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2402
    #13 0x55a44d596280 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2438
    #14 0x55a44d596dc3 in testing::UnitTest::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:4257
    #15 0x55a44cd51dba in RUN_ALL_TESTS() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/include/gtest/gtest.h:2233
    #16 0x55a44cd51dba in main /home/laurynas/mysql-8.0.4/unittest/gunit/gunit_test_main.cc:102
    #17 0x7f9c9128e1c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
...

How to repeat:
cmake -DWITH_ASAN=ON
make
mtr --debug-server 1st --unit-tests --unit-tests-report
[26 Jan 2018 14:35] Laurynas Biveinis
38/45 Test #38: gcs_whitelist ............................***Failed    1.32 sec
...
=================================================================
==1735==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 120 byte(s) in 1 object(s) allocated from:
    #0 0x7fbf1a786458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
    #1 0x55f11b9f322f in Gcs_ip_whitelist::add_address(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc:726
    #2 0x55f11ba02cdb in Gcs_ip_whitelist::configure(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc:627
    #3 0x55f11b9278a3 in gcs_whitelist_unittest::GcsWhitelist_ValidListIPv4_Test::TestBody() /home/laurynas/mysql-8.0.4/rapid/unittest/gunit/libmysqlgcs/xcom/gcs_whitelist-t.cc:83
    #4 0x55f11c118a90 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2402
    #5 0x55f11c118a90 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2438
    #6 0x55f11c11974d in testing::Test::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2474
    #7 0x55f11c11aa8f in testing::TestInfo::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2656
    #8 0x55f11c11c38d in testing::TestCase::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2774
    #9 0x55f11c11f61a in testing::internal::UnitTestImpl::RunAllTests() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:4649
    #10 0x55f11c121550 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2402
    #11 0x55f11c121550 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2438
    #12 0x55f11c122093 in testing::UnitTest::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:4257
    #13 0x55f11b8f7b7a in RUN_ALL_TESTS() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/include/gtest/gtest.h:2233
    #14 0x55f11b8f7b7a in main /home/laurynas/mysql-8.0.4/unittest/gunit/gunit_test_main.cc:102
    #15 0x7fbf185491c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
...

43/45 Test #43: gcs_xcom_interface_unit ..................***Failed    0.34 sec
...
=================================================================
==1775==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 240 byte(s) in 2 object(s) allocated from:
    #0 0x7fbafc7d1458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
    #1 0x555a0ebbc4af in Gcs_ip_whitelist::add_address(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc:726
    #2 0x555a0ebcbf5b in Gcs_ip_whitelist::configure(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc:627
    #3 0x555a0e9d4c49 in Gcs_xcom_interface::initialize_xcom(Gcs_interface_parameters const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_interface.cc:884
    #4 0x555a0e9e15de in Gcs_xcom_interface::initialize(Gcs_interface_parameters const&) /home/laurynas/mysql-8.0.4/rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_interface.cc:337
    #5 0x555a0e8812cb in gcs_interface_unittest::GcsInterfaceTest_DoubleInitFinalizeTest_Test::TestBody() /home/laurynas/mysql-8.0.4/rapid/unittest/gunit/libmysqlgcs/xcom/gcs_xcom_interface_unit-t.cc:62
    #6 0x555a0f0510e0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2402
    #7 0x555a0f0510e0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2438
    #8 0x555a0f051d9d in testing::Test::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2474
    #9 0x555a0f0530df in testing::TestInfo::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2656
    #10 0x555a0f0549dd in testing::TestCase::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2774
    #11 0x555a0f057c6a in testing::internal::UnitTestImpl::RunAllTests() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:4649
    #12 0x555a0f059ba0 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2402
    #13 0x555a0f059ba0 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:2438
    #14 0x555a0f05a6e3 in testing::UnitTest::Run() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/src/gtest.cc:4257
    #15 0x555a0e87400a in RUN_ALL_TESTS() /home/laurynas/mysql-8.0.4/source_downloads/googletest-release-1.8.0/googletest/include/gtest/gtest.h:2233
    #16 0x555a0e87400a in main /home/laurynas/mysql-8.0.4/unittest/gunit/gunit_test_main.cc:102
    #17 0x7fbafa5941c0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x211c0)
[27 Jan 2018 3:15] MySQL Verification Team
Hello Laurynas,

Thank you for the report and feedback!

Thanks,
Umesh
[27 Jan 2018 3:19] MySQL Verification Team
test results

Attachment: 89438_89439.results (application/octet-stream, text), 935.89 KiB.

[11 Apr 2018 16:05] Erlend Dahl
Fixed in 8.0.11 under the heading of

Bug#27436052 MEMORY LEAKS IN GCS UNIT TESTS