Crash in JOIN_CACHE::write_record_data with derived_merge + semijoin + innodb + nested views
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Critical
|
Igor Babaev |
Bug Description
backtrace:
#5 0x007b7836 in __memcpy_ssse3 () from /lib/libc.so.6
#6 0x082f2381 in JOIN_CACHE:
#7 0x082f2632 in JOIN_CACHE:
#8 0x0833daf8 in sub_select_cache (join=0xa162fe08, join_tab=
#9 0x0833e8c9 in evaluate_
#10 0x0833e05f in sub_select (join=0xa162fe08, join_tab=
#11 0x0833d709 in do_select (join=0xa162fe08, fields=0xa82bcdc, table=0x0, procedure=0x0) at sql_select.cc:14785
#12 0x08321f61 in JOIN::exec (this=0xa162fe08) at sql_select.cc:2679
#13 0x0832278e in mysql_select (thd=0xa82a208, rref_pointer_
order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2900
#14 0x0831a55f in handle_select (thd=0xa82a208, lex=0xa82b90c, result=0xa162db70, setup_tables_
#15 0x082b4d18 in execute_
#16 0x082abad5 in mysql_execute_
#17 0x082b7347 in mysql_parse (thd=0xa82a208, rawbuf=0xa1613bb0 "SELECT *\nFROM t3\nLEFT JOIN v5\nON ( t3.a = v5.a )\nWHERE t3.b IN ( SELECT b FROM t4 )",
length=83, found_semicolon
#18 0x082a9724 in dispatch_command (command=COM_QUERY, thd=0xa82a208, packet=0xa8828d9 "", packet_length=83) at sql_parse.cc:1221
#19 0x082a8b7f in do_command (thd=0xa82a208) at sql_parse.cc:916
#20 0x082a5b63 in handle_
#21 0x00821919 in start_thread () from /lib/libpthread
#22 0x0076acce in clone () from /lib/libc.so.6
minimal switch: derived_
full switch: index_merge=
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 system NULL NULL NULL NULL 1
1 PRIMARY t1 ALL NULL NULL NULL NULL 0 Using where; Start temporary
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
1 PRIMARY t4 ALL NULL NULL NULL NULL 1 Using where; End temporary; Using join buffer (flat, BNL join)
4 DERIVED t2 ALL NULL NULL NULL NULL 1
bzr version-info
revision-id: <email address hidden>
date: 2011-10-24 12:54:28 -0700
build-date: 2011-10-25 12:05:43 +0300
revno: 3249
branch-nick: maria-5.3
test case:
--source include/
CREATE TABLE t1 ( a varchar(1) );
CREATE TABLE t2 ( b varchar(1) ) ENGINE=InnoDB;
CREATE TABLE t3 ( a varchar(1), b varchar(1) );
INSERT INTO t3 VALUES ('c','c');
CREATE TABLE t4 ( b varchar(1) ) ENGINE=InnoDB;
CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
CREATE VIEW v5 AS SELECT t1.* FROM t1, v2 ;
SET SESSION optimizer_
SELECT *
FROM t3
LEFT JOIN v5
ON ( t3.a = v5.a )
WHERE t3.b IN ( SELECT b FROM t4 );
Changed in maria: | |
status: | New → Confirmed |
Changed in maria: | |
importance: | Undecided → Critical |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
valgrind:
==11013== Thread 20: strmem. c:635) :write_ record_ data(unsigned char*, bool*) (sql_join_ cache.cc: 1421) :put_record( ) (sql_join_ cache.cc: 1530) cache(JOIN* , st_join_table*, bool) (sql_select. cc:14916) null_complement ed_join_ record( JOIN*, st_join_table*) (sql_select. cc:15434) cc:15167) cc:14785) cc:2679) lex_unit* , st_select_lex*) (sql_select. cc:2900) sqlcom_ select( THD*, TABLE_LIST*) (sql_parse.cc:5112) command( THD*) (sql_parse.cc:2250) command( enum_server_ command, THD*, char*, unsigned int) (sql_parse.cc:1221) one_connection (sql_connect. cc:1191)
==11013== Invalid read of size 2
==11013== at 0x4007A0E: memcpy (mc_replace_
==11013== by 0x82F2380: JOIN_CACHE:
==11013== by 0x82F2631: JOIN_CACHE:
==11013== by 0x833DAF7: sub_select_
==11013== by 0x833E8C8: evaluate_
==11013== by 0x833E05E: sub_select(JOIN*, st_join_table*, bool) (sql_select.
==11013== by 0x833D708: do_select(JOIN*, List<Item>*, st_table*, Procedure*) (sql_select.
==11013== by 0x8321F60: JOIN::exec() (sql_select.
==11013== by 0x832278D: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, un
signed long long, select_result*, st_select_
==11013== by 0x831A55E: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:283)
==11013== by 0x82B4D17: execute_
==11013== by 0x82ABAD4: mysql_execute_
==11013== by 0x82B7346: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6112)
==11013== by 0x82A9723: dispatch_
==11013== by 0x82A8B7E: do_command(THD*) (sql_parse.cc:916)
==11013== by 0x82A5B62: handle_