Crash/valgrind warning in JOIN_CACHE::write_record_data with semijoin=on
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Critical
|
Igor Babaev |
Bug Description
Repeatable with maria-5.3 , maria-5.
backtrace:
#3 <signal handler called>
#4 0x00000000006f0a4d in JOIN_CACHE:
#5 0x00000000006f0fef in JOIN_CACHE:
#6 0x00000000007338a8 in sub_select_cache (join=0x8552980, join_tab=0x855b4c0, end_of_
#7 0x000000000072a2c6 in evaluate_
#8 0x0000000000733560 in sub_select (join=0x8552980, join_tab=0x855b1a8, end_of_
#9 0x0000000000734894 in do_select (join=0x8552980, fields=0x8498b00, table=0x0, procedure=0x0) at sql_select.cc:14569
#10 0x0000000000754016 in JOIN::exec (this=0x8552980) at sql_select.cc:2665
#11 0x000000000074df6e in mysql_select (thd=0x8496098, rref_pointer_
order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2886
#12 0x0000000000754348 in handle_select (thd=0x8496098, lex=0x8498470, result=0x851dc20, setup_tables_
#13 0x00000000006a1744 in execute_
#14 0x00000000006a33f7 in mysql_execute_
#15 0x00000000006ac18f in mysql_parse (thd=0x8496098,
rawbuf=
found_
#16 0x00000000006ad027 in dispatch_command (command=COM_QUERY, thd=0x8496098, packet=0x85128c9 "", packet_length=103) at sql_parse.cc:1206
#17 0x00000000006ae635 in do_command (thd=0x8496098) at sql_parse.cc:904
#18 0x00000000006990eb in handle_
#19 0x00000033b600673d in start_thread () from /lib64/
#20 0x00000033b58d40cd in clone () from /lib64/libc.so.6
optimizer switch in effect:
index_merge=
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL key0 NULL NULL NULL 2 Start temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary
test case:
SET SESSION optimizer_
SET SESSION join_cache_level = 1;
CREATE TABLE t2 ( f1 int) ;
INSERT IGNORE INTO t2 VALUES (0),(0);
CREATE TABLE t1 ( f1 int) ;
INSERT IGNORE INTO t1 VALUES (0),(0);
SELECT *
FROM (
SELECT DISTINCT *
FROM t1
) AS alias1
WHERE alias1.f1 = ANY (
SELECT t2.f1 FROM t2
) ;
bzr version-info:
revision-id: <email address hidden>
date: 2011-06-28 11:11:26 +0400
build-date: 2011-06-28 11:03:34 +0300
revno: 3066
branch-nick: maria-5.3
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → Critical |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
If it does not crash, look for valgrind warning:
==8349== Thread 4: :write_ record_ data(unsigned char*, bool*) (sql_join_ cache.cc: 1391) :put_record( ) (sql_join_ cache.cc: 1500) cache(JOIN* , st_join_table*, bool) (sql_select. cc:14698) join_record( JOIN*, st_join_table*, int) (sql_select. cc:15099) cc:14904) cc:14569) cc:2665) lex_unit* , st_select_lex*) (sql_select. cc:2886) sqlcom_ select( THD*, TABLE_LIST*) (sql_parse.cc:5082) command( THD*) (sql_parse.cc:2227) command( enum_server_ command, THD*, char*, unsigned int) (sql_parse.cc:1206) one_connection (sql_connect. cc:1178) libpthread- 2.5.so)
==8349== Invalid read of size 1
==8349== at 0x6F0A4D: JOIN_CACHE:
==8349== by 0x6F0FEE: JOIN_CACHE:
==8349== by 0x7338A7: sub_select_
==8349== by 0x72A2C5: evaluate_
==8349== by 0x73355F: sub_select(JOIN*, st_join_table*, bool) (sql_select.
==8349== by 0x734893: do_select(JOIN*, List<Item>*, st_table*, Procedure*) (sql_select.
==8349== by 0x754015: JOIN::exec() (sql_select.
==8349== by 0x74DF6D: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsi
gned long long, select_result*, st_select_
==8349== by 0x754347: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:283)
==8349== by 0x6A1743: execute_
==8349== by 0x6A33F6: mysql_execute_
==8349== by 0x6AC18E: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6083)
==8349== by 0x6AD026: dispatch_
==8349== by 0x6AE634: do_command(THD*) (sql_parse.cc:904)
==8349== by 0x6990EA: handle_
==8349== by 0x33B600673C: start_thread (in /lib64/
==8349== Address 0x0 is not stack'd, malloc'd or (recently) free'd