Details
Description
SET @@SESSION.tmp_table_size=1048576;
|
SET @@SESSION.max_sort_length=5;
|
SET @@SESSION.sort_buffer_size=1024;
|
SET @@SESSION.max_length_for_sort_data=66556;
|
SELECT * FROM information_schema.session_variables ORDER BY variable_name;
|
Leads to:
10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f |
mysqld: /test/10.5_dbg/sql/filesort_utils.h:139: size_t Filesort_buffer::spaceleft() const: Assertion `m_next_rec_ptr >= m_rawmem' failed.
|
10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f |
Core was generated by `/test/MD210420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
|
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
[Current thread is 1 (Thread 0x7fea995b2700 (LWP 768694))]
|
(gdb) bt
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
#1 0x0000561f1603e03d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
|
#2 0x0000561f157e3d7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
|
#3 <signal handler called>
|
#4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
|
#5 0x00007fea97cf6801 in __GI_abort () at abort.c:79
|
#6 0x00007fea97ce639a in __assert_fail_base (fmt=0x7fea97e6d7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x561f163447a6 "m_next_rec_ptr >= m_rawmem", file=file@entry=0x561f16344d48 "/test/10.5_dbg/sql/filesort_utils.h", line=line@entry=139, function=function@entry=0x561f163457c0 <Filesort_buffer::spaceleft() const::__PRETTY_FUNCTION__> "size_t Filesort_buffer::spaceleft() const") at assert.c:92
|
#7 0x00007fea97ce6412 in __GI___assert_fail (assertion=assertion@entry=0x561f163447a6 "m_next_rec_ptr >= m_rawmem", file=file@entry=0x561f16344d48 "/test/10.5_dbg/sql/filesort_utils.h", line=line@entry=139, function=function@entry=0x561f163457c0 <Filesort_buffer::spaceleft() const::__PRETTY_FUNCTION__> "size_t Filesort_buffer::spaceleft() const") at assert.c:101
|
#8 0x0000561f157e24c8 in Filesort_buffer::spaceleft (this=0x7fea6c1a1200) at /test/10.5_dbg/sql/filesort_utils.h:139
|
#9 Filesort_buffer::isfull (this=0x7fea6c1a1200) at /test/10.5_dbg/sql/filesort_utils.h:153
|
#10 SORT_INFO::isfull (this=0x7fea6c1a1200) at /test/10.5_dbg/sql/filesort.h:166
|
#11 find_all_keys (found_rows=0x7fea6c1a13f0, pq=0x0, tempfile=0x7fea995afc80, buffpek_pointers=0x7fea995afdf0, fs_info=0x7fea6c1a1200, select=0x7fea6c077a58, param=0x7fea995afbe0, thd=0x7fea6c015088) at /test/10.5_dbg/sql/filesort.cc:943
|
#12 filesort (thd=thd@entry=0x7fea6c015088, table=table@entry=0x7fea6c0800a0, filesort=filesort@entry=0x7fea6c077c28, tracker=0x7fea6c078318, join=join@entry=0x7fea6c075b38, first_table_bit=<optimized out>) at /test/10.5_dbg/sql/filesort.cc:356
|
#13 0x0000561f1558f009 in create_sort_index (thd=0x7fea6c015088, join=0x7fea6c075b38, tab=tab@entry=0x7fea6c077118, fsort=0x7fea6c077c28, fsort@entry=0x0) at /test/10.5_dbg/sql/sql_select.cc:23861
|
#14 0x0000561f1558f338 in st_join_table::sort_table (this=this@entry=0x7fea6c077118) at /test/10.5_dbg/sql/sql_select.cc:21590
|
#15 0x0000561f1558f46c in join_init_read_record (tab=0x7fea6c077118) at /test/10.5_dbg/sql/sql_select.cc:21529
|
#16 0x0000561f1557fd97 in sub_select (join=0x7fea6c075b38, join_tab=0x7fea6c077118, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20603
|
#17 0x0000561f155b7b28 in do_select (procedure=0x0, join=0x7fea6c075b38) at /test/10.5_dbg/sql/sql_select.cc:20140
|
#18 JOIN::exec_inner (this=this@entry=0x7fea6c075b38) at /test/10.5_dbg/sql/sql_select.cc:4464
|
#19 0x0000561f155b8143 in JOIN::exec (this=this@entry=0x7fea6c075b38) at /test/10.5_dbg/sql/sql_select.cc:4245
|
#20 0x0000561f155b6458 in mysql_select (thd=thd@entry=0x7fea6c015088, tables=<optimized out>, fields=..., conds=0x0, og_num=1, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7fea6c075b10, unit=0x7fea6c019098, select_lex=0x7fea6c074198) at /test/10.5_dbg/sql/sql_select.cc:4669
|
#21 0x0000561f155b6787 in handle_select (thd=thd@entry=0x7fea6c015088, lex=lex@entry=0x7fea6c018fd0, result=result@entry=0x7fea6c075b10, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
|
#22 0x0000561f15540ef4 in execute_sqlcom_select (thd=thd@entry=0x7fea6c015088, all_tables=0x7fea6c0747c8) at /test/10.5_dbg/sql/sql_parse.cc:6172
|
#23 0x0000561f15539919 in mysql_execute_command (thd=thd@entry=0x7fea6c015088) at /test/10.5_dbg/sql/sql_parse.cc:3901
|
#24 0x0000561f15546f2b in mysql_parse (thd=thd@entry=0x7fea6c015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fea995b1450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7957
|
#25 0x0000561f15532c45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fea6c015088, packet=packet@entry=0x7fea6c067089 "", packet_length=packet_length@entry=73, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839
|
#26 0x0000561f1553149b in do_command (thd=0x7fea6c015088) at /test/10.5_dbg/sql/sql_parse.cc:1358
|
#27 0x0000561f1568c415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7fea777c53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
|
#28 0x0000561f1568c744 in handle_one_connection (arg=arg@entry=0x7fea777c53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
|
#29 0x0000561f15aecfb0 in pfs_spawn_thread (arg=0x7fea97045b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
|
#30 0x00007fea989d96db in start_thread (arg=0x7fea995b2700) at pthread_create.c:463
|
#31 0x00007fea97dd788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.1.45 (dbg), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)
Bug confirmed not present in:
MariaDB: 10.1.45 (opt), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
Testcase below crashes 10.1-10.4 optimized and debug builds and 10.5.4 debug. I suspect this issue affects all (i.e. inc 10.5.4) optimized builds.
USE test;
SET SQL_MODE='';
CREATE TABLE t (c1 TIME PRIMARY KEY,c2 TIMESTAMP(3),c3 VARCHAR(1025) CHARACTER SET 'utf8' COLLATE 'utf8_bin') ;
INSERT INTO t VALUES (SYSDATE(2),'',GET_FORMAT(DATETIME,'ISO'));
SET SESSION max_length_for_sort_data=8388608;
SET SESSION sort_buffer_size=16;
SELECT * FROM t WHERE c1 BETWEEN '00:00:00' AND '23:59:59' ORDER BY c1,c2;
Leads to:
10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057
mysqld: /test/10.5_dbg/sql/filesort_utils.h:139: size_t Filesort_buffer::spaceleft() const: Assertion `m_next_rec_ptr >= m_rawmem' failed.
10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057
Core was generated by `/test/MD150620-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14fbe445c700 (LWP 2707316))]
(gdb) bt
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1 0x00005625db3974c6 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2 0x00005625dab39d60 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
#3 <signal handler called>
#4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5 0x000014fbe50cf801 in __GI_abort () at abort.c:79
#6 0x000014fbe50bf39a in __assert_fail_base (fmt=0x14fbe52467d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5625db6a65a2 "m_next_rec_ptr >= m_rawmem", file=file@entry=0x5625db6a6b40 "/test/10.5_dbg/sql/filesort_utils.h", line=line@entry=139, function=function@entry=0x5625db6a7560 <Filesort_buffer::spaceleft() const::__PRETTY_FUNCTION__> "size_t Filesort_buffer::spaceleft() const") at assert.c:92
#7 0x000014fbe50bf412 in __GI___assert_fail (assertion=assertion@entry=0x5625db6a65a2 "m_next_rec_ptr >= m_rawmem", file=file@entry=0x5625db6a6b40 "/test/10.5_dbg/sql/filesort_utils.h", line=line@entry=139, function=function@entry=0x5625db6a7560 <Filesort_buffer::spaceleft() const::__PRETTY_FUNCTION__> "size_t Filesort_buffer::spaceleft() const") at assert.c:101
#8 0x00005625dab37ee9 in Filesort_buffer::spaceleft (this=0x14fbc396f600) at /test/10.5_dbg/sql/filesort_utils.h:139
#9 Filesort_buffer::isfull (this=0x14fbc396f600) at /test/10.5_dbg/sql/filesort_utils.h:153
#10 SORT_INFO::isfull (this=0x14fbc396f600) at /test/10.5_dbg/sql/filesort.h:166
#11 find_all_keys (found_rows=0x14fbc396f7f0, pq=0x0, tempfile=0x14fbe4459bf0, buffpek_pointers=0x14fbe4459d60, fs_info=0x14fbc396f600, select=0x14fbc3878b38, param=0x14fbe4459b40, thd=0x14fbc3815088) at /test/10.5_dbg/sql/filesort.cc:937
#12 filesort (thd=thd@entry=0x14fbc3815088, table=table@entry=0x14fbc38c3088, filesort=filesort@entry=0x14fbc3878d08, tracker=0x14fbc38793f8, join=join@entry=0x14fbc3875f20, first_table_bit=<optimized out>) at /test/10.5_dbg/sql/filesort.cc:351
#13 0x00005625da8e4f40 in create_sort_index (thd=0x14fbc3815088, join=0x14fbc3875f20, tab=tab@entry=0x14fbc38781f8, fsort=0x14fbc3878d08, fsort@entry=0x0) at /test/10.5_dbg/sql/sql_select.cc:23834
#14 0x00005625da8e526e in st_join_table::sort_table (this=this@entry=0x14fbc38781f8) at /test/10.5_dbg/sql/sql_select.cc:21584
#15 0x00005625da8e53a2 in join_init_read_record (tab=0x14fbc38781f8) at /test/10.5_dbg/sql/sql_select.cc:21523
#16 0x00005625da8d4cbf in sub_select (join=0x14fbc3875f20, join_tab=0x14fbc38781f8, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20597
#17 0x00005625da90dc6e in do_select (procedure=0x0, join=0x14fbc3875f20) at /test/10.5_dbg/sql/sql_select.cc:20134
#18 JOIN::exec_inner (this=this@entry=0x14fbc3875f20) at /test/10.5_dbg/sql/sql_select.cc:4444
#19 0x00005625da90e289 in JOIN::exec (this=this@entry=0x14fbc3875f20) at /test/10.5_dbg/sql/sql_select.cc:4225
#20 0x00005625da90c59e in mysql_select (thd=thd@entry=0x14fbc3815088, tables=<optimized out>, fields=@0x14fbc38742e8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14fbc3874748, last = 0x14fbc38768c0, elements = 3}, <No data fields>}, conds=0x14fbc3875120, og_num=2, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14fbc3875ef8, unit=0x14fbc38190a0, select_lex=0x14fbc3874198) at /test/10.5_dbg/sql/sql_select.cc:4649
#21 0x00005625da90c8cd in handle_select (thd=thd@entry=0x14fbc3815088, lex=lex@entry=0x14fbc3818fd8, result=result@entry=0x14fbc3875ef8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
#22 0x00005625da8961ed in execute_sqlcom_select (thd=thd@entry=0x14fbc3815088, all_tables=0x14fbc3874790) at /test/10.5_dbg/sql/sql_parse.cc:6209
#23 0x00005625da88f312 in mysql_execute_command (thd=thd@entry=0x14fbc3815088) at /test/10.5_dbg/sql/sql_parse.cc:3939
#24 0x00005625da89c15c in mysql_parse (thd=thd@entry=0x14fbc3815088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14fbe445b350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993
#25 0x00005625da888c60 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14fbc3815088, packet=packet@entry=0x14fbc3867089 "", packet_length=packet_length@entry=73, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
#26 0x00005625da88743a in do_command (thd=0x14fbc3815088) at /test/10.5_dbg/sql/sql_parse.cc:1355
#27 0x00005625da9e2c47 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14fbc657a808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
#28 0x00005625da9e3363 in handle_one_connection (arg=arg@entry=0x14fbc657a808) at /test/10.5_dbg/sql/sql_connect.cc:1313
#29 0x00005625dae44902 in pfs_spawn_thread (arg=0x14fbe3c46c88) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#30 0x000014fbe5db26db in start_thread (arg=0x14fbe445c700) at pthread_create.c:463
#31 0x000014fbe51b088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Bug confirmed present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.4 (dbg)
Bug confirmed not present in:
MariaDB: 10.5.4 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
Stacks from 10.4.14 (opt):
10.4.14 ea7830eef48333e28f98a9b91f05a95735b465a3 (opt)
Core was generated by `/test/MD260520-mariadb-10.4.14-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14b37fd05700 (LWP 2794543))]
(gdb) bt
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1 0x00005602b4f4ba77 in my_write_core (sig=sig@entry=11) at /test/10.4_opt/mysys/stacktrace.c:481
#2 0x00005602b4923b0a in handle_fatal_signal (sig=11) at /test/10.4_opt/sql/signal_handler.cc:343
#3 <signal handler called>
#4 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:423
#5 0x00005602b491fc86 in memcpy (__len=3098, __src=<optimized out>, __dest=<optimized out>)
at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
#6 my_b_write (Count=3098, Buffer=<optimized out>, info=0x14b37fd01d80)
at /test/10.4_opt/include/my_sys.h:539
#7 write_keys (param=param@entry=0x14b37fd01cf0, fs_info=fs_info@entry=0x14b358cc7480,
count=<optimized out>, count@entry=1, buffpek_pointers=buffpek_pointers@entry=0x14b37fd01e70,
tempfile=tempfile@entry=0x14b37fd01d80) at /test/10.4_opt/sql/filesort.cc:926
#8 0x00005602b4922d31 in find_all_keys (found_rows=0x14b358cc75e0, pq=0x0, tempfile=0x14b37fd01d80,
buffpek_pointers=0x14b37fd01e70, fs_info=0x14b358cc7480, select=0x14b358c43800,
param=0x14b37fd01cf0, thd=0x14b358c12008) at /test/10.4_opt/sql/filesort.cc:863
#9 filesort (thd=thd@entry=0x14b358c12008, table=table@entry=0x14b358c60c08,
filesort=filesort@entry=0x14b358c43950, tracker=0x14b358c44008, join=join@entry=0x14b358c40da0,
first_table_bit=<optimized out>) at /test/10.4_opt/sql/filesort.cc:262
#10 0x00005602b475da05 in create_sort_index (thd=0x14b358c12008, join=0x14b358c40da0,
tab=tab@entry=0x14b358c42f40, fsort=0x14b358c43950, fsort@entry=0x0)
at /test/10.4_opt/sql/sql_select.cc:23603
#11 0x00005602b475dcb6 in st_join_table::sort_table (this=this@entry=0x14b358c42f40)
at /test/10.4_opt/sql/sql_select.cc:21347
#12 0x00005602b475dd4a in join_init_read_record (tab=0x14b358c42f40)
at /test/10.4_opt/sql/sql_select.cc:21286
#13 0x00005602b474fdd3 in sub_select (join=0x14b358c40da0, join_tab=0x14b358c42f40,
end_of_records=false) at /test/10.4_opt/sql/sql_select.cc:20363
#14 0x00005602b477112e in do_select (procedure=<optimized out>, join=0x14b358c40da0)
at /test/10.4_opt/sql/sql_select.cc:19904
#15 JOIN::exec_inner (this=this@entry=0x14b358c40da0) at /test/10.4_opt/sql/sql_select.cc:4459
#16 0x00005602b4771503 in JOIN::exec (this=this@entry=0x14b358c40da0)
at /test/10.4_opt/sql/sql_select.cc:4241
#17 0x00005602b476f8e1 in mysql_select (thd=thd@entry=0x14b358c12008, tables=0x14b358c3f6d8,
wild_num=1, fields=..., conds=<optimized out>, og_num=2, order=0x14b358c40ab0, group=0x0, having=
0x0, proc_param=0x0, select_options=2147748608, result=0x14b358c40d78, unit=0x14b358c15d70,
select_lex=0x14b358c3f118) at /test/10.4_opt/sql/sql_select.cc:4673
#18 0x00005602b4770291 in handle_select (thd=thd@entry=0x14b358c12008, lex=lex@entry=0x14b358c15cb0,
result=result@entry=0x14b358c40d78, setup_tables_done_option=setup_tables_done_option@entry=0)
at /test/10.4_opt/sql/sql_select.cc:410
#19 0x00005602b470d061 in execute_sqlcom_select (thd=thd@entry=0x14b358c12008,
all_tables=0x14b358c3f6d8) at /test/10.4_opt/sql/sql_parse.cc:6359
#20 0x00005602b4715377 in mysql_execute_command (thd=thd@entry=0x14b358c12008)
at /test/10.4_opt/sql/sql_parse.cc:3898
#21 0x00005602b471c36a in mysql_parse (thd=0x14b358c12008, rawbuf=<optimized out>, length=73,
parser_state=0x14b37fd04550, is_com_multi=<optimized out>, is_next_command=<optimized out>)
at /test/10.4_opt/sql/sql_parse.cc:7900
#22 0x00005602b471eab5 in dispatch_command (command=command@entry=COM_QUERY,
thd=thd@entry=0x14b358c12008, packet=packet@entry=0x14b358c32009 "",
packet_length=packet_length@entry=73, is_com_multi=is_com_multi@entry=false,
is_next_command=is_next_command@entry=false) at /test/10.4_opt/sql/sql_parse.cc:1841
#23 0x00005602b471ff64 in do_command (thd=0x14b358c12008) at /test/10.4_opt/sql/sql_parse.cc:1359
#24 0x00005602b47fc64e in do_handle_one_connection (connect=connect@entry=0x14b37d431748)
at /test/10.4_opt/sql/sql_connect.cc:1412
#25 0x00005602b47fc70d in handle_one_connection (arg=0x14b37d431748)
at /test/10.4_opt/sql/sql_connect.cc:1316
#26 0x000014b37eeab6db in start_thread (arg=0x14b37fd05700) at pthread_create.c:463
#27 0x000014b37e2a988f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95