mysqltest memory leaks

Bug #1582718 reported by Laurynas Biveinis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
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
Laurynas Biveinis

Bug Description

On 5.5:

rpl.rpl_get_lock 'mix' w4 [ fail ]
        Test ended at 2016-05-12 08:22:58

CURRENT_TEST: rpl.rpl_get_lock

=================================================================
==20959==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8199 byte(s) in 1 object(s) allocated from:
    #0 0x7f6dc4bc454a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9854a)
    #1 0x48abb2 in my_malloc /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/my_malloc.c:38
    #2 0x439097 in my_net_init /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/sql/net_serv.cc:116
    #3 0x434ddd in mysql_real_connect /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/sql-common/client.c:3346
    #4 0x422c75 in connect_n_handle_errors(st_command*, st_mysql*, char const*, char const*, char const*, char const*, int, char const*) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:5388
    #5 0x42352e in do_connect(st_command*) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:5664
    #6 0x42648d in main /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:8646
    #7 0x7f6dc399582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 8199 byte(s) leaked in 1 allocation(s).

rpl.rpl_test_framework 'stmt' w4 [ fail ]
        Test ended at 2016-05-12 08:48:14

CURRENT_TEST: rpl.rpl_test_framework

=================================================================
==8364==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 680 byte(s) in 34 object(s) allocated from:
    #0 0x7f8fe2a3c54a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9854a)
    #1 0x48abb2 in my_malloc /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/my_malloc.c:38
    #2 0x48b270 in my_strdup /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/my_malloc.c:152
    #3 0x4220f9 in do_close_connection(st_command*) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:5226
    #4 0x4264b5 in main /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:8651
    #5 0x7f8fe180d82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 680 byte(s) leaked in 34 allocation(s).

main.mysqltest w4 [ fail ]
...
=================================================================
==12210==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 2 object(s) allocated from:
    #0 0x7f9ebc36b8ca in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x988ca)
    #1 0x48b0a8 in my_realloc /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/my_malloc.c:107
    #2 0x494d9c in dynstr_append_mem /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/mysys/string.c:106
    #3 0x40b434 in do_eval(st_dynamic_string*, char const*, char const*, char) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:972
    #4 0x40ba91 in check_command_args(st_command*, char const*, command_arg const*, int, char) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:1170
    #5 0x41cbbb in var_set_query_get_value(st_command*, VAR*) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:2592
    #6 0x41c71b in eval_expr(VAR*, char const*, char const**, bool, bool) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:2748
    #7 0x41d20a in var_set(char const*, char const*, char const*, char const*) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:2292
    #8 0x41ff25 in do_let(st_command*) /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:4576
    #9 0x426b5d in main /mnt/workspace/percona-server-5.5-asan-param/BUILD_TYPE/debug-asan/Host/ubuntu-xenial-64bit/client/mysqltest.cc:8748
    #10 0x7f9ebb13c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 2 allocation(s).

The fix would be to backport 81bf791dfe82ceb78b98e0bcf6c9eb61743fe600 from 5.7:

commit 81bf791dfe82ceb78b98e0bcf6c9eb61743fe600
Author: Jon Olav Hauglid <email address hidden>
Date: Fri Jun 19 16:00:25 2015 +0200

    Bug#21254060: ASAN: MEMORY LEAK IN MYSQLTEST

    Fix 3 different memory leaks in mysqltest:
    1) Call dynstr_free() also in case of error.
    2) Call end_server() also when doing dirty close.
    3) Free st_connection::name before assigning new name.

    Also fixes a valgrind warning about
    Conditional jump or move depends on uninitialised value(s)

Tags: asan ci upstream
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-3438

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

Other bug subscribers

Remote bug watches

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