CentOS Linux release 7.4.1708 (Core)
10.3.1-MariaDB
Description
I have two seperate recursive queries that run up and down a tree of nodes to collect information.
For visualization you can compare this to a binary tree, pick a random node in the tree, for this node you get all parents (grandparents etc.) and get all children (grandchildren etc.)
For this I run two queries, one for upwards and one for downwards.
When I want to show the results for this, I can either show one or show the other, but when trying to UNION the results the server stops responding. The only way to use the server again after using this query is to reset the mysql server using 'mysqld service restart'.
'SELECT * FROM temp' shows the correct results for that table.
All code used:
WITH recursive tempas (
SELECT current_template, current_iteration, parent_template, parent_iteration, tkey, val
FROM templatevalues
WHERE tkey='linnumber'AND val='1'AND guid='ffb7e0cd-5dff-4b83-be88-ebf66d5557be'-- this is the starting point
JOINtemp p ON p.parent_template = c.current_template AND p.parent_iteration = c.current_iteration AND guid='ffb7e0cd-5dff-4b83-be88-ebf66d5557be'-- this is the recursion
),
temp2 as (
SELECT current_template, current_iteration, parent_template, parent_iteration, tkey, val
FROM templatevalues
WHERE tkey='linnumber'AND val='1'AND guid='ffb7e0cd-5dff-4b83-be88-ebf66d5557be'-- this is the starting point
JOIN temp2 p ON c.parent_template = p.current_template AND c.parent_iteration = p.current_iteration AND guid='ffb7e0cd-5dff-4b83-be88-ebf66d5557be'-- this is the recursion
)
SELECT *
FROMtempUNIONALL (SELECT * FROM temp2);
I included a file with a dump of a few lines of the database I used. Use this to test on other environments. Even with these two lines in the table it still times out, which should not happen.
Thanks for the report and the test case.
I assume '10.0' in the "affected version/s" field is a typo, because it doesn't support CTEs.
For 10.3.1, with the test case does not hang for me, but instead causes a server crash (stack traces at the end of the comment).
It was fixed in scope of MDEV-13796, by this commit:
commit 4c9d19ee657b882fcb5a2daea702357a1a73b55f
Author: Igor Babaev
Date: Wed Oct 11 08:37:35 2017 -0700
Fixed the bug mdev-13796.
A reference to a CTE may occur not in the master of the CTE
specification. In this case if the reference to the CTE is
the first one the specification should be detached from its
master and attached to the referencing select.
Also fixed the TYPE column in the lines of the EXPLAIN output
created for CTE tables.
The fix is included into 10.2.10 which is expected to be released today or tomorrow, and soon will be merged into 10.3 branch.
Hopefully the hang that you are getting is another representation of the same problem and will be fixed by the same bugfix.
Please let us know if you still encounter it on a version which includes the patch above.
10.3.1
#2 <signal handler called>
#3 reset_join (j=0x7fbc100bbef8, this=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_join_cache.h:670
#4 sub_select_cache (join=0x7fbc100bbef8, join_tab=0x7fbc1012bfa8, end_of_records=false) at /home/buildbot/buildbot/build/sql/sql_select.cc:18642
#5 0x000055acd78fe551 in evaluate_join_record (join=join@entry=0x7fbc100bbef8, join_tab=join_tab@entry=0x7fbc1012bbf8, error=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:19087
#6 0x000055acd7906e6e in sub_select (join=0x7fbc100bbef8, join_tab=0x7fbc1012bbf8, end_of_records=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:18867
#7 0x000055acd79240d3 in do_select (procedure=<optimized out>, join=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:18407
#8 JOIN::exec_inner (this=this@entry=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3542
#9 0x000055acd79242fc in JOIN::exec (this=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3337
#10 0x000055acd795fbce in st_select_lex_unit::exec_recursive (this=this@entry=0x7fbc100120c8) at /home/buildbot/buildbot/build/sql/sql_union.cc:1666
#11 0x000055acd78ab508 in TABLE_LIST::fill_recursive (this=this@entry=0x7fbc10048a70, thd=thd@entry=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_derived.cc:1007
#12 0x000055acd78ab85c in mysql_derived_fill (thd=0x7fbc100009a8, lex=0x7fbc100043b0, derived=0x7fbc10048a70) at /home/buildbot/buildbot/build/sql/sql_derived.cc:1087
#13 0x000055acd78ab437 in mysql_handle_single_derived (lex=0x7fbc100043b0, derived=derived@entry=0x7fbc10048a70, phases=phases@entry=96) at /home/buildbot/buildbot/build/sql/sql_derived.cc:197
#14 0x000055acd7906c47 in st_join_table::preread_init (this=this@entry=0x7fbc1012eb08) at /home/buildbot/buildbot/build/sql/sql_select.cc:12185
#15 0x000055acd7906f98 in sub_select (join=0x7fbc100522d8, join_tab=0x7fbc1012eb08, end_of_records=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:18835
#16 0x000055acd79240d3 in do_select (procedure=<optimized out>, join=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:18407
#17 JOIN::exec_inner (this=this@entry=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3542
#18 0x000055acd79242fc in JOIN::exec (this=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3337
#19 0x000055acd795f3cb in st_select_lex_unit::exec (this=this@entry=0x7fbc10004478) at /home/buildbot/buildbot/build/sql/sql_union.cc:1427
#20 0x000055acd79611a7 in mysql_union (thd=thd@entry=0x7fbc100009a8, lex=lex@entry=0x7fbc100043b0, result=result@entry=0x7fbc10049180, unit=unit@entry=0x7fbc10004478, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_union.cc:41
#21 0x000055acd792439f in handle_select (thd=thd@entry=0x7fbc100009a8, lex=lex@entry=0x7fbc100043b0, result=result@entry=0x7fbc10049180, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_select.cc:356
#22 0x000055acd78cc636 in execute_sqlcom_select (thd=thd@entry=0x7fbc100009a8, all_tables=0x7fbc10047b48) at /home/buildbot/buildbot/build/sql/sql_parse.cc:6476
#23 0x000055acd78d6bfc in mysql_execute_command (thd=thd@entry=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_parse.cc:3730
#24 0x000055acd78d9aaa in mysql_parse (thd=thd@entry=0x7fbc100009a8, rawbuf=<optimized out>, length=1146, parser_state=parser_state@entry=0x7fbc640b9670, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:7930
#25 0x000055acd78dbc0f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fbc100009a8, packet=<optimized out>, packet_length=268505840, packet_length@entry=1146, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1819
#26 0x000055acd78dc1c6 in do_command (thd=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1370
#27 0x000055acd7998c5f in do_handle_one_connection (connect=connect@entry=0x55acdb05b7c8) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1418
#28 0x000055acd7998d84 in handle_one_connection (arg=arg@entry=0x55acdb05b7c8) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1324
#29 0x000055acd7bf11cd in pfs_spawn_thread (arg=0x55acdb05ba28) at /home/buildbot/buildbot/build/storage/perfschema/pfs.cc:1862
#30 0x00007fbc6bda0494 in start_thread (arg=0x7fbc640ba700) at pthread_create.c:333
#31 0x00007fbc6b45d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x00007ff25aec0ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x000055e4316a6bac in sub_select_cache (join=0x7ff2000b8920, join_tab=0x7ff2000f28e0, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18644
#9 0x000055e4316a7700 in evaluate_join_record (join=0x7ff2000b8920, join_tab=0x7ff2000f2530, error=0) at /data/src/10.3/sql/sql_select.cc:19091
#10 0x000055e4316a7017 in sub_select (join=0x7ff2000b8920, join_tab=0x7ff2000f2530, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18871
#11 0x000055e4316a6580 in do_select (join=0x7ff2000b8920, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18411
#12 0x000055e43167f07c in JOIN::exec_inner (this=0x7ff2000b8920) at /data/src/10.3/sql/sql_select.cc:3548
#13 0x000055e43167e514 in JOIN::exec (this=0x7ff2000b8920) at /data/src/10.3/sql/sql_select.cc:3343
#14 0x000055e431721891 in st_select_lex_unit::exec_recursive (this=0x7ff2000157c8) at /data/src/10.3/sql/sql_union.cc:1667
#15 0x000055e4315fa614 in TABLE_LIST::fill_recursive (this=0x7ff200059a10, thd=0x7ff200000b00) at /data/src/10.3/sql/sql_derived.cc:1007
#16 0x000055e4315fa917 in mysql_derived_fill (thd=0x7ff200000b00, lex=0x7ff2000046f8, derived=0x7ff200059a10) at /data/src/10.3/sql/sql_derived.cc:1087
#17 0x000055e4315f8a1f in mysql_handle_single_derived (lex=0x7ff2000046f8, derived=0x7ff200059a10, phases=96) at /data/src/10.3/sql/sql_derived.cc:197
#18 0x000055e4316965ff in st_join_table::preread_init (this=0x7ff2000f5628) at /data/src/10.3/sql/sql_select.cc:12189
#19 0x000055e4316a6e79 in sub_select (join=0x7ff200065980, join_tab=0x7ff2000f5628, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18839
#20 0x000055e4316a6580 in do_select (join=0x7ff200065980, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18411
#21 0x000055e43167f07c in JOIN::exec_inner (this=0x7ff200065980) at /data/src/10.3/sql/sql_select.cc:3548
#22 0x000055e43167e514 in JOIN::exec (this=0x7ff200065980) at /data/src/10.3/sql/sql_select.cc:3343
#23 0x000055e431720b79 in st_select_lex_unit::exec (this=0x7ff2000047c0) at /data/src/10.3/sql/sql_union.cc:1428
#24 0x000055e43171c24a in mysql_union (thd=0x7ff200000b00, lex=0x7ff2000046f8, result=0x7ff20005a120, unit=0x7ff2000047c0, setup_tables_done_option=0) at /data/src/10.3/sql/sql_union.cc:41
#25 0x000055e431673b4e in handle_select (thd=0x7ff200000b00, lex=0x7ff2000046f8, result=0x7ff20005a120, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:356
#26 0x000055e43163f123 in execute_sqlcom_select (thd=0x7ff200000b00, all_tables=0x7ff200058af8) at /data/src/10.3/sql/sql_parse.cc:6467
#27 0x000055e431635699 in mysql_execute_command (thd=0x7ff200000b00) at /data/src/10.3/sql/sql_parse.cc:3731
#28 0x000055e431642a3c in mysql_parse (thd=0x7ff200000b00, rawbuf=0x7ff2000149f8 "WITH recursive temp as (\nSELECT current_template, current_iteration, parent_template, parent_iteration, tkey, val\nFROM templatevalues\nWHERE tkey='linnumber' AND val='1' AND guid='08388e25-33e7-49ec-92"..., length=1146, parser_state=0x7ff2542e9610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
#29 0x000055e4316301dd in dispatch_command (command=COM_QUERY, thd=0x7ff200000b00, packet=0x7ff20008fbd1 "", packet_length=1146, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
#30 0x000055e43162ec3b in do_command (thd=0x7ff200000b00) at /data/src/10.3/sql/sql_parse.cc:1370
#31 0x000055e431785a14 in do_handle_one_connection (connect=0x55e4354e9e60) at /data/src/10.3/sql/sql_connect.cc:1418
#32 0x000055e4317857a1 in handle_one_connection (arg=0x55e4354e9e60) at /data/src/10.3/sql/sql_connect.cc:1324
#33 0x000055e431bfff76 in pfs_spawn_thread (arg=0x55e435506a50) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#34 0x00007ff25ce05494 in start_thread (arg=0x7ff2542ea700) at pthread_create.c:333
#35 0x00007ff25af7d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
Elena Stepanova
added a comment - fjf ,
Thanks for the report and the test case.
I assume '10.0' in the "affected version/s" field is a typo, because it doesn't support CTEs.
For 10.3.1, with the test case does not hang for me, but instead causes a server crash (stack traces at the end of the comment).
It was fixed in scope of MDEV-13796 , by this commit:
commit 4c9d19ee657b882fcb5a2daea702357a1a73b55f
Author: Igor Babaev
Date: Wed Oct 11 08:37:35 2017 -0700
Fixed the bug mdev-13796.
A reference to a CTE may occur not in the master of the CTE
specification. In this case if the reference to the CTE is
the first one the specification should be detached from its
master and attached to the referencing select.
Also fixed the TYPE column in the lines of the EXPLAIN output
created for CTE tables.
The fix is included into 10.2.10 which is expected to be released today or tomorrow, and soon will be merged into 10.3 branch.
Hopefully the hang that you are getting is another representation of the same problem and will be fixed by the same bugfix.
Please let us know if you still encounter it on a version which includes the patch above.
10.3.1
#2 <signal handler called>
#3 reset_join (j=0x7fbc100bbef8, this=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_join_cache.h:670
#4 sub_select_cache (join=0x7fbc100bbef8, join_tab=0x7fbc1012bfa8, end_of_records=false) at /home/buildbot/buildbot/build/sql/sql_select.cc:18642
#5 0x000055acd78fe551 in evaluate_join_record (join=join@entry=0x7fbc100bbef8, join_tab=join_tab@entry=0x7fbc1012bbf8, error=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:19087
#6 0x000055acd7906e6e in sub_select (join=0x7fbc100bbef8, join_tab=0x7fbc1012bbf8, end_of_records=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:18867
#7 0x000055acd79240d3 in do_select (procedure=<optimized out>, join=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:18407
#8 JOIN::exec_inner (this=this@entry=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3542
#9 0x000055acd79242fc in JOIN::exec (this=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3337
#10 0x000055acd795fbce in st_select_lex_unit::exec_recursive (this=this@entry=0x7fbc100120c8) at /home/buildbot/buildbot/build/sql/sql_union.cc:1666
#11 0x000055acd78ab508 in TABLE_LIST::fill_recursive (this=this@entry=0x7fbc10048a70, thd=thd@entry=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_derived.cc:1007
#12 0x000055acd78ab85c in mysql_derived_fill (thd=0x7fbc100009a8, lex=0x7fbc100043b0, derived=0x7fbc10048a70) at /home/buildbot/buildbot/build/sql/sql_derived.cc:1087
#13 0x000055acd78ab437 in mysql_handle_single_derived (lex=0x7fbc100043b0, derived=derived@entry=0x7fbc10048a70, phases=phases@entry=96) at /home/buildbot/buildbot/build/sql/sql_derived.cc:197
#14 0x000055acd7906c47 in st_join_table::preread_init (this=this@entry=0x7fbc1012eb08) at /home/buildbot/buildbot/build/sql/sql_select.cc:12185
#15 0x000055acd7906f98 in sub_select (join=0x7fbc100522d8, join_tab=0x7fbc1012eb08, end_of_records=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:18835
#16 0x000055acd79240d3 in do_select (procedure=<optimized out>, join=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:18407
#17 JOIN::exec_inner (this=this@entry=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3542
#18 0x000055acd79242fc in JOIN::exec (this=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3337
#19 0x000055acd795f3cb in st_select_lex_unit::exec (this=this@entry=0x7fbc10004478) at /home/buildbot/buildbot/build/sql/sql_union.cc:1427
#20 0x000055acd79611a7 in mysql_union (thd=thd@entry=0x7fbc100009a8, lex=lex@entry=0x7fbc100043b0, result=result@entry=0x7fbc10049180, unit=unit@entry=0x7fbc10004478, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_union.cc:41
#21 0x000055acd792439f in handle_select (thd=thd@entry=0x7fbc100009a8, lex=lex@entry=0x7fbc100043b0, result=result@entry=0x7fbc10049180, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_select.cc:356
#22 0x000055acd78cc636 in execute_sqlcom_select (thd=thd@entry=0x7fbc100009a8, all_tables=0x7fbc10047b48) at /home/buildbot/buildbot/build/sql/sql_parse.cc:6476
#23 0x000055acd78d6bfc in mysql_execute_command (thd=thd@entry=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_parse.cc:3730
#24 0x000055acd78d9aaa in mysql_parse (thd=thd@entry=0x7fbc100009a8, rawbuf=<optimized out>, length=1146, parser_state=parser_state@entry=0x7fbc640b9670, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:7930
#25 0x000055acd78dbc0f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fbc100009a8, packet=<optimized out>, packet_length=268505840, packet_length@entry=1146, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1819
#26 0x000055acd78dc1c6 in do_command (thd=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1370
#27 0x000055acd7998c5f in do_handle_one_connection (connect=connect@entry=0x55acdb05b7c8) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1418
#28 0x000055acd7998d84 in handle_one_connection (arg=arg@entry=0x55acdb05b7c8) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1324
#29 0x000055acd7bf11cd in pfs_spawn_thread (arg=0x55acdb05ba28) at /home/buildbot/buildbot/build/storage/perfschema/pfs.cc:1862
#30 0x00007fbc6bda0494 in start_thread (arg=0x7fbc640ba700) at pthread_create.c:333
#31 0x00007fbc6b45d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
10.3 ecee3c71e1e740 debug build
mysqld: /data/src/10.3/sql/sql_select.cc:18644: enum_nested_loop_state sub_select_cache(JOIN*, JOIN_TAB*, bool): Assertion `cache != __null' failed.
171030 20:42:50 [ERROR] mysqld got signal 6 ;
#7 0x00007ff25aec0ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x000055e4316a6bac in sub_select_cache (join=0x7ff2000b8920, join_tab=0x7ff2000f28e0, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18644
#9 0x000055e4316a7700 in evaluate_join_record (join=0x7ff2000b8920, join_tab=0x7ff2000f2530, error=0) at /data/src/10.3/sql/sql_select.cc:19091
#10 0x000055e4316a7017 in sub_select (join=0x7ff2000b8920, join_tab=0x7ff2000f2530, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18871
#11 0x000055e4316a6580 in do_select (join=0x7ff2000b8920, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18411
#12 0x000055e43167f07c in JOIN::exec_inner (this=0x7ff2000b8920) at /data/src/10.3/sql/sql_select.cc:3548
#13 0x000055e43167e514 in JOIN::exec (this=0x7ff2000b8920) at /data/src/10.3/sql/sql_select.cc:3343
#14 0x000055e431721891 in st_select_lex_unit::exec_recursive (this=0x7ff2000157c8) at /data/src/10.3/sql/sql_union.cc:1667
#15 0x000055e4315fa614 in TABLE_LIST::fill_recursive (this=0x7ff200059a10, thd=0x7ff200000b00) at /data/src/10.3/sql/sql_derived.cc:1007
#16 0x000055e4315fa917 in mysql_derived_fill (thd=0x7ff200000b00, lex=0x7ff2000046f8, derived=0x7ff200059a10) at /data/src/10.3/sql/sql_derived.cc:1087
#17 0x000055e4315f8a1f in mysql_handle_single_derived (lex=0x7ff2000046f8, derived=0x7ff200059a10, phases=96) at /data/src/10.3/sql/sql_derived.cc:197
#18 0x000055e4316965ff in st_join_table::preread_init (this=0x7ff2000f5628) at /data/src/10.3/sql/sql_select.cc:12189
#19 0x000055e4316a6e79 in sub_select (join=0x7ff200065980, join_tab=0x7ff2000f5628, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18839
#20 0x000055e4316a6580 in do_select (join=0x7ff200065980, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18411
#21 0x000055e43167f07c in JOIN::exec_inner (this=0x7ff200065980) at /data/src/10.3/sql/sql_select.cc:3548
#22 0x000055e43167e514 in JOIN::exec (this=0x7ff200065980) at /data/src/10.3/sql/sql_select.cc:3343
#23 0x000055e431720b79 in st_select_lex_unit::exec (this=0x7ff2000047c0) at /data/src/10.3/sql/sql_union.cc:1428
#24 0x000055e43171c24a in mysql_union (thd=0x7ff200000b00, lex=0x7ff2000046f8, result=0x7ff20005a120, unit=0x7ff2000047c0, setup_tables_done_option=0) at /data/src/10.3/sql/sql_union.cc:41
#25 0x000055e431673b4e in handle_select (thd=0x7ff200000b00, lex=0x7ff2000046f8, result=0x7ff20005a120, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:356
#26 0x000055e43163f123 in execute_sqlcom_select (thd=0x7ff200000b00, all_tables=0x7ff200058af8) at /data/src/10.3/sql/sql_parse.cc:6467
#27 0x000055e431635699 in mysql_execute_command (thd=0x7ff200000b00) at /data/src/10.3/sql/sql_parse.cc:3731
#28 0x000055e431642a3c in mysql_parse (thd=0x7ff200000b00, rawbuf=0x7ff2000149f8 "WITH recursive temp as (\nSELECT current_template, current_iteration, parent_template, parent_iteration, tkey, val\nFROM templatevalues\nWHERE tkey='linnumber' AND val='1' AND guid='08388e25-33e7-49ec-92"..., length=1146, parser_state=0x7ff2542e9610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
#29 0x000055e4316301dd in dispatch_command (command=COM_QUERY, thd=0x7ff200000b00, packet=0x7ff20008fbd1 "", packet_length=1146, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
#30 0x000055e43162ec3b in do_command (thd=0x7ff200000b00) at /data/src/10.3/sql/sql_parse.cc:1370
#31 0x000055e431785a14 in do_handle_one_connection (connect=0x55e4354e9e60) at /data/src/10.3/sql/sql_connect.cc:1418
#32 0x000055e4317857a1 in handle_one_connection (arg=0x55e4354e9e60) at /data/src/10.3/sql/sql_connect.cc:1324
#33 0x000055e431bfff76 in pfs_spawn_thread (arg=0x55e435506a50) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#34 0x00007ff25ce05494 in start_thread (arg=0x7ff2542ea700) at pthread_create.c:333
#35 0x00007ff25af7d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
People
Unassigned
Duncan Kampert
Votes:
0Vote for this issue
Watchers:
3Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
fjf,
Thanks for the report and the test case.
I assume '10.0' in the "affected version/s" field is a typo, because it doesn't support CTEs.
For 10.3.1, with the test case does not hang for me, but instead causes a server crash (stack traces at the end of the comment).
It was fixed in scope of
MDEV-13796, by this commit:commit 4c9d19ee657b882fcb5a2daea702357a1a73b55f
Author: Igor Babaev
Date: Wed Oct 11 08:37:35 2017 -0700
Fixed the bug mdev-13796.
A reference to a CTE may occur not in the master of the CTE
specification. In this case if the reference to the CTE is
the first one the specification should be detached from its
master and attached to the referencing select.
Also fixed the TYPE column in the lines of the EXPLAIN output
created for CTE tables.
The fix is included into 10.2.10 which is expected to be released today or tomorrow, and soon will be merged into 10.3 branch.
Hopefully the hang that you are getting is another representation of the same problem and will be fixed by the same bugfix.
Please let us know if you still encounter it on a version which includes the patch above.
10.3.1
#2 <signal handler called>
#3 reset_join (j=0x7fbc100bbef8, this=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_join_cache.h:670
#4 sub_select_cache (join=0x7fbc100bbef8, join_tab=0x7fbc1012bfa8, end_of_records=false) at /home/buildbot/buildbot/build/sql/sql_select.cc:18642
#5 0x000055acd78fe551 in evaluate_join_record (join=join@entry=0x7fbc100bbef8, join_tab=join_tab@entry=0x7fbc1012bbf8, error=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:19087
#6 0x000055acd7906e6e in sub_select (join=0x7fbc100bbef8, join_tab=0x7fbc1012bbf8, end_of_records=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:18867
#7 0x000055acd79240d3 in do_select (procedure=<optimized out>, join=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:18407
#8 JOIN::exec_inner (this=this@entry=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3542
#9 0x000055acd79242fc in JOIN::exec (this=0x7fbc100bbef8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3337
#10 0x000055acd795fbce in st_select_lex_unit::exec_recursive (this=this@entry=0x7fbc100120c8) at /home/buildbot/buildbot/build/sql/sql_union.cc:1666
#11 0x000055acd78ab508 in TABLE_LIST::fill_recursive (this=this@entry=0x7fbc10048a70, thd=thd@entry=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_derived.cc:1007
#12 0x000055acd78ab85c in mysql_derived_fill (thd=0x7fbc100009a8, lex=0x7fbc100043b0, derived=0x7fbc10048a70) at /home/buildbot/buildbot/build/sql/sql_derived.cc:1087
#13 0x000055acd78ab437 in mysql_handle_single_derived (lex=0x7fbc100043b0, derived=derived@entry=0x7fbc10048a70, phases=phases@entry=96) at /home/buildbot/buildbot/build/sql/sql_derived.cc:197
#14 0x000055acd7906c47 in st_join_table::preread_init (this=this@entry=0x7fbc1012eb08) at /home/buildbot/buildbot/build/sql/sql_select.cc:12185
#15 0x000055acd7906f98 in sub_select (join=0x7fbc100522d8, join_tab=0x7fbc1012eb08, end_of_records=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:18835
#16 0x000055acd79240d3 in do_select (procedure=<optimized out>, join=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:18407
#17 JOIN::exec_inner (this=this@entry=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3542
#18 0x000055acd79242fc in JOIN::exec (this=0x7fbc100522d8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3337
#19 0x000055acd795f3cb in st_select_lex_unit::exec (this=this@entry=0x7fbc10004478) at /home/buildbot/buildbot/build/sql/sql_union.cc:1427
#20 0x000055acd79611a7 in mysql_union (thd=thd@entry=0x7fbc100009a8, lex=lex@entry=0x7fbc100043b0, result=result@entry=0x7fbc10049180, unit=unit@entry=0x7fbc10004478, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_union.cc:41
#21 0x000055acd792439f in handle_select (thd=thd@entry=0x7fbc100009a8, lex=lex@entry=0x7fbc100043b0, result=result@entry=0x7fbc10049180, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_select.cc:356
#22 0x000055acd78cc636 in execute_sqlcom_select (thd=thd@entry=0x7fbc100009a8, all_tables=0x7fbc10047b48) at /home/buildbot/buildbot/build/sql/sql_parse.cc:6476
#23 0x000055acd78d6bfc in mysql_execute_command (thd=thd@entry=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_parse.cc:3730
#24 0x000055acd78d9aaa in mysql_parse (thd=thd@entry=0x7fbc100009a8, rawbuf=<optimized out>, length=1146, parser_state=parser_state@entry=0x7fbc640b9670, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:7930
#25 0x000055acd78dbc0f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fbc100009a8, packet=<optimized out>, packet_length=268505840, packet_length@entry=1146, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1819
#26 0x000055acd78dc1c6 in do_command (thd=0x7fbc100009a8) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1370
#27 0x000055acd7998c5f in do_handle_one_connection (connect=connect@entry=0x55acdb05b7c8) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1418
#28 0x000055acd7998d84 in handle_one_connection (arg=arg@entry=0x55acdb05b7c8) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1324
#29 0x000055acd7bf11cd in pfs_spawn_thread (arg=0x55acdb05ba28) at /home/buildbot/buildbot/build/storage/perfschema/pfs.cc:1862
#30 0x00007fbc6bda0494 in start_thread (arg=0x7fbc640ba700) at pthread_create.c:333
#31 0x00007fbc6b45d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
10.3 ecee3c71e1e740 debug build
mysqld: /data/src/10.3/sql/sql_select.cc:18644: enum_nested_loop_state sub_select_cache(JOIN*, JOIN_TAB*, bool): Assertion `cache != __null' failed.
171030 20:42:50 [ERROR] mysqld got signal 6 ;
#7 0x00007ff25aec0ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x000055e4316a6bac in sub_select_cache (join=0x7ff2000b8920, join_tab=0x7ff2000f28e0, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18644
#9 0x000055e4316a7700 in evaluate_join_record (join=0x7ff2000b8920, join_tab=0x7ff2000f2530, error=0) at /data/src/10.3/sql/sql_select.cc:19091
#10 0x000055e4316a7017 in sub_select (join=0x7ff2000b8920, join_tab=0x7ff2000f2530, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18871
#11 0x000055e4316a6580 in do_select (join=0x7ff2000b8920, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18411
#12 0x000055e43167f07c in JOIN::exec_inner (this=0x7ff2000b8920) at /data/src/10.3/sql/sql_select.cc:3548
#13 0x000055e43167e514 in JOIN::exec (this=0x7ff2000b8920) at /data/src/10.3/sql/sql_select.cc:3343
#14 0x000055e431721891 in st_select_lex_unit::exec_recursive (this=0x7ff2000157c8) at /data/src/10.3/sql/sql_union.cc:1667
#15 0x000055e4315fa614 in TABLE_LIST::fill_recursive (this=0x7ff200059a10, thd=0x7ff200000b00) at /data/src/10.3/sql/sql_derived.cc:1007
#16 0x000055e4315fa917 in mysql_derived_fill (thd=0x7ff200000b00, lex=0x7ff2000046f8, derived=0x7ff200059a10) at /data/src/10.3/sql/sql_derived.cc:1087
#17 0x000055e4315f8a1f in mysql_handle_single_derived (lex=0x7ff2000046f8, derived=0x7ff200059a10, phases=96) at /data/src/10.3/sql/sql_derived.cc:197
#18 0x000055e4316965ff in st_join_table::preread_init (this=0x7ff2000f5628) at /data/src/10.3/sql/sql_select.cc:12189
#19 0x000055e4316a6e79 in sub_select (join=0x7ff200065980, join_tab=0x7ff2000f5628, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:18839
#20 0x000055e4316a6580 in do_select (join=0x7ff200065980, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18411
#21 0x000055e43167f07c in JOIN::exec_inner (this=0x7ff200065980) at /data/src/10.3/sql/sql_select.cc:3548
#22 0x000055e43167e514 in JOIN::exec (this=0x7ff200065980) at /data/src/10.3/sql/sql_select.cc:3343
#23 0x000055e431720b79 in st_select_lex_unit::exec (this=0x7ff2000047c0) at /data/src/10.3/sql/sql_union.cc:1428
#24 0x000055e43171c24a in mysql_union (thd=0x7ff200000b00, lex=0x7ff2000046f8, result=0x7ff20005a120, unit=0x7ff2000047c0, setup_tables_done_option=0) at /data/src/10.3/sql/sql_union.cc:41
#25 0x000055e431673b4e in handle_select (thd=0x7ff200000b00, lex=0x7ff2000046f8, result=0x7ff20005a120, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:356
#26 0x000055e43163f123 in execute_sqlcom_select (thd=0x7ff200000b00, all_tables=0x7ff200058af8) at /data/src/10.3/sql/sql_parse.cc:6467
#27 0x000055e431635699 in mysql_execute_command (thd=0x7ff200000b00) at /data/src/10.3/sql/sql_parse.cc:3731
#28 0x000055e431642a3c in mysql_parse (thd=0x7ff200000b00, rawbuf=0x7ff2000149f8 "WITH recursive temp as (\nSELECT current_template, current_iteration, parent_template, parent_iteration, tkey, val\nFROM templatevalues\nWHERE tkey='linnumber' AND val='1' AND guid='08388e25-33e7-49ec-92"..., length=1146, parser_state=0x7ff2542e9610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
#29 0x000055e4316301dd in dispatch_command (command=COM_QUERY, thd=0x7ff200000b00, packet=0x7ff20008fbd1 "", packet_length=1146, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
#30 0x000055e43162ec3b in do_command (thd=0x7ff200000b00) at /data/src/10.3/sql/sql_parse.cc:1370
#31 0x000055e431785a14 in do_handle_one_connection (connect=0x55e4354e9e60) at /data/src/10.3/sql/sql_connect.cc:1418
#32 0x000055e4317857a1 in handle_one_connection (arg=0x55e4354e9e60) at /data/src/10.3/sql/sql_connect.cc:1324
#33 0x000055e431bfff76 in pfs_spawn_thread (arg=0x55e435506a50) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#34 0x00007ff25ce05494 in start_thread (arg=0x7ff2542ea700) at pthread_create.c:333
#35 0x00007ff25af7d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6