Valgrind error on tokudb.backup.tokudb_backup_exclude

Bug #1669005 reported by Laurynas Biveinis on 2017-03-01
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
Invalid
Undecided
Unassigned
5.6
Fix Released
High
Vlad Lesin
5.7
Fix Released
High
Vlad Lesin

Bug Description

On 5.6 trunk with Valgrind:

tokudb.backup.tokudb_backup_exclude w1 [ fail ] Found warnings/errors in server log file!
        Test ended at 2017-02-28 01:09:48
Warnings:
Warning 1265 Data truncated for column 'line' at row 4
line
==25727== Thread 39:
==25727== Conditional jump or move depends on uninitialised value(s)
==25727== at 0x4C30F69: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25727== by 0x66BAB93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25727== by 0xE3093CD: tokudb_backup_get_master_infos(THD*, std::vector<tokudb_backup_master_info, std::allocator<tokudb_backup_master_info> >*) (tokudb_backup.cc:359)
==25727== by 0xE309722: tokudb_backup_after_stop_capt_fun(void*) (tokudb_backup.cc:402)
==25727== by 0x4E4D27D: backup_callbacks::after_stop_capt_call() (backup_callbacks.h:71)
==25727== by 0x4E4ADBA: manager::do_backup(directory_set*, backup_callbacks*) (manager.cc:230)
==25727== by 0x4E53C7B: tokubackup_create_backup (backup.cc:406)
==25727== by 0xE30A8E4: tokudb_backup_run(THD*, char const*) (tokudb_backup.cc:981)
==25727== by 0xE30ABD7: tokudb_backup_check_dir(THD*, st_mysql_sys_var*, void*, st_mysql_value*) (tokudb_backup.cc:1029)
==25727== by 0x834F4D: sys_var_pluginvar::do_check(THD*, set_var*) (sql_plugin.cc:3300)
==25727== by 0x754668: sys_var::check(THD*, set_var*) (set_var.cc:213)
==25727== by 0x7555CD: set_var::check(THD*) (set_var.cc:636)
==25727== by 0x755262: sql_set_variables(THD*, List<set_var_base>*, bool) (set_var.cc:575)
==25727== by 0x81E067: mysql_execute_command(THD*) (sql_parse.cc:4236)
==25727== by 0x825D26: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:7056)
==25727== by 0x816EAF: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1485)
^ Found warnings in /mnt/workspace/percona-server-5.6-valgrind/BUILD_TYPE/valgrind/Host/ubuntu-xenial-64bit/build/mysql-test/var/1/log/mysqld.1.err

tags: added: tokubackup valgrind
Vlad Lesin (vlad-lesin) wrote :

There is also another valgrind report:

68 bytes in 1 blocks are definitely lost in loss record 4 of 5
   at 0x1874A91: my_malloc (my_malloc.c:62)
   by 0x187510E: my_strdup (my_malloc.c:309)
   by 0x2BA29DAA: ???
   by 0x2BA29F1C: ???
   by 0x2BA2BF80: ???
   by 0x2BA2C7AB: ???
   by 0x155F448: sys_var_pluginvar::do_check(THD*, set_var*) (sql_plugin.cc:3524)
   by 0x145CB7D: sys_var::check(THD*, set_var*) (set_var.cc:241)
   by 0x145DD0A: set_var::check(THD*) (set_var.cc:757)
   by 0x145D76A: sql_set_variables(THD*, List<set_var_base>*, bool) (set_var.cc:665)
   by 0x152D67F: mysql_execute_command(THD*, bool) (sql_parse.cc:3896)
   by 0x1533116: mysql_parse(THD*, Parser_state*) (sql_parse.cc:5927)
   by 0x1527936: dispatch_command(THD*, COM_DATA const*, enum_server_command) (sql_parse.cc:1493)
   by 0x152677C: do_command(THD*) (sql_parse.cc:1021)
   by 0x166CAAF: handle_connection (connection_handler_per_thread.cc:312)
   by 0x18CDE7A: pfs_spawn_thread (pfs.cc:2188)

which is caused by the following code:

static void tokudb_backup_set_error(THD *thd, int error, const char *error_string) {
    THDVAR(thd, last_error) = error;
    char *old_error_string = THDVAR(thd, last_error_string);
    if (error_string)
        THDVAR(thd, last_error_string) =
            my_strdup(tokudb_backup_mem_key, error_string, MYF(MY_FAE));
    else
        THDVAR(thd, last_error_string) = NULL;
    if (old_error_string)
        my_free(old_error_string);
}

i.e. the memory is allocated for error string and deallocated only when new error string is set.

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

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

Other bug subscribers