Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-3440

LP #1582761: memory leak in mysqlbinlog

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      **Reported in Launchpad by Laurynas Biveinis last update 23-05-2016 09:08:57

      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 <andrei.elkin@oracle.com>
      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.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lpjirasync lpjirasync (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Smart Checklist