Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
11.3.0
-
Ubuntu Linux 20.04 LTS.
Description
The latest GitHub version of the MariaDB Server: commit hash `8ad1e26b1bafa4ed9928306efc10c047f2274108` crashes when running the following query:
```sql
drop database if exists test;
create database test;
use test;
CREATE TABLE IF NOT EXISTS v0 ( c1 INT);
CREATE TABLE v2 ( c3 INT);
(SELECT c1 FROM
,
{ OJ v2 }WHERE c1 IS TRUE GROUP BY c3 HAVING c3 WINDOW v0 AS ( ) LOCK IN SHARE MODE ) ORDER BY c3 ;
```
Here is a crashing stack trace captured by GDB:
```
(gdb) bt
#0 0x0000aaaacc045b24 in get_sort_by_table (a=0x0, b=0x0, tables=..., const_tables=<optimized out>) at /home/mysql/mariadb/sql/sql_select.cc:28001
#1 make_join_statistics (join=0xffff0806b330, tables_list=..., keyuse_array=0xffff0806b690) at /home/mysql/mariadb/sql/sql_select.cc:5899
#2 0x0000aaaacc03d7cc in JOIN::optimize_inner (this=0xffff0806b330) at /home/mysql/mariadb/sql/sql_select.cc:2618
#3 0x0000aaaacc032dd0 in JOIN::optimize (this=0xffff0806b330) at /home/mysql/mariadb/sql/sql_select.cc:1944
#4 0x0000aaaacc02879c in mysql_select (thd=0xffff08000c68, tables=<optimized out>, fields=..., conds=<optimized out>, og_num=<optimized out>, order=<optimized out>,
group=<optimized out>, having=<optimized out>, proc_param=0x0, select_options=<optimized out>, result=0xffff08016238, unit=0xffff08004fe0, select_lex=0xffff08014b78)
at /home/mysql/mariadb/sql/sql_select.cc:5229
#5 0x0000aaaacc0282d8 in handle_select (thd=0xffff08000c68, lex=0xffff08004f00, result=0xffff08016238, setup_tables_done_option=0)
at /home/mysql/mariadb/sql/sql_select.cc:628
#6 0x0000aaaacbfc0518 in execute_sqlcom_select (thd=0xffff08000c68, all_tables=0xffff08015190) at /home/mysql/mariadb/sql/sql_parse.cc:6023
#7 0x0000aaaacbfb31e8 in mysql_execute_command (thd=0xffff08000c68, is_called_from_prepared_stmt=false) at /home/mysql/mariadb/sql/sql_parse.cc:3922
#8 0x0000aaaacbfa8ea8 in mysql_parse (thd=0xffff08000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
at /home/mysql/mariadb/sql/sql_parse.cc:7760
#9 0x0000aaaacbfa4818 in dispatch_command (command=COM_QUERY, thd=0xffff08000c68, packet=<optimized out>, packet_length=<optimized out>, blocking=true)
at /home/mysql/mariadb/sql/sql_parse.cc:1893
#10 0x0000aaaacbfa9710 in do_command (thd=<optimized out>, blocking=<optimized out>) at /home/mysql/mariadb/sql/sql_parse.cc:1406
#11 0x0000aaaacc2216f0 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /home/mysql/mariadb/sql/sql_connect.cc:1445
#12 0x0000aaaacc221378 in handle_one_connection (arg=0xaaaaf0788c78) at /home/mysql/mariadb/sql/sql_connect.cc:1347
#13 0x0000aaaacc96e8b0 in pfs_spawn_thread (arg=0xaaaaf0742c38) at /home/mysql/mariadb/storage/perfschema/pfs.cc:2201
#14 0x0000ffff8be72624 in start_thread (arg=0xaaaacc96e740 <pfs_spawn_thread(void*)>) at pthread_create.c:477
#15 0x0000ffff8bbac49c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78
```
Some other useful information:
```
Server version: 11.3.0-MariaDB source revision: 8ad1e26b1bafa4ed9928306efc10c047f2274108
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=1
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
$ ./sql/mariadbd --print-defaults
./sql/mariadbd would have been started with the following arguments:
--sql_mode=NO_ENGINE_SUBSTITUTION
```
Attachments
Issue Links
- duplicates
-
MDEV-29681 Server crashes when optimizing SQL with ORDER BY
- Closed