[MDEV-7927] Server crashes in in Time_and_counter_tracker::incr_loops Created: 2015-04-07  Updated: 2015-04-08  Resolved: 2015-04-08

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.1
Fix Version/s: 10.1.4

Type: Bug Priority: Blocker
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-7069 Fix buildbot failures in main server ... Stalled
Relates
relates to MDEV-6422 More testing for ANALYZE stmt and JSON Closed

 Description   

CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 );

Stack trace from 10.1 commit 0df8c0aa

#3  <signal handler called>
#4  0x00007fd170925906 in Time_and_counter_tracker::incr_loops (this=0x0) at 10.1/sql/sql_analyze_stmt.h:66
#5  0x00007fd1708ea2f5 in JOIN::exec (this=0x7fd159018740) at 10.1/sql/sql_select.cc:2393
#6  0x00007fd1708ed8ee in mysql_select (thd=0x7fd1618e6070, rref_pointer_array=0x7fd159015a50, tables=0x7fd159014d18, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=268435460, result=0x7fd159015eb0, unit=0x7fd159014cc8, select_lex=0x7fd1590157d8) at 10.1/sql/sql_select.cc:3322
#7  0x00007fd17097dc88 in st_select_lex_unit::exec (this=0x7fd159014cc8) at 10.1/sql/sql_union.cc:981
#8  0x00007fd1709219b6 in mysql_explain_union (thd=0x7fd1618e6070, unit=0x7fd159014cc8, result=0x7fd159015eb0) at 10.1/sql/sql_select.cc:24088
#9  0x00007fd170921822 in select_describe (join=0x7fd159016530, need_tmp_table=false, need_order=false, distinct=false, message=0x7fd1711fb796 "Impossible WHERE") at 10.1/sql/sql_select.cc:24059
#10 0x00007fd1709047a9 in return_zero_rows (join=0x7fd159016530, result=0x7fd159015eb0, tables=..., fields=..., send_row=false, select_options=2147748612, info=0x7fd1711fb796 "Impossible WHERE", having=0x0, all_fields=...) at 10.1/sql/sql_select.cc:12194
#11 0x00007fd1708eab73 in JOIN::exec_inner (this=0x7fd159016530) at 10.1/sql/sql_select.cc:2518
#12 0x00007fd1708ea32b in JOIN::exec (this=0x7fd159016530) at 10.1/sql/sql_select.cc:2394
#13 0x00007fd1708ed8ee in mysql_select (thd=0x7fd1618e6070, rref_pointer_array=0x7fd1618ea758, tables=0x7fd1590142c0, wild_num=1, fields=..., conds=0x7fd159015bf8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x7fd159015eb0, unit=0x7fd1618e9df0, select_lex=0x7fd1618ea4e0) at 10.1/sql/sql_select.cc:3322
#14 0x00007fd170921ad7 in mysql_explain_union (thd=0x7fd1618e6070, unit=0x7fd1618e9df0, result=0x7fd159015eb0) at 10.1/sql/sql_select.cc:24105
#15 0x00007fd1708b4806 in execute_sqlcom_select (thd=0x7fd1618e6070, all_tables=0x7fd1590142c0) at 10.1/sql/sql_parse.cc:5721
#16 0x00007fd1708aaf55 in mysql_execute_command (thd=0x7fd1618e6070) at 10.1/sql/sql_parse.cc:2926
#17 0x00007fd1708b81ca in mysql_parse (thd=0x7fd1618e6070, rawbuf=0x7fd159014088 "EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 )", length=63, parser_state=0x7fd1703601b0) at 10.1/sql/sql_parse.cc:7165
#18 0x00007fd1708a71f6 in dispatch_command (command=COM_QUERY, thd=0x7fd1618e6070, packet=0x7fd1693db071 "", packet_length=63) at 10.1/sql/sql_parse.cc:1462
#19 0x00007fd1708a5fc6 in do_command (thd=0x7fd1618e6070) at 10.1/sql/sql_parse.cc:1090
#20 0x00007fd1709d6baf in do_handle_one_connection (thd_arg=0x7fd1618e6070) at 10.1/sql/sql_connect.cc:1347
#21 0x00007fd1709d68f4 in handle_one_connection (arg=0x7fd1618e6070) at 10.1/sql/sql_connect.cc:1258
#22 0x00007fd170f8cbe2 in pfs_spawn_thread (arg=0x7fd16d425670) at 10.1/storage/perfschema/pfs.cc:1860
#23 0x00007fd16ff9ab50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#24 0x00007fd16e02f95d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112



 Comments   
Comment by Elena Stepanova [ 2015-04-08 ]

It turns out it also breaks a number of buildbot tests (main.union, main.subselect and so on).
http://buildbot.askmonty.org/buildbot/builders/kvm-bintar-centos5-amd64/builds/1296/steps/test/logs/stdio

Please check, maybe some of them are not that degenerate as the query in the description.

Comment by Sergei Petrunia [ 2015-04-08 ]

Investigation:

The problem is with the UNION's "fake_select_lex". That part that reads the UNION results. Let's denote the fake_select_lex as $f. The following calls happen:

$f->join->init()
$f->join->optimize();
// this calls save_explain_plan()
st_select_lex_unit::save_union_explain_part2()
// here, we assign the tracker
...
$f->join->init() // this is essentially a JOIN constructor that zeroes all members, including JOIN::tracker.
$f->join->optimize()
// We dont set the tracker here.

Generated at Thu Feb 08 07:23:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.