← Back to team overview

enterprise-support team mailing list archive

[Bug 1587840] [NEW] mysqlbinlog does not free the existing connection before opening new remote one

 

Public bug reported:

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

[1 Jun 11:26] Laurynas Biveinis
Description:
"mysqlbinlog --read-from-remote-server log1 log2" opens a new connection to read log2 without freeing the one used for reading log1.

How to repeat:
On 5.7, with LeakSanitizer-enabled AddressSanitizer:
cmake ... -DWITH_ASAN=ON ...
...
$ ./mtr --debug-server binlog_mysqlbinlog_start_stop
...
binlog.binlog_mysqlbinlog_start_stop 'mix' [ fail ]
        Test ended at 2016-06-01 14:17:00

CURRENT_TEST: binlog.binlog_mysqlbinlog_start_stop

=================================================================
==5002==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1336 byte(s) in 1 object(s) allocated from:
    #0 0x7fd39899e6e9 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x986e9)
    #1 0x4e939f in my_raw_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:189
    #2 0x4e939f in my_malloc /home/laurynas/mysql-server/mysys/my_malloc.c:54
    #3 0x46a62e in mysql_init /home/laurynas/mysql-server/sql-common/client.c:2446
    #4 0x448569 in safe_connect /home/laurynas/mysql-server/client/mysqlbinlog.cc:2260
    #5 0x448569 in dump_remote_log_entries /home/laurynas/mysql-server/client/mysqlbinlog.cc:2539
    #6 0x448569 in dump_single_log /home/laurynas/mysql-server/client/mysqlbinlog.cc:2328
    #7 0x448569 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 0x7fd39789b82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

(...other connection and SSL-related leaks)

Suggested fix:
At the start of safe_connect(), if mysql != NULL, call mysql_close for it, before mysql_init
[1 Jun 11:35] Laurynas Biveinis
The same issue exists on 5.5 and 5.6, but there it's masked by other LSan/client Valgrind bugs: bug 80014, bug 81674, bug 78223

** Affects: mysql-server
     Importance: Unknown
         Status: Unknown

** Affects: percona-server
     Importance: Medium
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: Triaged

** Affects: percona-server/5.5
     Importance: Medium
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: In Progress

** Affects: percona-server/5.6
     Importance: Medium
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: Triaged

** Affects: percona-server/5.7
     Importance: Medium
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: Triaged


** Tags: asan ci upstream

** Also affects: percona-server/5.6
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.5
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.7
   Importance: Undecided
       Status: New

** Tags added: asan ci upstream

** Bug watch added: MySQL Bug System #81675
   http://bugs.mysql.com/bug.php?id=81675

** Also affects: mysql-server via
   http://bugs.mysql.com/bug.php?id=81675
   Importance: Unknown
       Status: Unknown

** Changed in: percona-server/5.5
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Changed in: percona-server/5.6
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Changed in: percona-server/5.7
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Changed in: percona-server/5.5
   Importance: Undecided => Medium

** Changed in: percona-server/5.6
   Importance: Undecided => Medium

** Changed in: percona-server/5.7
   Importance: Undecided => Medium

** Changed in: percona-server/5.5
       Status: New => In Progress

** Changed in: percona-server/5.6
       Status: New => Triaged

** Changed in: percona-server/5.7
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Server/Client Support Team, which is subscribed to MySQL.
Matching subscriptions: Ubuntu Server/Client Support Team
https://bugs.launchpad.net/bugs/1587840

Title:
  mysqlbinlog does not free the existing connection before opening new
  remote one

To manage notifications about this bug go to:
https://bugs.launchpad.net/mysql-server/+bug/1587840/+subscriptions


Follow ups