Bug #74570 Conditional jump or move depends on uninitialised value(s) in create_tmp_table
Submitted: 26 Oct 2014 15:28 Modified: 29 Oct 2014 15:13
Reporter: Elena Stepanova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.6, 5.6.21 OS:Linux (Wheezy 64bit + valgrind-3.10.0 or valgrind-3.9.0)
Assigned to: CPU Architecture:Any

[26 Oct 2014 15:28] Elena Stepanova
Description:
==5708== Thread 18:
==5708== Conditional jump or move depends on uninitialised value(s)
==5708==    at 0x78C84C: create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, char const*) (sql_tmp_table.cc:624)
==5708==    by 0x76E1F9: create_schema_table(THD*, TABLE_LIST*) (sql_show.cc:6945)
==5708==    by 0x771AC6: mysql_schema_table(THD*, LEX*, TABLE_LIST*) (sql_show.cc:7174)
==5708==    by 0x7010C5: open_and_process_table(THD*, LEX*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*) (sql_base.cc:4518)
==5708==    by 0x7025DD: open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) (sql_base.cc:5068)
==5708==    by 0x702A9C: open_normal_and_derived_tables(THD*, TABLE_LIST*, unsigned int) (sql_base.cc:5756)
==5708==    by 0x60FFA1: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5076)
==5708==    by 0x741132: mysql_execute_command(THD*) (sql_parse.cc:2649)
==5708==    by 0x742BD7: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6245)
==5708==    by 0x7439D9: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1332)
==5708==    by 0x7169DE: do_handle_one_connection(THD*) (sql_connect.cc:982)
==5708==    by 0x716A5F: handle_one_connection (sql_connect.cc:898)
==5708==    by 0xAAA0DF: pfs_spawn_thread (pfs.cc:1860)
==5708==    by 0x4E37B4F: start_thread (pthread_create.c:304)
==5708==    by 0x610D20C: clone (clone.S:112)

How to repeat:
- build server as cmake . -DWITH_VALGRIND=YES && make
- perl ./mtr innodb.add_foreign_key --valgrind-mysqld
[29 Oct 2014 15:13] MySQL Verification Team
Hello Elena,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[29 Oct 2014 15:14] MySQL Verification Team
// This seems to OS specific(Debian + latest Valgrind)

## OS
ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$ cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"
ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$ valgrind --version
valgrind-3.10.0
ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$ cmake --version
cmake version 2.8.9
ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$ gdb --version
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

// 

ushastry@ushastry:/home/ushastry/Downloads# md5sum mysql-5.6.21.tar.gz 
e47c3a70b8d89db3199a349204b2ae4e  mysql-5.6.21.tar.gz
ushastry@ushastry:/home/ushastry/Downloads# tar -zxvf mysql-5.6.21.tar.gz 
ushastry@ushastry:/home/ushastry/Downloads# cd mysql-5.6.21
ushastry@ushastry:/home/ushastry/Downloads/mysql-5.6.21# cmake . -DCMAKE_INSTALL_PREFIX=/home/ushastry/Downloads/mysql-5.6.21 -DWITH_VALGRIND=YES
ushastry@ushastry:/home/ushastry/Downloads/mysql-5.6.21# make
ushastry@ushastry:/home/ushastry/Downloads/mysql-5.6.21# cd mysql-test
ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$ perl ./mtr innodb.add_foreign_key --valgrind-mysqld
Logging: ./mtr  innodb.add_foreign_key --valgrind-mysqld
2014-10-29 20:36:07 12365 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2014-10-29 20:36:07 12365 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)

2014-10-29 20:36:07 12365 [Note] Plugin 'FEDERATED' is disabled.
2014-10-29 20:36:07 12365 [Note] Binlog end
2014-10-29 20:36:07 12365 [Note] Shutting down plugin 'CSV'
2014-10-29 20:36:07 12365 [Note] Shutting down plugin 'MyISAM'
MySQL Version 5.6.21
Turning on valgrind for mysqld(s) only
Running valgrind with options " --show-reachable=yes "
Turning off --check-testcases to save time when valgrinding
Checking supported features...
 - SSL connections supported
Collecting tests...
Checking leftover processes...
Removing old var directory...
Creating var directory '/home/ushastry/Downloads/mysql-5.6.21/mysql-test/var'...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
innodb.add_foreign_key                   [ fail ]  Found warnings/errors in server log file!
        Test ended at 2014-10-29 20:36:33
line
==12391== Thread 18:
==12391== Conditional jump or move depends on uninitialised value(s)
==12391==    at 0x78C6FC: create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, char const*) (sql_tmp_table.cc:624)
==12391==    by 0x76E0A9: create_schema_table(THD*, TABLE_LIST*) (sql_show.cc:6945)
==12391==    by 0x771976: mysql_schema_table(THD*, LEX*, TABLE_LIST*) (sql_show.cc:7174)
==12391==    by 0x700F75: open_and_process_table(THD*, LEX*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*) (sql_base.cc:4518)
==12391==    by 0x70248D: open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) (sql_base.cc:5068)
==12391==    by 0x70294C: open_normal_and_derived_tables(THD*, TABLE_LIST*, unsigned int) (sql_base.cc:5756)
==12391==    by 0x60FE51: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5076)
==12391==    by 0x740FE2: mysql_execute_command(THD*) (sql_parse.cc:2649)
==12391==    by 0x742A87: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6245)
==12391==    by 0x743889: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1332)
==12391==    by 0x71688E: do_handle_one_connection(THD*) (sql_connect.cc:982)
==12391==    by 0x71690F: handle_one_connection (sql_connect.cc:898)
==12391==    by 0x95EA1F: pfs_spawn_thread (pfs.cc:1860)
==12391==    by 0x4E37B4F: start_thread (pthread_create.c:304)
==12391==    by 0x5F0B7BC: clone (clone.S:112)
^ Found warnings in /home/ushastry/Downloads/mysql-5.6.21/mysql-test/var/log/mysqld.1.err
ok

 - saving '/home/ushastry/Downloads/mysql-5.6.21/mysql-test/var/log/innodb.add_foreign_key/' to '/home/ushastry/Downloads/mysql-5.6.21/mysql-test/var/log/innodb.add_foreign_key/'
worker[1] Valgrind report from /home/ushastry/Downloads/mysql-5.6.21/mysql-test/var/log/mysqld.1.err after tests:
 innodb.add_foreign_key
--------------------------------------------------------------------------
HEAP SUMMARY:
    in use at exit: 67,740,421 bytes in 1,120 blocks
  total heap usage: 48,662 allocs, 47,542 frees, 134,602,136 bytes allocated

Thread 1:
288 bytes in 1 blocks are possibly lost in loss record 277 of 391
   at 0x4C277E3: calloc (vg_replace_malloc.c:623)
   by 0x401128E: allocate_dtv (dl-tls.c:297)
   by 0x401128E: _dl_allocate_tls (dl-tls.c:463)
   by 0x4E384ED: allocate_stack (allocatestack.c:585)
   by 0x4E384ED: pthread_create@@GLIBC_2.2.5 (pthread_create.c:471)
   by 0x95E895: spawn_thread_v1 (pfs.cc:1910)
   by 0x62B6F0: signal_hand (mysqld.cc:3213)
   by 0x95EA1F: pfs_spawn_thread (pfs.cc:1860)
   by 0x4E37B4F: start_thread (pthread_create.c:304)
   by 0x5F0B7BC: clone (clone.S:112)

LEAK SUMMARY:
   definitely lost: 0 bytes in 0 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 288 bytes in 1 blocks
   still reachable: 0 bytes in 0 blocks
        suppressed: 67,740,133 bytes in 1,119 blocks

For counts of detected and suppressed errors, rerun with: -v
Use --track-origins=yes to see where uninitialised values come from
ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 340 from 340)

valgrind_report                          [ fail ]
        Test ended at 2014-10-29 20:36:33

Valgrind reported failures at shutdown, see above

--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.000 of 26 seconds executing testcases
mysql-test-run: WARNING: Got errors/warnings while running tests, please examine '/home/ushastry/Downloads/mysql-5.6.21/mysql-test/var/log/warnings' for details.

Completed: Failed 2/2 tests, 0.00% were successful.

Failing test(s): innodb.add_foreign_key valgrind_report

The log files in var/log may give you some hint of what went wrong.

If you want to report this error, please read first the documentation
at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html

mysql-test-run: *** ERROR: there were failing test cases
ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$
[29 Oct 2014 15:16] MySQL Verification Team
// Couldn't reproduce this on Ubuntu 14.10, OL6(3.8 valgrind) etc..May be just Debian specific issue?

ushastry@ushastry:~/Downloads/mysql-5.6.21$ valgrind --version
valgrind-3.10.0
ushastry@ushastry:~/Downloads/mysql-5.6.21$ cmake --version
cmake version 2.8.12.2
ushastry@ushastry:~/Downloads/mysql-5.6.21$ 
ushastry@ushastry:~/Downloads/mysql-5.6.21$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.10
DISTRIB_CODENAME=utopic
DISTRIB_DESCRIPTION="Ubuntu 14.10"
NAME="Ubuntu"
VERSION="14.10 (Utopic Unicorn)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.10"
VERSION_ID="14.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

ushastry@ushastry:~/Downloads/mysql-5.6.21$ cmake . -DCMAKE_INSTALL_PREFIX=/home/ushastry/Downloads/mysql-5.6.21 -DWITH_VALGRIND=YES
ushastry@ushastry:~/Downloads/mysql-5.6.21$ make
ushastry@ushastry:~/Downloads/mysql-5.6.21$ make install

ushastry@ushastry:~/Downloads/mysql-5.6.21/mysql-test$ perl ./mtr innodb.add_foreign_key --valgrind-mysqld
Logging: ./mtr  innodb.add_foreign_key --valgrind-mysqld
2014-10-29 18:08:02 28439 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2014-10-29 18:08:02 28439 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)

2014-10-29 18:08:02 28439 [Note] Plugin 'FEDERATED' is disabled.
2014-10-29 18:08:02 28439 [Note] Binlog end
2014-10-29 18:08:02 28439 [Note] Shutting down plugin 'MyISAM'
2014-10-29 18:08:02 28439 [Note] Shutting down plugin 'CSV'
MySQL Version 5.6.21
Turning on valgrind for mysqld(s) only
Running valgrind with options " --show-reachable=yes "
Turning off --check-testcases to save time when valgrinding
Checking supported features...
 - SSL connections supported
Collecting tests...
Removing old var directory...
Creating var directory '/home/ushastry/Downloads/mysql-5.6.21/mysql-test/var'...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
innodb.add_foreign_key                   [ pass ]   6574
valgrind_report                          [ pass ]       
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 6.574 of 25 seconds executing testcases

Completed: All 2 tests were successful.

######