Sporadic wrong results and valgrind failure in/below mm_* functions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Igor Babaev |
Bug Description
The RQG command line below reports queries for which using two different plans returns different results, plus a valgrind failure. Unfortunately, it is not possible to reproduce either the different results nor the valgrind failure outside of the RQG.
Valgrind failure:
==31917== Conditional jump or move depends on uninitialised value(s)
==31917== at 0x83B9EBE: sel_trees_
==31917== by 0x83BA3AB: tree_or(
==31917== by 0x83B75FB: get_mm_
==31917== by 0x83B7473: get_mm_
==31917== by 0x83AEB98: SQL_SELECT:
==31917== by 0x831D5BC: make_join_
==31917== by 0x830BD02: JOIN::optimize() (sql_select.
==31917== by 0x83110F8: 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_
==31917== by 0x833B2C7: mysql_explain_
==31917== by 0x82A4661: execute_
==31917== by 0x829B1FA: mysql_execute_
==31917== by 0x82A6D7D: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6077)
==31917== by 0x8298CE3: dispatch_
==31917== by 0x829814D: do_command(THD*) (sql_parse.cc:903)
==31917== by 0x8295229: handle_
==31917== by 0x821918: start_thread (in /lib/libpthread
RQG command line:
perl runall.pl --basedir=
To reproduce, run the RQG command line above and monitor mysql-test/
Related branches
Changed in maria: | |
milestone: | none → 5.3 |
Changed in maria: | |
assignee: | nobody → Philip Stoev (philip-stoev) |
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
Test case. This crashes and produces a valgrind warning only in maria-5.3-mwl128. maria-5.3 does not appear to be affected, however since EXPLAIN also crashes, it is not possible to determine if the two trees use the same query plan.
--source include/ have_innodb. inc
CREATE TABLE t1 ( f3 int(11)) ;
CREATE TABLE t2 ( f1 int(11), f2 int(11), PRIMARY KEY (f1), KEY (f2)) ENGINE=InnoDB;
INSERT IGNORE INTO t2 VALUES (1,2);
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
SELECT *
FROM t2 AS alias1
JOIN t2 AS alias2 ON alias1.f2 = alias2.f1
JOIN v1 ON alias2.f1 = v1.f3
WHERE v1.f3 BETWEEN 2 AND 5 AND alias1.f2 IN ( 1 );
valgrind warning:
==19181== Invalid read of size 4 func_mm_ tree(RANGE_ OPT_PARAM* , Item_func*, Item_field*, Item*, bool) (opt_range.cc:7111) tree(RANGE_ OPT_PARAM* , Item*) (opt_range.cc:7216) tree(RANGE_ OPT_PARAM* , Item*) (opt_range.cc:7145) :test_quick_ select( THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool, bool) (opt_range.cc:3025) record_ count(THD* , SQL_SELECT*, st_table*, Bitmap<64u> const*, unsigned long long) (sql_select. cc:2746) statistics( JOIN*, TABLE_LIST*, Item*, st_dynamic_array*) (sql_select. cc:3203) sqlcom_ select( THD*, TABLE_LIST*) (sql_parse.cc:5070) command( THD*) (sql_parse.cc:2234) command( enum_server_ command, THD*, char*, unsigned int) (sql_parse.cc:1210) one_connection (sql_connect. cc:1154) -2.12.1. so)
==19181== at 0x83AAA5A: get_full_
==19181== by 0x83AB23C: get_mm_
==19181== by 0x83AAC6A: get_mm_
==19181== by 0x83A2F72: SQL_SELECT:
==19181== by 0x830ABDA: get_quick_
==19181== by 0x830C74C: make_join_
==19181== by 0x8304E98: JOIN::optimize() (sql_select.cc:954)
==19181== by 0x830A803: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, u$
==19181== by 0x8303130: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:282)
==19181== by 0x82A0C9B: execute_
==19181== by 0x8297CAA: mysql_execute_
==19181== by 0x82A3233: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6077)
==19181== by 0x8295942: dispatch_
==19181== by 0x8294DEF: do_command(THD*) (sql_parse.cc:903)
==19181== by 0x8291ECD: handle_
==19181== by 0x821918: start_thread (in /lib/libpthread