main.mysqlbinlog_debug fails with a LeakSanitizer error

Bug #1604462 reported by Laurynas Biveinis on 2016-07-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Invalid
Undecided
Unassigned
5.6
Fix Released
Low
Laurynas Biveinis
5.7
Fix Released
Low
Laurynas Biveinis

Bug Description

Copy of http://bugs.mysql.com/bug.php?id=82283:

[19 Jul 15:13] Laurynas Biveinis
Description:
On a system with AddressSanitizer support that includes LeakSanitizer, -DWITH_ASAN=ON -DCMAKE_BUILD_TYPE=Debug configured server will give

$ ./mtr --debug-server mysqlbinlog_debug
...
main.mysqlbinlog_debug [ fail ]
        Test ended at 2016-07-19 18:09:31

CURRENT_TEST: main.mysqlbinlog_debug
mysqltest: At line 14: command "$MYSQL_BINLOG -#d,simulate_result_file_write_error_for_FD_event --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT -r$MYSQLTEST_VARDIR/tmp/ master-bin.000001 2>&1" failed with wrong error: 42

The result from queries just before the failure was:
#
# Bug#18742916 : MYSQLBINLOG --RAW DOES NOT CHECK FOR ERRORS
#
safe_process[939]: Child process: 940, exit: 1

If "2>&1" is removed, then the output contains

URRENT_TEST: main.mysqlbinlog_debug
ERROR: Could not write into log file '/home/laurynas/obj-5.7-asan-debug/mysql-test/var/tmp/master-bin.000001'

=================================================================
==1117==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 336 byte(s) in 1 object(s) allocated from:
    #0 0x7fd08b154602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x4e9004 in my_raw_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:191
    #2 0x4e9004 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:54
    #3 0x4168c2 in Log_event::operator new(unsigned long) /home/laurynas/mysql-server/sql/log_event.cc:737
    #4 0x42cdb7 in Log_event::read_log_event(char const*, unsigned int, char const**, Format_description_log_event const*, char) /home/laurynas/mysql-server/sql/log_event.cc:1592
    #5 0x449231 in dump_remote_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:2692
    #6 0x449231 in dump_single_log /home/laurynas/mysql-server/client/mysqlbinlog.cc:2328
    #7 0x449231 in dump_multiple_logs /home/laurynas/mysql-server/client/mysqlbinlog.cc:2368
    #8 0x44a6de in main /home/laurynas/mysql-server/client/mysqlbinlog.cc:3430
    #9 0x7fd08a05182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 78 byte(s) in 1 object(s) allocated from:
    #0 0x7fd08b155532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532)
    #1 0x5be727 in __gnu_cxx::new_allocator<unsigned char>::allocate(unsigned long, void const*) /usr/include/c++/5/ext/new_allocator.h:104
    #2 0x5be727 in __gnu_cxx::__alloc_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) /usr/include/c++/5/ext/alloc_traits.h:182
    #3 0x5be727 in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) /usr/include/c++/5/bits/stl_vector.h:170
    #4 0x5be727 in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_range_insert<char const*>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, char const*, char const*, std::forward_iterator_tag) /usr/include/c++/5/bits/vector.tcc:659
    #5 0x5bc215 in void std::vector<unsigned char, std::allocator<unsigned char> >::_M_insert_dispatch<char const*>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, char const*, char const*, std::__false_type) /usr/include/c++/5/bits/stl_vector.h:1377
    #6 0x5bc215 in void std::vector<unsigned char, std::allocator<unsigned char> >::insert<char const*>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, char const*, char const*) /usr/include/c++/5/bits/stl_vector.h:1125
    #7 0x5bc215 in binary_log::Format_description_event::Format_description_event(char const*, unsigned int, binary_log::Format_description_event const*) /home/laurynas/mysql-server/libbinlogevents/src/control_events.cpp:345
    #8 0x41ae85 in Format_description_log_event::Format_description_log_event(char const*, unsigned int, binary_log::Format_description_event const*) /home/laurynas/mysql-server/sql/log_event.cc:5242
    #9 0x42cdd2 in Log_event::read_log_event(char const*, unsigned int, char const**, Format_description_log_event const*, char) /home/laurynas/mysql-server/sql/log_event.cc:1592
    #10 0x449231 in dump_remote_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:2692
    #11 0x449231 in dump_single_log /home/laurynas/mysql-server/client/mysqlbinlog.cc:2328
    #12 0x449231 in dump_multiple_logs /home/laurynas/mysql-server/client/mysqlbinlog.cc:2368
    #13 0x44a6de in main /home/laurynas/mysql-server/client/mysqlbinlog.cc:3430
    #14 0x7fd08a05182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 414 byte(s) leaked in 2 allocation(s).
mysqltest: At line 14: command "$MYSQL_BINLOG -#d,simulate_result_file_write_error_for_FD_event --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT -r$MYSQLTEST_VARDIR/tmp/ master-bin.000001" failed with wrong error: 42

The result from queries just before the failure was:
#
# Bug#18742916 : MYSQLBINLOG --RAW DOES NOT CHECK FOR ERRORS
#
safe_process[1109]: Child process: 1110, exit: 1

How to repeat:
CMake options -DWITH_ASAN=ON -DCMAKE_BUILD_TYPE=Debug
$ ./mtr --debug-server mysqlbinlog_debug

tags: added: asan ci upstream

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2156

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.