Bug #55042 valgrind reports error in best_access_path when running subquery_mat_all
Submitted: 7 Jul 2010 7:05 Modified: 22 Nov 2010 1:17
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:mysql-next-mr-opt-backporting, 5.6.99 OS:Any
Assigned to: Tor Didriksen CPU Architecture:Any
Tags: valgrind

[7 Jul 2010 7:05] Olav Sandstå
Description:
When running the subquery_mat_all test with valgrind it reports the following error:

==32680== Thread 13:
==32680== Conditional jump or move depends on uninitialised value(s)
==32680==    at 0x5FC455: best_access_path(JOIN*, st_join_table*, unsigned long long, unsigned, bool, double, st_position*, st_position*) (sql_select.cc:6828)
==32680==    by 0x5FCFFA: optimize_wo_join_buffering(JOIN*, unsigned, unsigned, unsigned long long, bool, unsigned, double*, double*, double*) (sql_select.cc:13149)
==32680==    by 0x5FD853: advance_sj_state(JOIN*, unsigned long long, st_join_table const*, unsigned, double*, double*, st_position*) (sql_select.cc:13404)
==32680==    by 0x60CD36: best_extension_by_limited_search(JOIN*, unsigned long long, unsigned, double, double, unsigned, unsigned) (sql_select.cc:7757)
==32680==    by 0x60D08C: best_extension_by_limited_search(JOIN*, unsigned long long, unsigned, double, double, unsigned, unsigned) (sql_select.cc:7813)
==32680==    by 0x60D08C: best_extension_by_limited_search(JOIN*, unsigned long long, unsigned, double, double, unsigned, unsigned) (sql_select.cc:7813)
==32680==    by 0x60D414: greedy_search(JOIN*, unsigned long long, unsigned, unsigned) (sql_select.cc:7468)
==32680==    by 0x60D91E: choose_plan(JOIN*, unsigned long long) (sql_select.cc:7063)
==32680==    by 0x60FD49: make_join_statistics(JOIN*, TABLE_LIST*, Item*, st_dynamic_array*) (sql_select.cc:4670)
==32680==    by 0x613629: JOIN::optimize() (sql_select.cc:1717)
==32680== by 0x618348: 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:3250)
==32680==    by 0x6188E8: mysql_explain_union(THD*, st_select_lex_unit*, select_result*) (sql_select.cc:22543)
==32680==    by 0x5BF318: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4868)
==32680==    by 0x5C060E: mysql_execute_command(THD*) (sql_parse.cc:2330)
==32680==    by 0x5C7F31: mysql_parse(THD*, char const*, unsigned, Parser_state*) (sql_parse.cc:5923)
==32680==    by 0x5C955A: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1136)

How to repeat:
This test failure is seen in pushbuild for the mysql-next-mr-opt-bugfixing tree on the valgrind platform.
[7 Jul 2010 7:13] Guilhem Bichot
it's the "record_count" parameter of best_access_path() which is a random value
[7 Jul 2010 21:05] Sveta Smirnova
Thank you for the report.

Verified as described.
[20 Jul 2010 13:29] 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/113952

3217 Tor Didriksen	2010-07-20
      Bug #55042 valgrind reports error in best_access_path when running subquery_mat_all
      
      The code was using loose_scan_pos, even though it was explicitly set to invalid.
     @ sql/sql_select.cc
        Do not use loose_scan_pos in optimize_wo_join_buffering() if it has a cost of DBL_MAX
        (as determined by best_access_path())
[21 Jul 2010 12:47] 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/114034

3217 Tor Didriksen	2010-07-21
      Bug #55042 valgrind reports error in best_access_path when running subquery_mat_all
      
      The code was using loose_scan_pos, even though it was explicitly set to invalid.
     @ sql/sql_select.cc
        Do not use loose_scan_pos in optimize_wo_join_buffering() if it has a cost of DBL_MAX (as determined by best_access_path())
        
        Remove sj_inner_fanout output argument, it was unused.
[22 Jul 2010 7:06] 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/114110

3217 Tor Didriksen	2010-07-22
      Bug #55042 valgrind reports error in best_access_path when running subquery_mat_all
      
      The code was using loose_scan_pos, even though it was explicitly set to invalid.
     @ sql/sql_select.cc
        Terminate search in optimize_wo_join_buffering() if we has a cost of DBL_MAX (as determined by best_access_path())
        
        Remove sj_inner_fanout output argument, it was unused.
[27 Jul 2010 8:47] 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/114409

3219 Tor Didriksen	2010-07-27
      Bug #55042 valgrind reports error in best_access_path when running subquery_mat_all
      
      The code was using loose_scan_pos, even though it was explicitly set to invalid.
     @ sql/sql_select.cc
        Terminate search in optimize_wo_join_buffering() if we has a cost of DBL_MAX (as determined by best_access_path())
        
        Remove sj_inner_fanout output argument, it was unused.
[27 Jul 2010 11:52] Tor Didriksen
Pushed to my:next-mr-opt-backporting
[16 Aug 2010 6:41] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[13 Nov 2010 16:27] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (merge vers: 5.6.99-m4) (pib:21)
[22 Nov 2010 1:17] Paul DuBois
Not in any released 5.6.x version. No changelog entry needed.