Valgrind error on tokudb.backup.tokudb_backup_exclude

Bug #1669005 reported by Laurynas Biveinis on 2017-03-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to
Status tracked in 5.7
Fix Released
Vlad Lesin
Fix Released
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
Warning 1265 Data truncated for column 'line' at row 4
==25727== Thread 39:
==25727== Conditional jump or move depends on uninitialised value(s)
==25727== at 0x4C30F69: strlen (in /usr/lib/valgrind/
==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/
==25727== by 0xE3093CD: tokudb_backup_get_master_infos(THD*, std::vector<tokudb_backup_master_info, std::allocator<tokudb_backup_master_info> >*) (
==25727== by 0xE309722: tokudb_backup_after_stop_capt_fun(void*) (
==25727== by 0x4E4D27D: backup_callbacks::after_stop_capt_call() (backup_callbacks.h:71)
==25727== by 0x4E4ADBA: manager::do_backup(directory_set*, backup_callbacks*) (
==25727== by 0x4E53C7B: tokubackup_create_backup (
==25727== by 0xE30A8E4: tokudb_backup_run(THD*, char const*) (
==25727== by 0xE30ABD7: tokudb_backup_check_dir(THD*, st_mysql_sys_var*, void*, st_mysql_value*) (
==25727== by 0x834F4D: sys_var_pluginvar::do_check(THD*, set_var*) (
==25727== by 0x754668: sys_var::check(THD*, set_var*) (
==25727== by 0x7555CD: set_var::check(THD*) (
==25727== by 0x755262: sql_set_variables(THD*, List<set_var_base>*, bool) (
==25727== by 0x81E067: mysql_execute_command(THD*) (
==25727== by 0x825D26: mysql_parse(THD*, char*, unsigned int, Parser_state*) (
==25727== by 0x816EAF: dispatch_command(enum_server_command, THD*, char*, unsigned int) (
^ 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*) (
   by 0x145CB7D: sys_var::check(THD*, set_var*) (
   by 0x145DD0A: set_var::check(THD*) (
   by 0x145D76A: sql_set_variables(THD*, List<set_var_base>*, bool) (
   by 0x152D67F: mysql_execute_command(THD*, bool) (
   by 0x1533116: mysql_parse(THD*, Parser_state*) (
   by 0x1527936: dispatch_command(THD*, COM_DATA const*, enum_server_command) (
   by 0x152677C: do_command(THD*) (
   by 0x166CAAF: handle_connection (
   by 0x18CDE7A: pfs_spawn_thread (

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));
        THDVAR(thd, last_error_string) = NULL;
    if (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:

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

Other bug subscribers