|
danblack,
Your test case is good, but you need to run it through a C connector or through a stored procedure/cursor, as you want to get into Select_materialize::send_result_set_metadata.
With C-connector it will be as close as it can be to oursql, as server-side connectors are apparently its main (and only) distinctive feature. Probably this is also the reason why it stopped happening after switching to PyMySQL – no server-side cursors, no problem.
I'm not much of a C-writer, but something like this does the trick (cleanups and fetch are skipped as unimportant for proof of concept):
#include <mysql.h>
|
#include <stddef.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <string.h>
|
|
int main(int argc, char **argv)
|
{
|
MYSQL *con = mysql_init(NULL);
|
MYSQL_STMT *stmt = mysql_stmt_init(con);
|
|
if (mysql_real_connect(con, "127.0.0.1", "root", "", "test", 0, NULL, 0) == NULL)
|
{
|
fprintf(stderr,"Can't connect: %s\n",mysql_error(con));
|
exit(1);
|
}
|
|
mysql_query(con,
|
"CREATE OR REPLACE TABLE `774_patient` ("
|
"`patientID` int(10) unsigned NOT NULL AUTO_INCREMENT, "
|
"`pid` varchar(64) NOT NULL, "
|
"`pname` varchar(100) NOT NULL, "
|
"PRIMARY KEY (`patientID`) "
|
") ENGINE=InnoDB AUTO_INCREMENT=317145 DEFAULT CHARSET=utf8");
|
|
mysql_query(con,
|
"CREATE OR REPLACE TABLE `774_study` ("
|
"`received` datetime(6) NOT NULL, "
|
"`patientID` int(10) unsigned NOT NULL, "
|
"PRIMARY KEY (`received`), "
|
"KEY `idx_774_study_patientID` (`patientID`) "
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8");
|
|
mysql_query(con,
|
"insert into 774_patient(patientID,pname,pid) select seq, uuid(), uuid() from seq_1_to_10000");
|
mysql_query(con,
|
"insert into 774_study(received,patientID) select date_add('2020-01-01', INTERVAL seq SECOND), seq from seq_1_to_20000");
|
|
const char* query=
|
"select 774_study.patientID AS patientID "
|
"from 774_study left join 774_patient "
|
"on 774_study.patientID = 774_patient.patientID "
|
"where exists (select pname from 774_patient where pname like 'doe%john%^w%^%^%^%') "
|
"and 774_patient.pname in (select pname from 774_patient where pname like 'doe%john%^w%^%^%^%') "
|
"order by received desc limit 50";
|
|
if (mysql_stmt_prepare(stmt,query,strlen(query)))
|
{
|
fprintf(stderr,"Couldn't prepare: %s\n", mysql_error(con));
|
mysql_close(con);
|
exit(1);
|
}
|
|
unsigned long cursor = CURSOR_TYPE_READ_ONLY;
|
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor);
|
|
if (mysql_stmt_execute(stmt))
|
fprintf(stderr,"Got error: %s\n", mysql_stmt_error(stmt));
|
else
|
fprintf(stderr,"Didn't get an error\n");
|
|
mysql_stmt_close(stmt);
|
mysql_close(con);
|
exit(0);
|
}
|
Of course since it's SIGSEGV, the exact crash is a matter of some luck and can vary on different machines and builds. CentOS 8 optimized release from packages produces the stack trace seemingly identical to the one provided by gsmethells:
|
10.5.6 on CentOS 8
|
(my_print_stacktrace)[0x55847c5e3ece]
|
(handle_fatal_signal)[0x55847c06eec5]
|
sigaction.c:0(__restore_rt)[0x7f3caafa1b20]
|
(Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool))[0x55847bec1958]
|
(create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool))[0x55847bec260d]
|
(select_unit::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int))[0x55847bf2378b]
|
(Select_materialize::send_result_set_metadata(List<Item>&, unsigned int))[0x55847be3a3c3]
|
(JOIN::exec_inner())[0x55847bedceca]
|
(JOIN::exec())[0x55847beddc17]
|
(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x5584
|
7bedbf02]
|
(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55847bedc7eb]
|
(LEX::mark_first_table_as_inserting())[0x55847be7aeed]
|
(mysql_execute_command(THD*))[0x55847be82fbe]
|
(mysql_open_cursor(THD*, select_result*, Server_side_cursor**))[0x55847be3a6bc]
|
(Prepared_statement::execute(String*, bool))[0x55847be97a1e]
|
(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55847be97de2]
|
(Prepared_statement::execute_bulk_loop(String*, bool, unsigned char*, unsigned char*))[0x55847be98b35]
|
(mysqld_stmt_execute(THD*, char*, unsigned int))[0x55847be98bd5]
|
(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55847be7f512]
|
(do_command(THD*))[0x55847be8124f]
|
(do_handle_one_connection(CONNECT*, bool))[0x55847bf70bf1]
|
(handle_one_connection)[0x55847bf70f7d]
|
(MyCTX_nopad::finish(unsigned char*, unsigned int*))[0x55847c28dd5a]
|
pthread_create.c:0(start_thread)[0x7f3caaf9714a]
|
:0(__GI___clone)[0x7f3ca8e04f23]
|
And here is debug ASAN build, it fails apparently before it even reaches finalize:
|
10.5 7f75acc0 debug ASAN
|
==2554105==ERROR: AddressSanitizer: heap-use-after-free on address 0x6190000b5620 at pc 0x558c6dd18407 bp 0x7fb7dc566640 sp 0x7fb7dc566630
|
READ of size 8 at 0x6190000b5620 thread T13
|
#0 0x558c6dd18406 in Field::maybe_null() const /data/src/10.5/sql/field.h:1386
|
#1 0x558c6dcb9853 in Item_field::create_tmp_field_from_item_field(st_mem_root*, TABLE*, Item_ref*, Tmp_field_param const*) /data/src/10.5/sql/sql_select.cc:18023
|
#2 0x558c6dcb9bd5 in Item_field::create_tmp_field_ex(st_mem_root*, TABLE*, Tmp_field_src*, Tmp_field_param const*) /data/src/10.5/sql/sql_select.cc:18041
|
#3 0x558c6dcbade1 in create_tmp_field(TABLE*, Item*, Item***, Field**, Field**, bool, bool, bool, bool) /data/src/10.5/sql/sql_select.cc:18196
|
#4 0x558c6dcbf498 in Create_tmp_table::add_fields(THD*, TABLE*, TMP_TABLE_PARAM*, List<Item>&) /data/src/10.5/sql/sql_select.cc:18684
|
#5 0x558c6dcc7d5f in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.5/sql/sql_select.cc:19321
|
#6 0x558c6de69959 in select_unit::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int) /data/src/10.5/sql/sql_union.cc:329
|
#7 0x558c6da91334 in Select_materialize::send_result_set_metadata(List<Item>&, unsigned int) /data/src/10.5/sql/sql_cursor.cc:444
|
#8 0x558c6dca4e63 in return_zero_rows /data/src/10.5/sql/sql_select.cc:14496
|
#9 0x558c6dc5b2fb in JOIN::exec_inner() /data/src/10.5/sql/sql_select.cc:4392
|
#10 0x558c6dc59509 in JOIN::exec() /data/src/10.5/sql/sql_select.cc:4249
|
#11 0x558c6dc5d958 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.5/sql/sql_select.cc:4725
|
#12 0x558c6dc2f11b in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.5/sql/sql_select.cc:419
|
#13 0x558c6db98687 in execute_sqlcom_select /data/src/10.5/sql/sql_parse.cc:6307
|
#14 0x558c6db87979 in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:4003
|
#15 0x558c6da8eccb in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/10.5/sql/sql_cursor.cc:150
|
#16 0x558c6dbf7a8e in Prepared_statement::execute(String*, bool) /data/src/10.5/sql/sql_prepare.cc:5008
|
#17 0x558c6dbf30c6 in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /data/src/10.5/sql/sql_prepare.cc:4488
|
#18 0x558c6dbec37d in mysql_stmt_execute_common /data/src/10.5/sql/sql_prepare.cc:3460
|
#19 0x558c6dbeb555 in mysqld_stmt_execute(THD*, char*, unsigned int) /data/src/10.5/sql/sql_prepare.cc:3239
|
#20 0x558c6db7949e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1813
|
#21 0x558c6db7653d in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1370
|
#22 0x558c6dfb9cf8 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1410
|
#23 0x558c6dfb965c in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1312
|
#24 0x558c6eccfa52 in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:2201
|
#25 0x7fb80081a608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
|
#26 0x7fb8003ee292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
|
|
0x6190000b5620 is located 416 bytes inside of 1124-byte region [0x6190000b5480,0x6190000b58e4)
|
freed by thread T13 here:
|
#0 0x7fb800d6a7cf in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
|
#1 0x558c6f97a343 in free_memory /data/src/10.5/mysys/safemalloc.c:280
|
#2 0x558c6f9798ff in sf_free /data/src/10.5/mysys/safemalloc.c:198
|
#3 0x558c6f9471ee in my_free /data/src/10.5/mysys/my_malloc.c:211
|
#4 0x558c6f92321d in free_root /data/src/10.5/mysys/my_alloc.c:416
|
#5 0x558c6dcce45e in free_tmp_table(THD*, TABLE*) /data/src/10.5/sql/sql_select.cc:20083
|
#6 0x558c6dca0df9 in JOIN::cleanup(bool) /data/src/10.5/sql/sql_select.cc:13945
|
#7 0x558c6dca008a in JOIN::join_free() /data/src/10.5/sql/sql_select.cc:13832
|
#8 0x558c6dca4b28 in return_zero_rows /data/src/10.5/sql/sql_select.cc:14457
|
#9 0x558c6dc5b2fb in JOIN::exec_inner() /data/src/10.5/sql/sql_select.cc:4392
|
#10 0x558c6dc59509 in JOIN::exec() /data/src/10.5/sql/sql_select.cc:4249
|
#11 0x558c6dc5d958 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.5/sql/sql_select.cc:4725
|
#12 0x558c6dc2f11b in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.5/sql/sql_select.cc:419
|
#13 0x558c6db98687 in execute_sqlcom_select /data/src/10.5/sql/sql_parse.cc:6307
|
#14 0x558c6db87979 in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:4003
|
#15 0x558c6da8eccb in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/10.5/sql/sql_cursor.cc:150
|
#16 0x558c6dbf7a8e in Prepared_statement::execute(String*, bool) /data/src/10.5/sql/sql_prepare.cc:5008
|
#17 0x558c6dbf30c6 in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /data/src/10.5/sql/sql_prepare.cc:4488
|
#18 0x558c6dbec37d in mysql_stmt_execute_common /data/src/10.5/sql/sql_prepare.cc:3460
|
#19 0x558c6dbeb555 in mysqld_stmt_execute(THD*, char*, unsigned int) /data/src/10.5/sql/sql_prepare.cc:3239
|
#20 0x558c6db7949e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1813
|
#21 0x558c6db7653d in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1370
|
#22 0x558c6dfb9cf8 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1410
|
#23 0x558c6dfb965c in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1312
|
#24 0x558c6eccfa52 in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:2201
|
#25 0x7fb80081a608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
|
|
previously allocated by thread T13 here:
|
#0 0x7fb800d6abc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
|
#1 0x558c6f9792b3 in sf_malloc /data/src/10.5/mysys/safemalloc.c:121
|
#2 0x558c6f9463c8 in my_malloc /data/src/10.5/mysys/my_malloc.c:90
|
#3 0x558c6f92217c in alloc_root /data/src/10.5/mysys/my_alloc.c:244
|
#4 0x558c6f92387e in memdup_root /data/src/10.5/mysys/my_alloc.c:479
|
#5 0x558c6e2fa41f in Field::make_new_field(st_mem_root*, TABLE*, bool) /data/src/10.5/sql/field.cc:2477
|
#6 0x558c6e2fa8d6 in Field::create_tmp_field(st_mem_root*, TABLE*, bool) /data/src/10.5/sql/field.cc:2535
|
#7 0x558c6dcb98b6 in Item_field::create_tmp_field_from_item_field(st_mem_root*, TABLE*, Item_ref*, Tmp_field_param const*) /data/src/10.5/sql/sql_select.cc:18024
|
#8 0x558c6dcb9bd5 in Item_field::create_tmp_field_ex(st_mem_root*, TABLE*, Tmp_field_src*, Tmp_field_param const*) /data/src/10.5/sql/sql_select.cc:18041
|
#9 0x558c6dcbade1 in create_tmp_field(TABLE*, Item*, Item***, Field**, Field**, bool, bool, bool, bool) /data/src/10.5/sql/sql_select.cc:18196
|
#10 0x558c6dcbf498 in Create_tmp_table::add_fields(THD*, TABLE*, TMP_TABLE_PARAM*, List<Item>&) /data/src/10.5/sql/sql_select.cc:18684
|
#11 0x558c6dcc7d5f in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool) /data/src/10.5/sql/sql_select.cc:19321
|
#12 0x558c6dc53e35 in JOIN::create_postjoin_aggr_table(st_join_table*, List<Item>*, st_order*, bool, bool, bool) /data/src/10.5/sql/sql_select.cc:3755
|
#13 0x558c6dc4f91c in JOIN::make_aggr_tables_info() /data/src/10.5/sql/sql_select.cc:3355
|
#14 0x558c6dc4b4e0 in JOIN::optimize_stage2() /data/src/10.5/sql/sql_select.cc:2999
|
#15 0x558c6dc43d25 in JOIN::optimize_inner() /data/src/10.5/sql/sql_select.cc:2284
|
#16 0x558c6dc3cef1 in JOIN::optimize() /data/src/10.5/sql/sql_select.cc:1630
|
#17 0x558c6dc5d763 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.5/sql/sql_select.cc:4711
|
#18 0x558c6dc2f11b in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.5/sql/sql_select.cc:419
|
#19 0x558c6db98687 in execute_sqlcom_select /data/src/10.5/sql/sql_parse.cc:6307
|
#20 0x558c6db87979 in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:4003
|
#21 0x558c6da8eccb in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/10.5/sql/sql_cursor.cc:150
|
#22 0x558c6dbf7a8e in Prepared_statement::execute(String*, bool) /data/src/10.5/sql/sql_prepare.cc:5008
|
#23 0x558c6dbf30c6 in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /data/src/10.5/sql/sql_prepare.cc:4488
|
#24 0x558c6dbec37d in mysql_stmt_execute_common /data/src/10.5/sql/sql_prepare.cc:3460
|
#25 0x558c6dbeb555 in mysqld_stmt_execute(THD*, char*, unsigned int) /data/src/10.5/sql/sql_prepare.cc:3239
|
#26 0x558c6db7949e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1813
|
#27 0x558c6db7653d in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1370
|
#28 0x558c6dfb9cf8 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1410
|
#29 0x558c6dfb965c in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1312
|
|
Thread T13 created by T0 here:
|
#0 0x7fb800c97805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
|
#1 0x558c6ecca9f6 in my_thread_create /data/src/10.5/storage/perfschema/my_thread.h:38
|
#2 0x558c6eccfe45 in pfs_spawn_thread_v1 /data/src/10.5/storage/perfschema/pfs.cc:2252
|
#3 0x558c6d86a492 in inline_mysql_thread_create /data/src/10.5/include/mysql/psi/mysql_thread.h:1323
|
#4 0x558c6d8805f0 in create_thread_to_handle_connection(CONNECT*) /data/src/10.5/sql/mysqld.cc:6012
|
#5 0x558c6d880c6f in create_new_thread(CONNECT*) /data/src/10.5/sql/mysqld.cc:6071
|
#6 0x558c6d880fcc in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.5/sql/mysqld.cc:6136
|
#7 0x558c6d881beb in handle_connections_sockets() /data/src/10.5/sql/mysqld.cc:6263
|
#8 0x558c6d87fdfd in mysqld_main(int, char**) /data/src/10.5/sql/mysqld.cc:5658
|
#9 0x558c6d868f5c in main /data/src/10.5/sql/main.cc:25
|
#10 0x7fb8002f30b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
|
|
SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.5/sql/field.h:1386 in Field::maybe_null() const
|
Shadow bytes around the buggy address:
|
0x0c328000ea70: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0c328000ea80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0c328000ea90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000eaa0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000eab0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
=>0x0c328000eac0: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000ead0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000eae0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000eaf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000eb00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000eb10: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
|
Shadow byte legend (one shadow byte represents 8 application bytes):
|
Addressable: 00
|
Partially addressable: 01 02 03 04 05 06 07
|
Heap left redzone: fa
|
Freed heap region: fd
|
Stack left redzone: f1
|
Stack mid redzone: f2
|
Stack right redzone: f3
|
Stack after return: f5
|
Stack use after scope: f8
|
Global redzone: f9
|
Global init order: f6
|
Poisoned by user: f7
|
Container overflow: fc
|
Array cookie: ac
|
Intra object redzone: bb
|
ASan internal: fe
|
Left alloca redzone: ca
|
Right alloca redzone: cb
|
Shadow gap: cc
|
==2554105==ABORTING
|
210406 2:23:52 [ERROR] mysqld got signal 6 ;
|
This could be because you hit a bug. It is also possible that this binary
|
or one of the libraries it was linked against is corrupt, improperly built,
|
or misconfigured. This error can also be caused by malfunctioning hardware.
|
|
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
|
|
We will try our best to scrape up some info that will hopefully help
|
diagnose the problem, but since we have already crashed,
|
something is definitely wrong and this may fail.
|
|
Server version: 10.5.10-MariaDB-debug
|
key_buffer_size=134217728
|
read_buffer_size=131072
|
max_used_connections=1
|
max_threads=153
|
thread_count=1
|
It is possible that mysqld could use up to
|
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467974 K bytes of memory
|
Hope that's ok; if not, decrease some variables in the equation.
|
|
Thread pointer: 0x62b00009a288
|
Attempting backtrace. You can use the following information to find out
|
where mysqld died. If you see no messages after this, something went
|
terribly wrong...
|
stack_bottom = 0x7fb7dc569d50 thread_stack 0x100000
|
??:0(__interceptor_tcgetattr)[0x7fb800cc9d30]
|
/data/bld/10.5-asan-nightly/bin/mysqld(my_print_stacktrace+0xec)[0x558c6f956a10]
|
/data/bld/10.5-asan-nightly/bin/mysqld(handle_fatal_signal+0xa1a)[0x558c6e382f03]
|
sigaction.c:0(__restore_rt)[0x7fb8008263c0]
|
??:0(gsignal)[0x7fb80031218b]
|
??:0(abort)[0x7fb8002f1859]
|
??:0(__sanitizer_set_report_fd)[0x7fb800d886a2]
|
??:0(__sanitizer_get_module_and_offset_for_pc)[0x7fb800d9324c]
|
??:0(__sanitizer_ptr_cmp)[0x7fb800d748ec]
|
??:0(__asan_on_error)[0x7fb800d74363]
|
??:0(__asan_report_load8)[0x7fb800d751ab]
|
sql/field.h:1386(Field::maybe_null() const)[0x558c6dd18407]
|
sql/sql_select.cc:18023(Item_field::create_tmp_field_from_item_field(st_mem_root*, TABLE*, Item_ref*, Tmp_field_param const*))[0x558c6dcb9854]
|
sql/sql_select.cc:18041(Item_field::create_tmp_field_ex(st_mem_root*, TABLE*, Tmp_field_src*, Tmp_field_param const*))[0x558c6dcb9bd6]
|
sql/sql_select.cc:18196(create_tmp_field(TABLE*, Item*, Item***, Field**, Field**, bool, bool, bool, bool))[0x558c6dcbade2]
|
sql/sql_select.cc:18684(Create_tmp_table::add_fields(THD*, TABLE*, TMP_TABLE_PARAM*, List<Item>&))[0x558c6dcbf499]
|
sql/sql_select.cc:19320(create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool))[0x558c6dcc7d60]
|
sql/sql_union.cc:329(select_unit::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int))[0x558c6de6995a]
|
sql/sql_cursor.cc:444(Select_materialize::send_result_set_metadata(List<Item>&, unsigned int))[0x558c6da91335]
|
sql/sql_select.cc:14496(return_zero_rows(JOIN*, select_result*, List<TABLE_LIST>&, List<Item>&, bool, unsigned long long, char const*, Item*, List<Item>&))[0x558c6dca4e64]
|
sql/sql_select.cc:4392(JOIN::exec_inner())[0x558c6dc5b2fc]
|
sql/sql_select.cc:4250(JOIN::exec())[0x558c6dc5950a]
|
sql/sql_select.cc:4727(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x558c6dc5d959]
|
sql/sql_select.cc:419(handle_select(THD*, LEX*, select_result*, unsigned long))[0x558c6dc2f11c]
|
sql/sql_parse.cc:6307(execute_sqlcom_select(THD*, TABLE_LIST*))[0x558c6db98688]
|
sql/sql_parse.cc:4003(mysql_execute_command(THD*))[0x558c6db8797a]
|
sql/sql_cursor.cc:150(mysql_open_cursor(THD*, select_result*, Server_side_cursor**))[0x558c6da8eccc]
|
sql/sql_prepare.cc:5008(Prepared_statement::execute(String*, bool))[0x558c6dbf7a8f]
|
sql/sql_prepare.cc:4488(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x558c6dbf30c7]
|
sql/sql_prepare.cc:3460(mysql_stmt_execute_common(THD*, unsigned long, unsigned char*, unsigned char*, unsigned long, bool, bool))[0x558c6dbec37e]
|
sql/sql_prepare.cc:3239(mysqld_stmt_execute(THD*, char*, unsigned int))[0x558c6dbeb556]
|
sql/sql_parse.cc:1815(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x558c6db7949f]
|
sql/sql_parse.cc:1370(do_command(THD*))[0x558c6db7653e]
|
sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x558c6dfb9cf9]
|
sql/sql_connect.cc:1314(handle_one_connection)[0x558c6dfb965d]
|
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x558c6eccfa53]
|
nptl/pthread_create.c:478(start_thread)[0x7fb80081a609]
|
??:0(clone)[0x7fb8003ee293]
|
|
Trying to get some variables.
|
Some pointers may be invalid and cause the dump to abort.
|
Query (0x62b0000b0e50): select 774_study.patientID AS patientID from 774_study left join 774_patient on 774_study.patientID = 774_patient.patientID where exists (select pname from 774_patient where pname like 'doe%john%^w%^%^%^%') and 774_patient.pname in (select pname from 774_patient where pname like 'doe%john%^w%^%^%^%') order by received desc limit 50
|
|
Connection ID (thread ID): 5
|
Status: NOT_KILLED
|
|
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
|
|
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
|
information that should help you find out what is causing the crash.
|
Writing a core file...
|
Working directory at /mnt-hd8t/bld/10.5-asan-nightly/data
|
Resource Limits:
|
Limit Soft Limit Hard Limit Units
|
Max cpu time unlimited unlimited seconds
|
Max file size unlimited unlimited bytes
|
Max data size unlimited unlimited bytes
|
Max stack size 8388608 unlimited bytes
|
Max core file size unlimited unlimited bytes
|
Max resident set unlimited unlimited bytes
|
Max processes 385874 385874 processes
|
Max open files 32198 32198 files
|
Max locked memory 67108864 67108864 bytes
|
Max address space unlimited unlimited bytes
|
Max file locks unlimited unlimited locks
|
Max pending signals 385874 385874 signals
|
Max msgqueue size 819200 819200 bytes
|
Max nice priority 0 0
|
Max realtime priority 0 0
|
Max realtime timeout unlimited unlimited us
|
Core pattern: |/usr/share/apport/apport %p %s %c %d %P %E
|
If the same is done through a cursor inside a stored procedure, the stack trace will be different, as it will include the SP call. On the bright side, it can be run through MTR.
--source include/have_innodb.inc
|
--source include/have_sequence.inc
|
|
CREATE OR REPLACE TABLE `774_patient` (
|
`patientID` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`pid` varchar(64) NOT NULL,
|
`pname` varchar(100) NOT NULL,
|
PRIMARY KEY (`patientID`)
|
) ENGINE=InnoDB CHARSET=utf8;
|
|
CREATE OR REPLACE TABLE `774_study` (
|
`received` datetime(6) NOT NULL,
|
`patientID` int(10) unsigned NOT NULL,
|
PRIMARY KEY (`received`),
|
KEY `idx_774_study_patientID` (`patientID`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
insert into 774_patient(patientID,pname,pid) select seq, uuid(), uuid() from seq_1_to_10000;
|
insert into 774_study(received,patientID) select date_add('2020-01-01', INTERVAL seq SECOND), seq from seq_1_to_20000;
|
|
--delimiter $
|
create or replace procedure pr()
|
begin
|
DECLARE done INT DEFAULT FALSE;
|
DECLARE a int;
|
|
DECLARE cur1 CURSOR FOR select 774_study.patientID AS patientID from 774_study left join 774_patient on 774_study.patientID = 774_patient.patientID where exists (select pname from 774_patient where pname like 'doe%john%^w%^%^%^%') and 774_patient.pname in (select pname from 774_patient where pname like 'doe%john%^w%^%^%^%') order by received desc limit 50;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
OPEN cur1;
|
read_loop: LOOP
|
FETCH cur1 INTO a;
|
IF done THEN
|
LEAVE read_loop;
|
END IF;
|
END LOOP;
|
CLOSE cur1;
|
END $
|
|
--delimiter ;
|
|
call pr();
|
|
10.2 6fe624b5 debug ASAN
|
==2554381==ERROR: AddressSanitizer: heap-use-after-free on address 0x619003204ce0 at pc 0x55d6bb8760fa bp 0x7fb8aee01d10 sp 0x7fb8aee01d00
|
READ of size 8 at 0x619003204ce0 thread T27
|
#0 0x55d6bb8760f9 in create_tmp_field_from_field(THD*, Field*, char const*, TABLE*, Item_field*) /data/src/10.2/sql/sql_select.cc:16274
|
#1 0x55d6bb877ccb in create_tmp_field(THD*, TABLE*, Item*, Item::Type, Item***, Field**, Field**, bool, bool, bool, bool) /data/src/10.2/sql/sql_select.cc:16529
|
#2 0x55d6bb87b13e in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, char const*, bool, bool) /data/src/10.2/sql/sql_select.cc:16977
|
#3 0x55d6bb9d3449 in select_union::create_result_table(THD*, List<Item>*, bool, unsigned long long, char const*, bool, bool, bool) /data/src/10.2/sql/sql_union.cc:180
|
#4 0x55d6bb6d49e1 in Select_materialize::send_result_set_metadata(List<Item>&, unsigned int) /data/src/10.2/sql/sql_cursor.cc:436
|
#5 0x55d6bb863bb0 in return_zero_rows /data/src/10.2/sql/sql_select.cc:12918
|
#6 0x55d6bb821c79 in JOIN::exec_inner() /data/src/10.2/sql/sql_select.cc:3573
|
#7 0x55d6bb82014d in JOIN::exec() /data/src/10.2/sql/sql_select.cc:3437
|
#8 0x55d6bb8239d0 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.2/sql/sql_select.cc:3840
|
#9 0x55d6bb8003f7 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.2/sql/sql_select.cc:361
|
#10 0x55d6bb7770d8 in execute_sqlcom_select /data/src/10.2/sql/sql_parse.cc:6274
|
#11 0x55d6bb764477 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:3585
|
#12 0x55d6bb6d2427 in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/10.2/sql/sql_cursor.cc:141
|
#13 0x55d6bb5c8b61 in sp_cursor::open(THD*) /data/src/10.2/sql/sp_rcontext.cc:464
|
#14 0x55d6bb5b655d in sp_instr_copen::exec_core(THD*, unsigned int*) /data/src/10.2/sql/sp_head.cc:3929
|
#15 0x55d6bb5b0f5c in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /data/src/10.2/sql/sp_head.cc:3095
|
#16 0x55d6bb5b62e6 in sp_instr_copen::execute(THD*, unsigned int*) /data/src/10.2/sql/sp_head.cc:3914
|
#17 0x55d6bb5a6003 in sp_head::execute(THD*, bool) /data/src/10.2/sql/sp_head.cc:1326
|
#18 0x55d6bb5aa7ce in sp_head::execute_procedure(THD*, List<Item>*) /data/src/10.2/sql/sp_head.cc:2202
|
#19 0x55d6bb7600f1 in do_execute_sp /data/src/10.2/sql/sql_parse.cc:2981
|
#20 0x55d6bb7723b5 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:5625
|
#21 0x55d6bb780669 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7794
|
#22 0x55d6bb75974b in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
|
#23 0x55d6bb75650a in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
|
#24 0x55d6bbade8c5 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
|
#25 0x55d6bbade188 in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
|
#26 0x55d6bce7fd6d in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
|
#27 0x7fb8c59a3608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
|
#28 0x7fb8c557f292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
|
|
0x619003204ce0 is located 352 bytes inside of 1100-byte region [0x619003204b80,0x619003204fcc)
|
freed by thread T27 here:
|
#0 0x7fb8c5f6e7cf in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
|
#1 0x55d6bcf9d9e6 in free_memory /data/src/10.2/mysys/safemalloc.c:279
|
#2 0x55d6bcf9cf32 in sf_free /data/src/10.2/mysys/safemalloc.c:197
|
#3 0x55d6bcf6929e in my_free /data/src/10.2/mysys/my_malloc.c:218
|
#4 0x55d6bcf47102 in free_root /data/src/10.2/mysys/my_alloc.c:401
|
#5 0x55d6bb886e96 in free_tmp_table(THD*, TABLE*) /data/src/10.2/sql/sql_select.cc:18191
|
#6 0x55d6bb86005a in JOIN::cleanup(bool) /data/src/10.2/sql/sql_select.cc:12383
|
#7 0x55d6bb85f3a4 in JOIN::join_free() /data/src/10.2/sql/sql_select.cc:12273
|
#8 0x55d6bb863875 in return_zero_rows /data/src/10.2/sql/sql_select.cc:12879
|
#9 0x55d6bb821c79 in JOIN::exec_inner() /data/src/10.2/sql/sql_select.cc:3573
|
#10 0x55d6bb82014d in JOIN::exec() /data/src/10.2/sql/sql_select.cc:3437
|
#11 0x55d6bb8239d0 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.2/sql/sql_select.cc:3840
|
#12 0x55d6bb8003f7 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.2/sql/sql_select.cc:361
|
#13 0x55d6bb7770d8 in execute_sqlcom_select /data/src/10.2/sql/sql_parse.cc:6274
|
#14 0x55d6bb764477 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:3585
|
#15 0x55d6bb6d2427 in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/10.2/sql/sql_cursor.cc:141
|
#16 0x55d6bb5c8b61 in sp_cursor::open(THD*) /data/src/10.2/sql/sp_rcontext.cc:464
|
#17 0x55d6bb5b655d in sp_instr_copen::exec_core(THD*, unsigned int*) /data/src/10.2/sql/sp_head.cc:3929
|
#18 0x55d6bb5b0f5c in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /data/src/10.2/sql/sp_head.cc:3095
|
#19 0x55d6bb5b62e6 in sp_instr_copen::execute(THD*, unsigned int*) /data/src/10.2/sql/sp_head.cc:3914
|
#20 0x55d6bb5a6003 in sp_head::execute(THD*, bool) /data/src/10.2/sql/sp_head.cc:1326
|
#21 0x55d6bb5aa7ce in sp_head::execute_procedure(THD*, List<Item>*) /data/src/10.2/sql/sp_head.cc:2202
|
#22 0x55d6bb7600f1 in do_execute_sp /data/src/10.2/sql/sql_parse.cc:2981
|
#23 0x55d6bb7723b5 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:5625
|
#24 0x55d6bb780669 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7794
|
#25 0x55d6bb75974b in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
|
#26 0x55d6bb75650a in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
|
#27 0x55d6bbade8c5 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
|
#28 0x55d6bbade188 in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
|
#29 0x55d6bce7fd6d in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
|
|
previously allocated by thread T27 here:
|
#0 0x7fb8c5f6ebc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
|
#1 0x55d6bcf9c8a4 in sf_malloc /data/src/10.2/mysys/safemalloc.c:118
|
#2 0x55d6bcf6882d in my_malloc /data/src/10.2/mysys/my_malloc.c:101
|
#3 0x55d6bcf45e9f in alloc_root /data/src/10.2/mysys/my_alloc.c:243
|
#4 0x55d6bcf478d5 in memdup_root /data/src/10.2/mysys/my_alloc.c:464
|
#5 0x55d6bbd1adbf in Field::make_new_field(st_mem_root*, TABLE*, bool) /data/src/10.2/sql/field.cc:2387
|
#6 0x55d6bb87619b in create_tmp_field_from_field(THD*, Field*, char const*, TABLE*, Item_field*) /data/src/10.2/sql/sql_select.cc:16273
|
#7 0x55d6bb877ccb in create_tmp_field(THD*, TABLE*, Item*, Item::Type, Item***, Field**, Field**, bool, bool, bool, bool) /data/src/10.2/sql/sql_select.cc:16529
|
#8 0x55d6bb87b13e in create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, char const*, bool, bool) /data/src/10.2/sql/sql_select.cc:16977
|
#9 0x55d6bb81ba46 in JOIN::create_postjoin_aggr_table(st_join_table*, List<Item>*, st_order*, bool, bool, bool) /data/src/10.2/sql/sql_select.cc:2974
|
#10 0x55d6bb817935 in JOIN::make_aggr_tables_info() /data/src/10.2/sql/sql_select.cc:2579
|
#11 0x55d6bb81389d in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:2250
|
#12 0x55d6bb8080dd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1118
|
#13 0x55d6bb8237e4 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.2/sql/sql_select.cc:3826
|
#14 0x55d6bb8003f7 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.2/sql/sql_select.cc:361
|
#15 0x55d6bb7770d8 in execute_sqlcom_select /data/src/10.2/sql/sql_parse.cc:6274
|
#16 0x55d6bb764477 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:3585
|
#17 0x55d6bb6d2427 in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/10.2/sql/sql_cursor.cc:141
|
#18 0x55d6bb5c8b61 in sp_cursor::open(THD*) /data/src/10.2/sql/sp_rcontext.cc:464
|
#19 0x55d6bb5b655d in sp_instr_copen::exec_core(THD*, unsigned int*) /data/src/10.2/sql/sp_head.cc:3929
|
#20 0x55d6bb5b0f5c in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /data/src/10.2/sql/sp_head.cc:3095
|
#21 0x55d6bb5b62e6 in sp_instr_copen::execute(THD*, unsigned int*) /data/src/10.2/sql/sp_head.cc:3914
|
#22 0x55d6bb5a6003 in sp_head::execute(THD*, bool) /data/src/10.2/sql/sp_head.cc:1326
|
#23 0x55d6bb5aa7ce in sp_head::execute_procedure(THD*, List<Item>*) /data/src/10.2/sql/sp_head.cc:2202
|
#24 0x55d6bb7600f1 in do_execute_sp /data/src/10.2/sql/sql_parse.cc:2981
|
#25 0x55d6bb7723b5 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:5625
|
#26 0x55d6bb780669 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7794
|
#27 0x55d6bb75974b in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
|
#28 0x55d6bb75650a in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
|
#29 0x55d6bbade8c5 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
|
|
Thread T27 created by T0 here:
|
#0 0x7fb8c5e9b805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
|
#1 0x55d6bce8015e in spawn_thread_v1 /data/src/10.2/storage/perfschema/pfs.cc:1919
|
#2 0x55d6bb4fb203 in inline_mysql_thread_create /data/src/10.2/include/mysql/psi/mysql_thread.h:1246
|
#3 0x55d6bb5130ce in create_thread_to_handle_connection(CONNECT*) /data/src/10.2/sql/mysqld.cc:6573
|
#4 0x55d6bb513869 in create_new_thread /data/src/10.2/sql/mysqld.cc:6643
|
#5 0x55d6bb5149fb in handle_connections_sockets() /data/src/10.2/sql/mysqld.cc:6901
|
#6 0x55d6bb51241f in mysqld_main(int, char**) /data/src/10.2/sql/mysqld.cc:6192
|
#7 0x55d6bb4f9abc in main /data/src/10.2/sql/main.cc:25
|
#8 0x7fb8c54840b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
|
|
SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.2/sql/sql_select.cc:16274 in create_tmp_field_from_field(THD*, Field*, char const*, TABLE*, Item_field*)
|
Shadow bytes around the buggy address:
|
0x0c3280638940: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
|
0x0c3280638950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0c3280638960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0c3280638970: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c3280638980: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
=>0x0c3280638990: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd
|
0x0c32806389a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c32806389b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c32806389c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c32806389d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c32806389e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
Shadow byte legend (one shadow byte represents 8 application bytes):
|
Addressable: 00
|
Partially addressable: 01 02 03 04 05 06 07
|
Heap left redzone: fa
|
Freed heap region: fd
|
Stack left redzone: f1
|
Stack mid redzone: f2
|
Stack right redzone: f3
|
Stack after return: f5
|
Stack use after scope: f8
|
Global redzone: f9
|
Global init order: f6
|
Poisoned by user: f7
|
Container overflow: fc
|
Array cookie: ac
|
Intra object redzone: bb
|
ASan internal: fe
|
Left alloca redzone: ca
|
Right alloca redzone: cb
|
Shadow gap: cc
|
==2554381==ABORTING
|
210406 2:27:50 [ERROR] mysqld got signal 6 ;
|
This could be because you hit a bug. It is also possible that this binary
|
or one of the libraries it was linked against is corrupt, improperly built,
|
or misconfigured. This error can also be caused by malfunctioning hardware.
|
|
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
|
|
We will try our best to scrape up some info that will hopefully help
|
diagnose the problem, but since we have already crashed,
|
something is definitely wrong and this may fail.
|
|
Server version: 10.2.38-MariaDB-debug-log
|
key_buffer_size=1048576
|
read_buffer_size=131072
|
max_used_connections=1
|
max_threads=153
|
thread_count=6
|
It is possible that mysqld could use up to
|
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63104 K bytes of memory
|
Hope that's ok; if not, decrease some variables in the equation.
|
|
Thread pointer: 0x62a0000ba270
|
Attempting backtrace. You can use the following information to find out
|
where mysqld died. If you see no messages after this, something went
|
terribly wrong...
|
stack_bottom = 0x7fb8aee06d90 thread_stack 0x5b000
|
/lib/x86_64-linux-gnu/libasan.so.5(+0x6cd30)[0x7fb8c5ecdd30]
|
/mnt-hd8t/bld/10.2-asan-nightly/bin/mysqld(my_print_stacktrace+0xe4)[0x55d6bcf7a25b]
|
mysys/stacktrace.c:172(my_print_stacktrace)[0x55d6bbd9c025]
|
sigaction.c:0(__restore_rt)[0x7fb8c59af3c0]
|
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fb8c54a318b]
|
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fb8c5482859]
|
/lib/x86_64-linux-gnu/libasan.so.5(+0x12b6a2)[0x7fb8c5f8c6a2]
|
/lib/x86_64-linux-gnu/libasan.so.5(+0x13624c)[0x7fb8c5f9724c]
|
/lib/x86_64-linux-gnu/libasan.so.5(+0x1178ec)[0x7fb8c5f788ec]
|
/lib/x86_64-linux-gnu/libasan.so.5(+0x117363)[0x7fb8c5f78363]
|
/lib/x86_64-linux-gnu/libasan.so.5(__asan_report_load8+0x3b)[0x7fb8c5f791ab]
|
sql/sql_select.cc:16274(create_tmp_field_from_field(THD*, Field*, char const*, TABLE*, Item_field*))[0x55d6bb8760fa]
|
sql/sql_select.cc:16529(create_tmp_field(THD*, TABLE*, Item*, Item::Type, Item***, Field**, Field**, bool, bool, bool, bool))[0x55d6bb877ccc]
|
sql/sql_select.cc:16977(create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, char const*, bool, bool))[0x55d6bb87b13f]
|
sql/sql_union.cc:180(select_union::create_result_table(THD*, List<Item>*, bool, unsigned long long, char const*, bool, bool, bool))[0x55d6bb9d344a]
|
sql/sql_cursor.cc:436(Select_materialize::send_result_set_metadata(List<Item>&, unsigned int))[0x55d6bb6d49e2]
|
sql/sql_select.cc:12918(return_zero_rows(JOIN*, select_result*, List<TABLE_LIST>&, List<Item>&, bool, unsigned long long, char const*, Item*, List<Item>&))[0x55d6bb863bb1]
|
sql/sql_select.cc:3573(JOIN::exec_inner())[0x55d6bb821c7a]
|
sql/sql_select.cc:3438(JOIN::exec())[0x55d6bb82014e]
|
sql/sql_select.cc:3842(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55d6bb8239d1]
|
sql/sql_select.cc:361(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55d6bb8003f8]
|
sql/sql_parse.cc:6274(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55d6bb7770d9]
|
sql/sql_parse.cc:3585(mysql_execute_command(THD*))[0x55d6bb764478]
|
sql/sql_cursor.cc:141(mysql_open_cursor(THD*, select_result*, Server_side_cursor**))[0x55d6bb6d2428]
|
sql/sp_rcontext.cc:464(sp_cursor::open(THD*))[0x55d6bb5c8b62]
|
sql/sp_head.cc:3929(sp_instr_copen::exec_core(THD*, unsigned int*))[0x55d6bb5b655e]
|
sql/sp_head.cc:3095(sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*))[0x55d6bb5b0f5d]
|
sql/sp_head.cc:3914(sp_instr_copen::execute(THD*, unsigned int*))[0x55d6bb5b62e7]
|
sql/sp_head.cc:1326(sp_head::execute(THD*, bool))[0x55d6bb5a6004]
|
sql/sp_head.cc:2202(sp_head::execute_procedure(THD*, List<Item>*))[0x55d6bb5aa7cf]
|
sql/sql_parse.cc:2981(do_execute_sp(THD*, sp_head*))[0x55d6bb7600f2]
|
sql/sql_parse.cc:5625(mysql_execute_command(THD*))[0x55d6bb7723b6]
|
sql/sql_parse.cc:7794(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55d6bb78066a]
|
sql/sql_parse.cc:1830(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55d6bb75974c]
|
sql/sql_parse.cc:1381(do_command(THD*))[0x55d6bb75650b]
|
sql/sql_connect.cc:1336(do_handle_one_connection(CONNECT*))[0x55d6bbade8c6]
|
sql/sql_connect.cc:1242(handle_one_connection)[0x55d6bbade189]
|
perfschema/pfs.cc:1871(pfs_spawn_thread)[0x55d6bce7fd6e]
|
nptl/pthread_create.c:478(start_thread)[0x7fb8c59a3609]
|
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7fb8c557f293]
|
|
Trying to get some variables.
|
Some pointers may be invalid and cause the dump to abort.
|
Query (0x62b000000290): call pr()
|
|
Connection ID (thread ID): 9
|
Status: NOT_KILLED
|
|
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=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
|
|
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
|
information that should help you find out what is causing the crash.
|
Writing a core file...
|
Working directory at /dev/shm/var_auto_lJQZ/mysqld.1/data
|
Resource Limits:
|
Limit Soft Limit Hard Limit Units
|
Max cpu time unlimited unlimited seconds
|
Max file size unlimited unlimited bytes
|
Max data size unlimited unlimited bytes
|
Max stack size 8388608 unlimited bytes
|
Max core file size unlimited unlimited bytes
|
Max resident set unlimited unlimited bytes
|
Max processes 385874 385874 processes
|
Max open files 1024 1024 files
|
Max locked memory 67108864 67108864 bytes
|
Max address space unlimited unlimited bytes
|
Max file locks unlimited unlimited locks
|
Max pending signals 385874 385874 signals
|
Max msgqueue size 819200 819200 bytes
|
Max nice priority 0 0
|
Max realtime priority 0 0
|
Max realtime timeout unlimited unlimited us
|
Core pattern: |/usr/share/apport/apport %p %s %c %d %P %E
|
|
10.5.6 release on CentOS 8
|
stack_bottom = 0x7f0020325bd8 thread_stack 0x49000
|
??:0(my_print_stacktrace)[0x559fec17dece]
|
??:0(handle_fatal_signal)[0x559febc08ec5]
|
sigaction.c:0(__restore_rt)[0x7f002a667b20]
|
??:0(Create_tmp_table::finalize(THD*, TABLE*, TMP_TABLE_PARAM*, bool, bool))[0x559feba5b958]
|
??:0(create_tmp_table(THD*, TMP_TABLE_PARAM*, List<Item>&, st_order*, bool, bool, unsigned long long, unsigned long long, st_mysql_const_lex_string const*, bool, bool))[0x559feba5c60d]
|
??:0(select_unit::create_result_table(THD*, List<Item>*, bool, unsigned long long, st_mysql_const_lex_string const*, bool, bool, bool, unsigned int))[0x559febabd78b]
|
??:0(Select_materialize::send_result_set_metadata(List<Item>&, unsigned int))[0x559feb9d43c3]
|
??:0(JOIN::exec_inner())[0x559feba76eca]
|
??:0(JOIN::exec())[0x559feba77c17]
|
??:0(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x559feba75f02]
|
??:0(handle_select(THD*, LEX*, select_result*, unsigned long))[0x559feba767eb]
|
??:0(LEX::mark_first_table_as_inserting())[0x559feba14eed]
|
??:0(mysql_execute_command(THD*))[0x559feba1cfbe]
|
??:0(mysql_open_cursor(THD*, select_result*, Server_side_cursor**))[0x559feb9d46bc]
|
??:0(sp_cursor::open(THD*))[0x559feb98ac5e]
|
??:0(sp_instr_copen::exec_core(THD*, unsigned int*))[0x559feb97ce67]
|
??:0(sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*))[0x559feb984009]
|
??:0(sp_lex_keeper::cursor_reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*))[0x559feb98438f]
|
??:0(sp_head::execute(THD*, bool))[0x559feb97fd6f]
|
??:0(sp_head::execute_procedure(THD*, List<Item>*))[0x559feb98113a]
|
??:0(LEX::mark_first_table_as_inserting())[0x559feba14cf1]
|
??:0(Sql_cmd_call::execute(THD*))[0x559feba176dc]
|
??:0(mysql_execute_command(THD*))[0x559feba1cfed]
|
??:0(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x559feba0fc62]
|
??:0(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x559feba1a0fe]
|
??:0(do_command(THD*))[0x559feba1b24f]
|
??:0(do_handle_one_connection(CONNECT*, bool))[0x559febb0abf1]
|
??:0(handle_one_connection)[0x559febb0af7d]
|
??:0(MyCTX_nopad::finish(unsigned char*, unsigned int*))[0x559febe27d5a]
|
pthread_create.c:0(start_thread)[0x7f002a65d14a]
|
:0(__GI___clone)[0x7f00284caf23]
|
Both are reproducible on all of 10.2-10.6.
Many thanks to gsmethells for all the feedback and thorough analysis.
|