Bug #59021 Valgrind warning in key_unpack()
Submitted: 18 Dec 2010 6:42 Modified: 6 Jan 2011 1:20
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S1 (Critical)
Version:5.5+ OS:Any
Assigned to: Tor Didriksen CPU Architecture:Any
Tags: pb2, test failure

[18 Dec 2010 6:42] Alexander Nozdrin
Description:
Tree: mysql-trunk-bugfixing
Test: main.ctype_utf8.

==2794== Thread 14:
==2794== Conditional jump or move depends on uninitialised value(s)
==2794==    at 0x7F3060: key_unpack(String*, TABLE*, unsigned int) (key.cc:390)
==2794==    by 0x746533: handler::print_keydup_error(unsigned int, char const*) (handler.cc:2842)
==2794==    by 0x746735: handler::print_error(int, int) (handler.cc:2893)
==2794==    by 0x609946: create_myisam_from_heap(THD*, TABLE*, st_columndef*, st_columndef**, int, bool, bool*) (sql_select.cc:16636)
==2794==    by 0x60C33D: end_update(JOIN*, st_join_table*, bool) (sql_select.cc:18753)
==2794==    by 0x864044: JOIN_CACHE::generate_full_extensions(unsigned char*) (sql_join_cache.cc:1956)
==2794==    by 0x864D85: JOIN_CACHE_BNL::join_matching_records(bool) (sql_join_cache.cc:1848)
==2794==    by 0x863486: JOIN_CACHE::join_records(bool) (sql_join_cache.cc:1654)
==2794==    by 0x60B4FC: sub_select_cache(JOIN*, st_join_table*, bool) (sql_select.cc:17161)
==2794==    by 0x60B299: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:17331)
==2794==    by 0x6195A2: do_select(JOIN*, List<Item>*, TABLE*, Procedure*) (sql_select.cc:16909)
==2794==    by 0x635095: JOIN::exec() (sql_select.cc:2913)
==2794== by 0x630E82: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3554)
==2794==    by 0x6370B8: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:323)
==2794==    by 0x5D757D: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4513)
==2794==    by 0x5D84E6: mysql_execute_command(THD*) (sql_parse.cc:2096)

How to repeat:
Check out PB.

This might be related to WL#1393, thus assigning to Tor.
[20 Dec 2010 9:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/127273

3215 Tor Didriksen	2010-12-20
      Bug #59021 Valgrind warning in key_unpack()
      
      Introduced by fix for Bug#57687
     @ sql/sql_select.cc
        Add missing initialization of key_part_info->key_part_flag
[20 Dec 2010 13:05] Tor Didriksen
Pushed to 5.5-bugteam and trunk-bugfixing
[22 Dec 2010 21:30] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (version source revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (merge vers: 5.6.1) (pib:24)
[27 Dec 2010 22:43] Mark Callaghan
It wasn't clear to me from the bug report. This is a problem in 5.5.8

==12807== Thread 13:
==12807== Conditional jump or move depends on uninitialised value(s)
==12807==    at 0x760E37: key_unpack(String*, TABLE*, unsigned) (key.cc:367)
==12807==    by 0x6BFF7E: handler::print_keydup_error(unsigned, char const*) (handler.cc:2645)
==12807==    by 0x6C07E5: handler::print_error(int, int) (handler.cc:2696)
==12807==    by 0x5CC588: create_myisam_from_heap(THD*, TABLE*, TMP_TABLE_PARAM*, int, bool) (sql_select.cc:11172)
==12807==    by 0x5CD5F5: end_update(JOIN*, st_join_table*, bool) (sql_select.cc:12855)
==12807==    by 0x5CB646: flush_cached_records(JOIN*, st_join_table*, bool) (sql_select.cc:11955)
==12807==    by 0x5CBCA9: sub_select_cache(JOIN*, st_join_table*, bool) (sql_select.cc:11494)
==12807==    by 0x5CBAC3: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:11641)
==12807==    by 0x5CE6E8: do_select(JOIN*, List<Item>*, TABLE*, Procedure*) (sql_select.cc:11430)
==12807==    by 0x5DB10D: JOIN::exec() (sql_select.cc:1970)
==12807==    by 0x5DD5C3: mysql_select(THD*, Item***, TABLE_LIST*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned 
long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2570)
==12807==    by 0x5DDAC4: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:297)
==12807==    by 0x592E86: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4452)
==12807==    by 0x5940A8: mysql_execute_command(THD*) (sql_parse.cc:2046)
==12807==    by 0x59AEA9: mysql_parse(THD*, char*, unsigned, Parser_state*) (sql_parse.cc:5496)
==12807==    by 0x59BF5D: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1032)
^ Found warnings in /s/bld/558orig/mysql-test/var/log/mysqld.1.err
ok

 - skipping '/s/bld/558orig/mysql-test/var/log/main.ctype_utf8/'

Retrying test main.ctype_utf8, attempt(2/3)...

main.ctype_utf8                          [ retry-fail ]  Found warnings/errors in server log file!
        Test ended at 2010-12-27 10:06:34
line
==13149== Thread 13:
==13149== Conditional jump or move depends on uninitialised value(s)
==13149==    at 0x760E37: key_unpack(String*, TABLE*, unsigned) (key.cc:367)
==13149==    by 0x6BFF7E: handler::print_keydup_error(unsigned, char const*) (handler.cc:2645)
==13149==    by 0x6C07E5: handler::print_error(int, int) (handler.cc:2696)
==13149==    by 0x5CC588: create_myisam_from_heap(THD*, TABLE*, TMP_TABLE_PARAM*, int, bool) (sql_select.cc:11172)
==13149==    by 0x5CD5F5: end_update(JOIN*, st_join_table*, bool) (sql_select.cc:12855)
==13149==    by 0x5CB646: flush_cached_records(JOIN*, st_join_table*, bool) (sql_select.cc:11955)
==13149==    by 0x5CBCA9: sub_select_cache(JOIN*, st_join_table*, bool) (sql_select.cc:11494)
==13149==    by 0x5CBAC3: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:11641)
==13149==    by 0x5CE6E8: do_select(JOIN*, List<Item>*, TABLE*, Procedure*) (sql_select.cc:11430)
==13149==    by 0x5DB10D: JOIN::exec() (sql_select.cc:1970)
==13149==    by 0x5DD5C3: mysql_select(THD*, Item***, TABLE_LIST*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned 
long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2570)
==13149==    by 0x5DDAC4: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:297)
==13149==    by 0x592E86: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4452)
==13149==    by 0x5940A8: mysql_execute_command(THD*) (sql_parse.cc:2046)
==13149==    by 0x59AEA9: mysql_parse(THD*, char*, unsigned, Parser_state*) (sql_parse.cc:5496)
==13149==    by 0x59BF5D: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1032)
[29 Dec 2010 12:52] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:alexander.nozdrin@oracle.com-20101229113652-km2v993aurv7h79j) (version source revid:alexander.nozdrin@oracle.com-20101229113132-uonlbcc2uopff8yb) (merge vers: 5.5.9) (pib:24)
[6 Jan 2011 1:20] Paul DuBois
Noted in 5.5.9 changelog.

Several Valgrind warnings were fixed.