Bug #82307 Memory leaks in unit tests
Submitted: 21 Jul 2016 13:41 Modified: 2 Dec 2016 20:12
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.6,5.7, 5.7.13 OS:Any
Assigned to: CPU Architecture:Any
Tags: asan, lsan, valgrind

[21 Jul 2016 13:41] Laurynas Biveinis
Description:
Runing MySQL unit tests with LeakSanitiser results in several memory leak reports on 5.6 and 5.7.

How to repeat:
On a system where AddressSanitizer includes LeakSanitizer
cmake -DWITH_ASAN=ON
make
on 5.6 (running unit tests through MTR will not work because of bug 81674):
make test
on 5.7
make test 
or
./mtr 1st --unit-tests --unit-tests-report
[21 Jul 2016 13:51] Laurynas Biveinis
5.7:

      Start  4: pfs_instr-oom
 4/64 Test  #4: pfs_instr-oom ................................................................................................***Failed    0.02 sec
1..28
ok 11 - create file
=================================================================
==16869==ERROR: AddressSanitizer: heap-use-after-free on address 0x7fde51381818 at pc 0x7fde503c1676 bp 0x7ffc28db1aa0 sp 0x7ffc28db1248
READ of size 67 at 0x7fde51381818 thread T0
    #0 0x7fde503c1675 in memcmp (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x77675)
    #1 0x48d766 in my_strnncoll_binary /home/laurynas/mysql-server/strings/ctype-bin.c:84
    #2 0x4708ce in my_lfind /home/laurynas/mysql-server/mysys/lf_hash.c:113
    #3 0x4723fa in my_lsearch /home/laurynas/mysql-server/mysys/lf_hash.c:364
    #4 0x4723fa in lf_hash_search /home/laurynas/mysql-server/mysys/lf_hash.c:589
    #5 0x43f875 in find_or_create_file(PFS_thread*, PFS_file_class*, char const*, unsigned int, bool) /home/laurynas/mysql-server/storage/perfschema/pfs_instr.cc:844
    #6 0x40479a in test_oom() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:249
    #7 0x40512f in do_all_tests() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:420
    #8 0x40517a in main /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:427
    #9 0x7fde4f7ec82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #10 0x4038e8 in _start (/home/laurynas/obj-5.7-asan-debug/storage/perfschema/unittest/pfs_instr-oom-t+0x4038e8)

0x7fde51381818 is located 24 bytes inside of 720896-byte region [0x7fde51381800,0x7fde51431800)
freed by thread T0 here:
    #0 0x7fde503e22ca in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca)
    #1 0x403a51 in pfs_free(PFS_builtin_memory_class*, unsigned long, void*) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_pfs_global.h:50
    #2 0x403a6c in pfs_free_array(PFS_builtin_memory_class*, unsigned long, unsigned long, void*) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_pfs_global.h:67
    #3 0x43a3cf in PFS_buffer_default_allocator<PFS_file>::free_array(PFS_buffer_default_array<PFS_file>*, unsigned long) /home/laurynas/mysql-server/storage/perfschema/pfs_buffer_container.h:145
    #4 0x43a3cf in PFS_buffer_scalable_container<PFS_file, 1024, 1024, PFS_buffer_default_array<PFS_file>, PFS_buffer_default_allocator<PFS_file> >::cleanup() /home/laurynas/mysql-server/storage/perfschema/pfs_buffer_container.h:483
    #5 0x43a3cf in cleanup_instruments() /home/laurynas/mysql-server/storage/perfschema/pfs_instr.cc:212
    #6 0x404775 in test_oom() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:246
    #7 0x40512f in do_all_tests() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:420
    #8 0x40517a in main /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:427
    #9 0x7fde4f7ec82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

previously allocated by thread T0 here:
    #0 0x7fde503e2602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x403a12 in pfs_malloc(PFS_builtin_memory_class*, unsigned long, int) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_pfs_global.h:41
    #2 0x403ace in pfs_malloc_array(PFS_builtin_memory_class*, unsigned long, unsigned long, int) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_pfs_global.h:59
    #3 0x43ff8e in PFS_buffer_default_allocator<PFS_file>::alloc_array(PFS_buffer_default_array<PFS_file>*, unsigned long) /home/laurynas/mysql-server/storage/perfschema/pfs_buffer_container.h:134
    #4 0x43ff8e in PFS_buffer_scalable_container<PFS_file, 1024, 1024, PFS_buffer_default_array<PFS_file>, PFS_buffer_default_allocator<PFS_file> >::allocate(pfs_dirty_state*) /home/laurynas/mysql-server/storage/perfschema/pfs_buffer_container.h:645
    #5 0x43ff8e in find_or_create_file(PFS_thread*, PFS_file_class*, char const*, unsigned int, bool) /home/laurynas/mysql-server/storage/perfschema/pfs_instr.cc:861
    #6 0x404741 in test_oom() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:243
    #7 0x40512f in do_all_tests() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:420
    #8 0x40517a in main /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:427
    #9 0x7fde4f7ec82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-use-after-free ??:0 memcmp
Shadow bytes around the buggy address:
  0x0ffc4a2682b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc4a2682c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc4a2682d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc4a2682e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc4a2682f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0ffc4a268300: fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ffc4a268310: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ffc4a268320: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ffc4a268330: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ffc4a268340: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ffc4a268350: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==16869==ABORTING

(cut)
[21 Jul 2016 13:51] Laurynas Biveinis
26/64 Test #26: merge_innodb_tests ...........................................................................................***Failed    0.44 sec

(cut)

=================================================================
==17667==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2072 byte(s) in 1 object(s) allocated from:
    #0 0x7f119154c602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x41db59 in ut_allocator<innodb_ut0new_unittest::big_t>::allocate(unsigned long, innodb_ut0new_unittest::big_t const*, char const*, bool, bool) /home/laurynas/mysql-server/storage/innobase/include/ut0new.h:351
    #2 0x41db59 in innodb_ut0new_unittest::ut0new_edgecases_Test::TestBody() /home/laurynas/mysql-server/unittest/gunit/innodb/ut0new-t.cc:195
    #3 0x21a53a0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2078
    #4 0x21a53a0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2114
    #5 0x219578d in testing::Test::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2151
    #6 0x219595c in testing::TestInfo::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2326
    #7 0x2195bb8 in testing::TestCase::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2444
    #8 0x21973d4 in testing::internal::UnitTestImpl::RunAllTests() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:4315
    #9 0x21a5eb2 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2078
    #10 0x21a5eb2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2114
    #11 0x2195df9 in testing::UnitTest::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:3926
    #12 0x432062 in RUN_ALL_TESTS() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/include/gtest/gtest.h:2288
    #13 0x432062 in main /home/laurynas/mysql-server/unittest/gunit/gunit_test_main_server.cc:81
    #14 0x7f118fe0782f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

(cut)

SUMMARY: AddressSanitizer: 13904 byte(s) leaked in 86 allocation(s).

      Start 27: merge_keyring_file_tests
27/64 Test #27: merge_keyring_file_tests .....................................................................................***Failed    0.51 sec
(cut)

=================================================================
==17669==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 184 byte(s) in 1 object(s) allocated from:
    #0 0x7f0c40c29602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4e5dbd in my_raw_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:191
    #2 0x4e5dbd in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:54
    #3 0x45471b in keyring::Keyring_alloc::operator new(unsigned long) (/home/laurynas/obj-5.7-asan-debug/unittest/gunit/keyring/merge_keyring_file_tests-t+0x45471b)
    #4 0x454808 in keyring__keys_container_unittest::Mock_keyring_io::operator>>(keyring::IKey**) (/home/laurynas/obj-5.7-asan-debug/unittest/gunit/keyring/merge_keyring_file_tests-t+0x454808)
    #5 0x48a99d in keyring::Keys_container::load_keys_from_keyring_storage(keyring::IKeyring_io*) /home/laurynas/mysql-server/plugin/keyring/keys_container.cc:158
    #6 0x48acdd in keyring::Keys_container::init(keyring::IKeyring_io*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) /home/laurynas/mysql-server/plugin/keyring/keys_container.cc:57
    #7 0x449f92 in keyring__keys_container_unittest::Keys_container_with_mocked_io_test_ErrorFromIOFlushWhileStoringKey_Test::TestBody() /home/laurynas/mysql-server/unittest/gunit/keyring/keys_container-t.cc:871
    #8 0x1834ebc in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2078
    #9 0x1834ebc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2114
    #10 0x18253bb in testing::Test::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2151
    #11 0x182558a in testing::TestInfo::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2326
    #12 0x18257e6 in testing::TestCase::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2444
    #13 0x1827002 in testing::internal::UnitTestImpl::RunAllTests() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:4315
    #14 0x18359ce in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2078
    #15 0x18359ce in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:2114
    #16 0x1825a27 in testing::UnitTest::Run() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/src/gtest.cc:3926
    #17 0x48b12f in RUN_ALL_TESTS() /home/laurynas/mysql-server/source_downloads/gmock-1.7.0/gtest/include/gtest/gtest.h:2288
    #18 0x48b12f in main /home/laurynas/mysql-server/unittest/gunit/gunit_test_main_server.cc:81
    #19 0x7f0c3f4e482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

(cut)

SUMMARY: AddressSanitizer: 1503 byte(s) leaked in 16 allocation(s).

(cut)
 
95% tests passed, 3 tests failed out of 64

Total Test time (real) =  25.49 sec

The following tests FAILED:
	  4 - pfs_instr-oom (Failed)
	 26 - merge_innodb_tests (Failed)
	 27 - merge_keyring_file_tests (Failed)
Errors while running CTest
[21 Jul 2016 14:00] Laurynas Biveinis
5.6:

$ make test
Running tests...
Test project /home/laurynas/obj-5.6-asan-debug
      Start  1: pfs_instr_class
 1/24 Test  #1: pfs_instr_class ..................   Passed    0.01 sec
      Start  2: pfs_instr_class-oom
 2/24 Test  #2: pfs_instr_class-oom ..............   Passed    0.01 sec
      Start  3: pfs_instr
 3/24 Test  #3: pfs_instr ........................   Passed    0.03 sec
      Start  4: pfs_instr-oom
 4/24 Test  #4: pfs_instr-oom ....................***Failed    0.03 sec
      Start  5: pfs_account-oom
 5/24 Test  #5: pfs_account-oom ..................   Passed    0.01 sec
      Start  6: pfs_host-oom
 6/24 Test  #6: pfs_host-oom .....................   Passed    0.02 sec
      Start  7: pfs_user-oom
 7/24 Test  #7: pfs_user-oom .....................   Passed    0.01 sec
      Start  8: pfs
 8/24 Test  #8: pfs ..............................***Failed    0.77 sec
      Start  9: pfs_misc
 9/24 Test  #9: pfs_misc .........................   Passed    0.01 sec
      Start 10: pfs_connect_attr
10/24 Test #10: pfs_connect_attr .................   Passed    0.02 sec
      Start 11: hp_test1
11/24 Test #11: hp_test1 .........................   Passed    0.02 sec
      Start 12: hp_test2
12/24 Test #12: hp_test2 .........................   Passed    0.54 sec
      Start 13: regex1
13/24 Test #13: regex1 ...........................   Passed    0.02 sec
      Start 14: regex2
14/24 Test #14: regex2 ...........................   Passed    0.03 sec
      Start 15: regex3
15/24 Test #15: regex3 ...........................   Passed    0.02 sec
      Start 16: queues_test
16/24 Test #16: queues_test ......................***Failed    0.21 sec
      Start 17: simple
17/24 Test #17: simple ...........................   Passed    0.21 sec
      Start 18: skip
18/24 Test #18: skip .............................   Passed    0.01 sec
      Start 19: todo
19/24 Test #19: todo .............................   Passed    0.01 sec
      Start 20: skip_all
20/24 Test #20: skip_all .........................   Passed    0.01 sec
      Start 21: no_plan
21/24 Test #21: no_plan ..........................   Passed    0.02 sec
      Start 22: basic
22/24 Test #22: basic ............................   Passed    0.01 sec
      Start 23: merge_large_tests
23/24 Test #23: merge_large_tests ................   Passed    1.15 sec
      Start 24: merge_small_tests
24/24 Test #24: merge_small_tests ................   Passed    3.67 sec

88% tests passed, 3 tests failed out of 24

Total Test time (real) =   6.86 sec

The following tests FAILED:
	  4 - pfs_instr-oom (Failed)
	  8 - pfs (Failed)
	 16 - queues_test (Failed)
Errors while running CTest
Makefile:61: recipe for target 'test' failed
make: *** [test] Error 8
[21 Jul 2016 14:01] Laurynas Biveinis
./storage/perfschema/unittest/pfs_instr-oom-t 
1..20
ok 1 - oom (mutex)
ok 2 - oom (rwlock)
ok 3 - oom (cond)
ok 4 - oom (file)
ok 5 - oom (file handle)
ok 6 - oom (table)
ok 7 - oom (thread)
ok 8 - oom (thread waits history sizing)
ok 9 - oom (per thread wait)
ok 10 - oom (socket)
ok 11 - oom (per thread waits)
ok 12 - oom (thread stages history sizing)
ok 13 - oom (per thread stages)
ok 14 - oom (thread statements history sizing)
ok 15 - oom (per thread statements)
ok 16 - oom (global waits)
ok 17 - init stage class
ok 18 - oom (global stages)
ok 19 - init statement class
ok 20 - oom (global statements)

=================================================================
==26678==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2816000 byte(s) in 1 object(s) allocated from:
    #0 0x7f0792de4602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x40356f in pfs_malloc(unsigned long, int) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_pfs_global.h:39
    #2 0x403607 in pfs_malloc_array(unsigned long, unsigned long, int) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_pfs_global.h:57
    #3 0x406a7d in init_instruments(PFS_global_param const*) /home/laurynas/mysql-server/storage/perfschema/pfs_instr.cc:339
    #4 0x404354 in test_oom() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:355
    #5 0x404f83 in do_all_tests() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:658
    #6 0x404fd3 in main /home/laurynas/mysql-server/storage/perfschema/unittest/pfs_instr-oom-t.cc:667
    #7 0x7f0791ee582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 2816000 byte(s) leaked in 1 allocation(s).
[21 Jul 2016 14:02] Laurynas Biveinis
$ ./storage/perfschema/unittest/pfs-t           
(...)
==26681==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 222080 byte(s) in 1 object(s) allocated from:
    #0 0x7f9eacfb9602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x40341d in pfs_malloc(unsigned long, int) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_print_error.h:24
    #2 0x4034b3 in pfs_malloc_array(unsigned long, unsigned long, int) /home/laurynas/mysql-server/storage/perfschema/unittest/stub_print_error.h:42
    #3 0x41d1e0 in init_table_share(unsigned int) /home/laurynas/mysql-server/storage/perfschema/pfs_instr_class.cc:344
    #4 0x42204c in initialize_performance_schema(PFS_global_param*) /home/laurynas/mysql-server/storage/perfschema/pfs_server.cc:88
    #5 0x403bd6 in load_perfschema() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs-t.cc:176
    #6 0x40a4be in test_file_instrumentation_leak() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs-t.cc:1362
    #7 0x40b786 in do_all_tests() /home/laurynas/mysql-server/storage/perfschema/unittest/pfs-t.cc:1636
    #8 0x40b7d6 in main /home/laurynas/mysql-server/storage/perfschema/unittest/pfs-t.cc:1644
    #9 0x7f9eac65282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
(...)

SUMMARY: AddressSanitizer: 1611440 byte(s) leaked in 64 allocation(s).
[21 Jul 2016 14:03] Laurynas Biveinis
$ ./mysys/queues 
(...)
==27123==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 122160 byte(s) in 45 object(s) allocated from:
    #0 0x7f4809a88602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4050a3 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x402d48 in init_queue /home/laurynas/mysql-server/mysys/queues.c:56
    #3 0x4045f0 in do_test /home/laurynas/mysql-server/mysys/queues.c:581
    #4 0x4047f0 in main /home/laurynas/mysql-server/mysys/queues.c:681
    #5 0x7f480942a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 122160 byte(s) in 45 object(s) allocated from:
    #0 0x7f4809a88602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4050a3 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x402d48 in init_queue /home/laurynas/mysql-server/mysys/queues.c:56
    #3 0x4045f0 in do_test /home/laurynas/mysql-server/mysys/queues.c:581
    #4 0x4047bc in main /home/laurynas/mysql-server/mysys/queues.c:677
    #5 0x7f480942a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 122160 byte(s) in 45 object(s) allocated from:
    #0 0x7f4809a88602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4050a3 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x402d48 in init_queue /home/laurynas/mysql-server/mysys/queues.c:56
    #3 0x4045f0 in do_test /home/laurynas/mysql-server/mysys/queues.c:581
    #4 0x4047a2 in main /home/laurynas/mysql-server/mysys/queues.c:675
    #5 0x7f480942a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 122160 byte(s) in 45 object(s) allocated from:
    #0 0x7f4809a88602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4050a3 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x402d48 in init_queue /home/laurynas/mysql-server/mysys/queues.c:56
    #3 0x4045f0 in do_test /home/laurynas/mysql-server/mysys/queues.c:581
    #4 0x4047d6 in main /home/laurynas/mysql-server/mysys/queues.c:679
    #5 0x7f480942a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 8200 byte(s) in 1 object(s) allocated from:
    #0 0x7f4809a88602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4050a3 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x402d48 in init_queue /home/laurynas/mysql-server/mysys/queues.c:56
    #3 0x404850 in benchmark_test /home/laurynas/mysql-server/mysys/queues.c:618
    #4 0x404850 in main /home/laurynas/mysql-server/mysys/queues.c:684
    #5 0x7f480942a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 496840 byte(s) leaked in 181 allocation(s).
[22 Jul 2016 4:21] MySQL Verification Team
Hello Laurynas,

Thank you for the report.
Confirmed with 5.7.13 source build.

Thanks,
Umesh
[22 Jul 2016 12:07] Laurynas Biveinis
Bug 82307 fix for 5.6

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug82307-5.6.patch (application/octet-stream, text), 2.97 KiB.

[22 Jul 2016 12:29] Laurynas Biveinis
Partial bug 82307 fix for 5.7

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug82307-5.7.patch (application/octet-stream, text), 5.30 KiB.

[22 Jul 2016 12:30] Laurynas Biveinis
The contributed 5.7 fix is only partial for MySQL 5.7.13. It fixes all the issues seen on Percona Server 5.7.13, but it does not solve heap-use-after-free on pfs_instr-oom-t on MySQL.
[2 Dec 2016 20:12] Paul Dubois
Fixed in 5.6.36, 5.7.18, 8.0.1.

Work was done for test suite. No changelog entry needed.