memory leak in mysqlbinlog

Bug #1582761 reported by Laurynas Biveinis
8
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
Fix Released
Low
Laurynas Biveinis
5.6
Fix Released
Low
Laurynas Biveinis
5.7
Invalid
Undecided
Unassigned

Bug Description

This is a copy of https://bugs.mysql.com/bug.php?id=78223:

rpl.rpl_row_mysqlbinlog 'row' [ fail ]
...
=================================================================
==3018==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7f573942c54a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9854a)
    #1 0x4b63a8 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x426229 in Log_event::operator new(unsigned long) /home/laurynas/mysql-server/sql/log_event.h:1071
    #3 0x426229 in Log_event::read_log_event(char const*, unsigned int, char const**, Format_description_log_event const*) /home/laurynas/mysql-server/sql/log_event.cc:1300
    #4 0x42d855 in dump_remote_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:1844
    #5 0x42d855 in dump_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:1685
    #6 0x42e8aa in main /home/laurynas/mysql-server/client/mysqlbinlog.cc:2354
    #7 0x7f573853f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 18 byte(s) in 1 object(s) allocated from:
    #0 0x7f573942c54a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9854a)
    #1 0x4b63a8 in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:38
    #2 0x4b6aa8 in my_strndup /home/laurynas/mysql-server/mysys/my_malloc.c:161
    #3 0x41dd7e in Rotate_log_event::Rotate_log_event(char const*, unsigned int, Format_description_log_event const*) /home/laurynas/mysql-server/sql/log_event.cc:5299
    #4 0x426240 in Log_event::read_log_event(char const*, unsigned int, char const**, Format_description_log_event const*) /home/laurynas/mysql-server/sql/log_event.cc:1300
    #5 0x42d855 in dump_remote_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:1844
    #6 0x42d855 in dump_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:1685
    #7 0x42e8aa in main /home/laurynas/mysql-server/client/mysqlbinlog.cc:2354
    #8 0x7f573853f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Fixed in 5.7 by

commit 6772eb52d666bfc11b52b1c99e27bd7d96874f01
Author: Andrei Elkin <email address hidden>
Date: Fri Dec 11 17:14:06 2015 +0200

    Bug#21697461 MEMORY LEAK IN MYSQLBINLOG

    **Problem description**

    At running mtr with a recently introduced --valgrind-clients
    instances of not deallocated memory were revealed along the following
    execution path:

    Rotate_log_event::Rotate_log_event() -> ...
        inary_log::Rotate_event::Rotate_event() ->
           bapi_strndup() -> ... my_raw_malloc

    The reason is turned down to be missed 'delete' for fake
    (as defined by ev->when == 0) Rotate event
    in case binlog is read from a running server (remote dumping).

    **Fixed**

    with calling the delete operator in proper places where
    the fake Rotate event becomes out of interest at once after its reading,
    that is its handling skips process_event().

    That's done with care to clear the event's temp_buf.

tags: added: asan ci upstream
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

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

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.