Sporadic crash / valgrind warning in register_field_in_read_map() with semijoin
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Sergey Petrunia |
Bug Description
The attached test case produces the following warning. Unfortunately, no simplification is available for sporadically crashing valgrind bugs. If you can convert the warning into a repeatable crash or an assertion, I will be able to provide a simpler test case.
==3574== Thread 4:
==3574== Invalid read of size 4
==3574== at 0x81CB8EB: Item_field:
==3574== by 0x81E2313: Item::walk(bool (Item::*)(unsigned char*), bool, unsigned char*) (item.h:971)
==3574== by 0x8219754: Item_equal:
==3574== by 0x8245F75: Item_subselect:
==3574== by 0x81E3E39: Item_ref::walk(bool (Item::*)(unsigned char*), bool, unsigned char*) (item.h:2629)
==3574== by 0x81F45AB: Item_func:
==3574== by 0x8215F5B: Item_cond:
==3574== by 0x83EA3EB: find_all_
==3574== by 0x83E94EE: filesort(THD*, st_table*, st_sort_field*, unsigned int, SQL_SELECT*, unsigned long long, bool, unsigned long long*) (filesort.cc:240)
==3574== by 0x83447D8: create_
==3574== by 0x83213B5: JOIN::exec() (sql_select.
==3574== by 0x8321E95: 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_
==3574== by 0x8319C66: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:283)
==3574== by 0x82B4433: execute_
==3574== by 0x82AB1F0: mysql_execute_
==3574== by 0x82B6A62: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6110)
==3574== Address 0x5ab02a4 is 52 bytes inside a block of size 996 free'd
==3574== at 0x4005AB8: free (vg_replace_
==3574== by 0x877F07F: _myfree (safemalloc.c:335)
==3574== by 0x877E418: free_root (my_alloc.c:370)
==3574== by 0x833C5F8: free_tmp_
==3574== by 0x824EE17: subselect_
==3574== by 0x82452B5: Item_subselect:
==3574== by 0x8245492: Item_in_
==3574== by 0x8331A17: st_join_
==3574== by 0x8332348: JOIN::cleanup(bool) (sql_select.
==3574== by 0x8332074: JOIN::join_free() (sql_select.
==3574== by 0x833CCF0: do_select(JOIN*, List<Item>*, st_table*, Procedure*) (sql_select.
==3574== by 0x8321668: JOIN::exec() (sql_select.
==3574== by 0x824C4FA: subselect_
==3574== by 0x8246246: Item_subselect:
==3574== by 0x82475A3: Item_singlerow_
==3574== by 0x831F7B0: JOIN::exec() (sql_select.
Optimizer switch for the particular example semijoin=
bzr version-info
revision-id: <email address hidden>
date: 2011-09-26 23:54:00 +0300
build-date: 2011-09-27 16:41:56 +0300
revno: 3196
branch-nick: maria-5.3
Changed in maria: | |
importance: | Undecided → High |
Changed in maria: | |
status: | New → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
A simplified testcase:
SET SESSION optimizer_ switch= 'semijoin= ON,materializat ion=ON, firstmatch= OFF,loosescan= OFF';
SELECT col_int_ nokey AS field1 , col_varchar_ key) AS SQ2_field1
(SQ2_alias1. pk , SQ2_alias1.pk) IN
C_ SQ1_alias2. col_int_ nokey AS C_SQ1_field1,
C_ SQ1_alias1. col_int_ key AS C_SQ1_field2 col_int_ key > 98 AND
C_SQ1_ alias3. pk = C_SQ1_alias2.pk AND
C_SQ1_ alias3. col_varchar_ key = C_SQ1_alias2. col_varchar_ key
alias1.
(SELECT
MAX( SQ2_alias1.
FROM
t2 AS SQ2_alias1
WHERE
(
SELECT
FROM
(
t3 AS C_SQ1_alias1,
t3 AS C_SQ1_alias2,
t1 AS C_SQ1_alias3
)
WHERE C_SQ1_alias3.
GROUP BY C_SQ1_field1 , C_SQ1_field2
)
) AS field3
FROM
t3 AS alias1,
t4 AS alias2,
t1 AS alias3
GROUP BY col_datetime_ key ASC , field3 ASC, field1, field3
field1, field3
HAVING
field3 < 'e' AND field1 < 242
ORDER BY
alias1.
LIMIT 100 OFFSET 9 ;
drop table t1,t2,t3,t4;