[MDEV-23204] Server crash in ha_partition::handle_unordered_scan_next_partition or Assertion `bit < (map)->n_bits' Created: 2020-07-17  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Optimizer, Partitioning
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-26334 Assertion map->bitmap, prebuilt->magi... Confirmed

 Description   

The test case is seemingly deterministic, but the variety of stack traces on different builds suggests there may be some randomness in it. I don't know if --repeat will help if it doesn't fail for you right away, since it fails for me. At least please pay attention to the versions, build types and revisions specified in the description, as it's not always obvious. For example, a debug assertion failure only happens on a debug ASAN build, while a non-ASAN debug build fails with SIGSEGV; etc.

--source include/have_partition.inc
 
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (NULL),(NULL);
 
CREATE TABLE t2 (a int, b char(8), key(a)) PARTITION BY HASH(a) PARTITIONS 2;
INSERT INTO t2 VALUES (1,'foo'),(2,'bar');
 
SET JOIN_CACHE_LEVEL= 5, OPTIMIZER_SWITCH= 'mrr=on';
 
SELECT 1 FROM t1 LEFT JOIN t2 USING (a);
 
# Cleanup
DROP TABLE t1, t2;

10.3 73aa31fb debug non-ASAN

#3  <signal handler called>
#4  0x0000562cb852b960 in ha_partition::handle_unordered_scan_next_partition (this=0x7efc1c076a28, buf=0x7efc1c072428 "\377") at /data/src/10.3/sql/ha_partition.cc:7401
#5  0x0000562cb8528e65 in ha_partition::multi_range_read_next (this=0x7efc1c076a28, range_info=0x7efc1c018540) at /data/src/10.3/sql/ha_partition.cc:6527
#6  0x0000562cb7b93201 in JOIN_TAB_SCAN_MRR::next (this=0x7efc1c018548) at /data/src/10.3/sql/sql_join_cache.cc:3916
#7  0x0000562cb7b90a7d in JOIN_CACHE::join_matching_records (this=0x7efc1c018410, skip_last=false) at /data/src/10.3/sql/sql_join_cache.cc:2261
#8  0x0000562cb7b90534 in JOIN_CACHE::join_records (this=0x7efc1c018410, skip_last=false) at /data/src/10.3/sql/sql_join_cache.cc:2088
#9  0x0000562cb7a4ef17 in sub_select_cache (join=0x7efc1c013f40, join_tab=0x7efc1c016d90, end_of_records=true) at /data/src/10.3/sql/sql_select.cc:19511
#10 0x0000562cb7a4f12c in sub_select (join=0x7efc1c013f40, join_tab=0x7efc1c016a00, end_of_records=true) at /data/src/10.3/sql/sql_select.cc:19682
#11 0x0000562cb7a4e8a3 in do_select (join=0x7efc1c013f40, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19273
#12 0x0000562cb7a2560f in JOIN::exec_inner (this=0x7efc1c013f40) at /data/src/10.3/sql/sql_select.cc:4116
#13 0x0000562cb7a249e2 in JOIN::exec (this=0x7efc1c013f40) at /data/src/10.3/sql/sql_select.cc:3910
#14 0x0000562cb7a25cf3 in mysql_select (thd=0x7efc1c000af0, tables=0x7efc1c0129b8, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7efc1c013f18, unit=0x7efc1c0049b8, select_lex=0x7efc1c005140) at /data/src/10.3/sql/sql_select.cc:4315
#15 0x0000562cb7a172ca in handle_select (thd=0x7efc1c000af0, lex=0x7efc1c0048f8, result=0x7efc1c013f18, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
#16 0x0000562cb79debb2 in execute_sqlcom_select (thd=0x7efc1c000af0, all_tables=0x7efc1c0129b8) at /data/src/10.3/sql/sql_parse.cc:6286
#17 0x0000562cb79d5305 in mysql_execute_command (thd=0x7efc1c000af0) at /data/src/10.3/sql/sql_parse.cc:3812
#18 0x0000562cb79e2ebd in mysql_parse (thd=0x7efc1c000af0, rawbuf=0x7efc1c012818 "SELECT 1 FROM t1 LEFT JOIN t2 USING (a)", length=39, parser_state=0x7efc381d05e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7810
#19 0x0000562cb79cf704 in dispatch_command (command=COM_QUERY, thd=0x7efc1c000af0, packet=0x7efc1c1234d1 "", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1848
#20 0x0000562cb79ce01c in do_command (thd=0x7efc1c000af0) at /data/src/10.3/sql/sql_parse.cc:1393
#21 0x0000562cb7b475f1 in do_handle_one_connection (connect=0x562cbb8cf540) at /data/src/10.3/sql/sql_connect.cc:1403
#22 0x0000562cb7b47353 in handle_one_connection (arg=0x562cbb8cf540) at /data/src/10.3/sql/sql_connect.cc:1308
#23 0x0000562cb84fe7cc in pfs_spawn_thread (arg=0x562cbb8ea5f0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#24 0x00007efc3efb44a4 in start_thread (arg=0x7efc381d1700) at pthread_create.c:456
#25 0x00007efc3d0e8d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.3 73aa31fb debug ASAN

mysqld: /data/src/10.3/include/my_bitmap.h:133: uint bitmap_is_set(const MY_BITMAP*, uint): Assertion `bit < (map)->n_bits' failed.
200717 20:14:36 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f8159470f12 in __GI___assert_fail (assertion=0x55c59d854860 "bit < (map)->n_bits", file=0x55c59d8548a0 "/data/src/10.3/include/my_bitmap.h", line=133, function=0x55c59d860ae0 <_ZZ13bitmap_is_setE19__PRETTY_FUNCTION__> "uint bitmap_is_set(const MY_BITMAP*, uint)") at assert.c:101
#8  0x000055c59cd4f6ad in bitmap_is_set (map=0x61d0001a7e40, bit=4294967295) at /data/src/10.3/include/my_bitmap.h:133
#9  0x000055c59cd8498e in ha_partition::handle_pre_scan (this=0x61d0001aa510, reverse_order=false, use_parallel=true) at /data/src/10.3/sql/ha_partition.cc:7226
#10 0x000055c59cd867d9 in ha_partition::handle_ordered_index_scan (this=0x61d0001aa510, buf=0x619000092f40 "\377", reverse_order=false) at /data/src/10.3/sql/ha_partition.cc:7495
#11 0x000055c59cd7df43 in ha_partition::multi_range_read_next (this=0x61d0001aa510, range_info=0x6290000e63c0) at /data/src/10.3/sql/ha_partition.cc:6512
#12 0x000055c59b933c03 in JOIN_TAB_SCAN_MRR::next (this=0x62b000006218) at /data/src/10.3/sql/sql_join_cache.cc:3916
#13 0x000055c59b92c9bc in JOIN_CACHE::join_matching_records (this=0x6290000e6290, skip_last=false) at /data/src/10.3/sql/sql_join_cache.cc:2261
#14 0x000055c59b92b89a in JOIN_CACHE::join_records (this=0x6290000e6290, skip_last=false) at /data/src/10.3/sql/sql_join_cache.cc:2088
#15 0x000055c59b650032 in sub_select_cache (join=0x62b000001aa8, join_tab=0x62b000004ac8, end_of_records=true) at /data/src/10.3/sql/sql_select.cc:19511
#16 0x000055c59b650525 in sub_select (join=0x62b000001aa8, join_tab=0x62b000004738, end_of_records=true) at /data/src/10.3/sql/sql_select.cc:19682
#17 0x000055c59b64f1ac in do_select (join=0x62b000001aa8, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19273
#18 0x000055c59b5ea4db in JOIN::exec_inner (this=0x62b000001aa8) at /data/src/10.3/sql/sql_select.cc:4116
#19 0x000055c59b5e8112 in JOIN::exec (this=0x62b000001aa8) at /data/src/10.3/sql/sql_select.cc:3910
#20 0x000055c59b5eb5ed in mysql_select (thd=0x62a000048270, tables=0x62b000000478, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000001a78, unit=0x62a00004c138, select_lex=0x62a00004c8c0) at /data/src/10.3/sql/sql_select.cc:4315
#21 0x000055c59b5c54f4 in handle_select (thd=0x62a000048270, lex=0x62a00004c078, result=0x62b000001a78, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
#22 0x000055c59b546fa2 in execute_sqlcom_select (thd=0x62a000048270, all_tables=0x62b000000478) at /data/src/10.3/sql/sql_parse.cc:6286
#23 0x000055c59b53650e in mysql_execute_command (thd=0x62a000048270) at /data/src/10.3/sql/sql_parse.cc:3812
#24 0x000055c59b54ffef in mysql_parse (thd=0x62a000048270, rawbuf=0x62b000000290 "SELECT 1 FROM t1 LEFT JOIN t2 USING (a)", length=39, parser_state=0x7f814f5a5a00, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7810
#25 0x000055c59b52a9b1 in dispatch_command (command=COM_QUERY, thd=0x62a000048270, packet=0x6290000c8271 "", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1848
#26 0x000055c59b52785d in do_command (thd=0x62a000048270) at /data/src/10.3/sql/sql_parse.cc:1393
#27 0x000055c59b8a27d0 in do_handle_one_connection (connect=0x611000005470) at /data/src/10.3/sql/sql_connect.cc:1403
#28 0x000055c59b8a2197 in handle_one_connection (arg=0x611000005470) at /data/src/10.3/sql/sql_connect.cc:1308
#29 0x000055c59cd1a746 in pfs_spawn_thread (arg=0x616000002af0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#30 0x00007f815b3f94a4 in start_thread (arg=0x7f814f5a7300) at pthread_create.c:456
#31 0x00007f815952dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.3 73aa31fb non-debug ASAN

==29916==ERROR: AddressSanitizer: SEGV on unknown address 0x61d020080737 (pc 0x563a3adb2065 bp 0x61d0000816a8 sp 0x7f327d546860 T5)
    #0 0x563a3adb2064 in ha_partition::handle_pre_scan(bool, bool) /data/src/10.3/sql/ha_partition.cc:7226
    #1 0x563a3adb3c26 in ha_partition::handle_ordered_index_scan(unsigned char*, bool) /data/src/10.3/sql/ha_partition.cc:7495
    #2 0x563a3adb65d7 in ha_partition::multi_range_read_next(void**) /data/src/10.3/sql/ha_partition.cc:6512
    #3 0x563a39e32d96 in JOIN_TAB_SCAN_MRR::next() /data/src/10.3/sql/sql_join_cache.cc:3916
    #4 0x563a39e3e587 in JOIN_CACHE::join_matching_records(bool) /data/src/10.3/sql/sql_join_cache.cc:2261
    #5 0x563a39e3d022 in JOIN_CACHE::join_records(bool) /data/src/10.3/sql/sql_join_cache.cc:2088
    #6 0x563a39bf5635 in sub_select_cache(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:19511
    #7 0x563a39c5db93 in do_select /data/src/10.3/sql/sql_select.cc:19273
    #8 0x563a39c5db93 in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:4116
    #9 0x563a39c5e2dd in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3910
    #10 0x563a39c581ee 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.3/sql/sql_select.cc:4315
    #11 0x563a39c5a5ea in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:370
    #12 0x563a398f7f9f in execute_sqlcom_select /data/src/10.3/sql/sql_parse.cc:6286
    #13 0x563a39b6552c in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:3812
    #14 0x563a39b773a8 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7810
    #15 0x563a39b7b5aa in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1848
    #16 0x563a39b7f44c in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1393
    #17 0x563a39dd960f in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
    #18 0x563a39dd9a3a in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
    #19 0x563a3ad5b4f3 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1869
    #20 0x7f328927f4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
    #21 0x7f32873b3d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
 
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /data/src/10.3/sql/ha_partition.cc:7226 in ha_partition::handle_pre_scan(bool, bool)
Thread T5 created by T0 here:
    #0 0x7f32894c5f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
    #1 0x563a3ad63772 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1919
 
==29916==ABORTING

10.3 release non-ASAN build doesn't crash for me.

10.4/10.5 debug non-ASAN build crashes the same way as 10.3 debug non-ASAN.
10.4/10.5 debug ASAN build fails with the same assertion failure as 10.3 debug ASAN.
10.4 non-debug ASAN fails the same way as 10.3 non-debug ASAN.
*10.4 and 10.5 release non-ASAN crashes like 10.3 debug non-ASAN, even though 10.3 release non-ASAN doesn't.
10.5 release ASAN crash has an extra frame comparing to 10.3/10.4:

10.5 054f1036 non-debug ASAN

==3078==ERROR: AddressSanitizer: SEGV on unknown address 0x61d0200a060f (pc 0x55d6beb737b6 bp 0x7f795a88e1a0 sp 0x7f795a88e150 T5)
    #0 0x55d6beb737b5 in bitmap_is_set /data/src/10.5/include/my_bitmap.h:119
    #1 0x55d6beb737b5 in ha_partition::handle_pre_scan(bool, bool) /data/src/10.5/sql/ha_partition.cc:7344
    #2 0x55d6beb7541e in ha_partition::handle_ordered_index_scan(unsigned char*, bool) /data/src/10.5/sql/ha_partition.cc:7613
    #3 0x55d6beb77d80 in ha_partition::multi_range_read_next(void**) /data/src/10.5/sql/ha_partition.cc:6636
    #4 0x55d6be29378e in JOIN_TAB_SCAN_MRR::next() /data/src/10.5/sql/sql_join_cache.cc:3924
    #5 0x55d6be29f293 in JOIN_CACHE::join_matching_records(bool) /data/src/10.5/sql/sql_join_cache.cc:2269
    #6 0x55d6be29ddd4 in JOIN_CACHE::join_records(bool) /data/src/10.5/sql/sql_join_cache.cc:2092
    #7 0x55d6be01c83e in sub_select_cache(JOIN*, st_join_table*, bool) /data/src/10.5/sql/sql_select.cc:20415
    #8 0x55d6be08d0f1 in do_select /data/src/10.5/sql/sql_select.cc:20177
    #9 0x55d6be08d0f1 in JOIN::exec_inner() /data/src/10.5/sql/sql_select.cc:4450
    #10 0x55d6be08e1a6 in JOIN::exec() /data/src/10.5/sql/sql_select.cc:4231
    #11 0x55d6be08765a 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:4655
    #12 0x55d6be089ba9 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.5/sql/sql_select.cc:429
    #13 0x55d6bdc7df85 in execute_sqlcom_select /data/src/10.5/sql/sql_parse.cc:6209
    #14 0x55d6bdf7a9aa in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:3931
    #15 0x55d6bdf8d956 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5/sql/sql_parse.cc:7993
    #16 0x55d6bdf711f0 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1867
    #17 0x55d6bdf6d175 in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1348
    #18 0x55d6be232ebf in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1411
    #19 0x55d6be233c07 in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1313
    #20 0x55d6beb8cf1b in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:2201
    #21 0x7f7964e2e4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
    #22 0x7f7962f62d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
 
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /data/src/10.5/include/my_bitmap.h:119 in bitmap_is_set
Thread T5 created by T0 here:
    #0 0x7f7965074f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
    #1 0x55d6beb8d1bb in my_thread_create /data/src/10.5/storage/perfschema/my_thread.h:34
    #2 0x55d6beb8d1bb in pfs_spawn_thread_v1 /data/src/10.5/storage/perfschema/pfs.cc:2252
    #3 0x55d6bdd644c0 in inline_mysql_thread_create /data/src/10.5/include/mysql/psi/mysql_thread.h:1321
    #4 0x55d6bdd644c0 in create_thread_to_handle_connection(CONNECT*) /data/src/10.5/sql/mysqld.cc:6018
    #5 0x55d6bdd6eadf in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.5/sql/mysqld.cc:6142
    #6 0x55d6bdd6f22c in handle_connections_sockets() /data/src/10.5/sql/mysqld.cc:6269
    #7 0x55d6bdd70e07 in mysqld_main(int, char**) /data/src/10.5/sql/mysqld.cc:5664
    #8 0x7f7962e9a2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
 
==3078==ABORTING
200717 20:20:55 [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.5-MariaDB-log
key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=2
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63578 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x62b000062218
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 = 0x7f795a8908d0 thread_stack 0x5fc00
??:0(backtrace)[0x7f7965091681]
/data/bld/10.5-rel-asan-nightly/bin/mariadbd(my_print_stacktrace+0xcc)[0x55d6bf4ba98c]
/data/bld/10.5-rel-asan-nightly/bin/mariadbd(handle_fatal_signal+0x7de)[0x55d6be4edfee]
??:0(__restore_rt)[0x7f7964e380e0]
linux/raise.c:51(__GI_raise)[0x7f7962eacfff]
stdlib/abort.c:91(__GI_abort)[0x7f7962eae42a]
??:0(__sanitizer_cov_trace_switch)[0x7f796511f329]
??:0(__asan_print_accumulated_stats)[0x7f79651149ab]
??:0(__asan_unpoison_intra_object_redzone)[0x7f796510bad3]
??:0(__asan_unpoison_intra_object_redzone)[0x7f796510974b]
??:0(__restore_rt)[0x7f7964e380e0]
/data/bld/10.5-rel-asan-nightly/bin/mariadbd(+0x17a37b6)[0x55d6beb737b6]
include/my_bitmap.h:119(bitmap_is_set)[0x55d6beb7541f]
sql/ha_partition.cc:7613(ha_partition::handle_ordered_index_scan(unsigned char*, bool))[0x55d6beb77d81]
sql/ha_partition.cc:6636(ha_partition::multi_range_read_next(void**))[0x55d6be29378f]
sql/sql_join_cache.cc:3924(JOIN_TAB_SCAN_MRR::next())[0x55d6be29f294]
sql/sql_join_cache.cc:2269(JOIN_CACHE::join_matching_records(bool))[0x55d6be29ddd5]
sql/sql_join_cache.cc:2092(JOIN_CACHE::join_records(bool))[0x55d6be01c83f]
sql/sql_select.cc:20416(sub_select_cache(JOIN*, st_join_table*, bool))[0x55d6be08d0f2]
sql/sql_select.cc:20177(do_select)[0x55d6be08e1a7]
sql/sql_select.cc:4232(JOIN::exec())[0x55d6be08765b]
sql/sql_select.cc:4657(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*))[0x55d6be089baa]
sql/sql_select.cc:429(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55d6bdc7df86]
sql/sql_parse.cc:6209(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55d6bdf7a9ab]
sql/sql_parse.cc:3931(mysql_execute_command(THD*))[0x55d6bdf8d957]
sql/sql_parse.cc:8010(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55d6bdf711f1]
sql/sql_parse.cc:1869(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55d6bdf6d176]
sql/sql_parse.cc:1348(do_command(THD*))[0x55d6be232ec0]
sql/sql_connect.cc:1411(do_handle_one_connection(CONNECT*, bool))[0x55d6be233c08]
sql/sql_connect.cc:1317(handle_one_connection)[0x55d6beb8cf1c]
nptl/pthread_create.c:456(start_thread)[0x7f7964e2e4a4]
x86_64/clone.S:99(clone)[0x7f7962f62d0f]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x62b00005b238): SELECT 1 FROM t1 LEFT JOIN t2 USING (a)
Connection ID (thread ID): 4
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=on,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 /dev/shm/var_bits/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        0                    0                    bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             128123               128123               processes 
Max open files            1024                 1024                 files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       128123               128123               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: core

Fails with at least InnoDB and MyISAM, although I didn't compare the exact stack traces between different engines.



 Comments   
Comment by Elena Stepanova [ 2020-08-11 ]

Slightly different test case with a different stack trace. Modifying it, e.g. reducing the number of rows in a certain way or removing UPDATE, brings the failure back to initially reported.

--source include/have_partition.inc
 
CREATE TABLE t1 (pk integer, a int, primary key (pk)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,6),(2,8),(3,7),(4,3),(5,NULL);
 
CREATE TABLE t2 (pk integer, a int, key (a), primary key (pk)) ENGINE=MyISAM PARTITION BY key (pk) partitions 2;
INSERT INTO t2 VALUES (1,0),(2,10),(3,20),(4,8),(5,15),(6,1),(7,3),(8,9);
UPDATE t2 SET a = 9 WHERE a = 3;
 
SET optimizer_switch= 'mrr=on', join_cache_level= 5;
 
SELECT * FROM t1 LEFT JOIN t2 USING (a) WHERE t1.pk IN (0, 20, 15, 5);
 
# Cleanup
DROP TABLE t1, t2;

10.5 1c587481

#3  <signal handler called>
#4  0x000055d9a9486801 in DsMrr_impl::dsmrr_next (this=0x7f1a9806bcc8, range_info=0x7f1a9806d8e8) at /data/src/10.5/sql/multi_range_read.cc:1653
#5  0x000055d9a9e8ea20 in ha_myisam::multi_range_read_next (this=0x7f1a9806b7c0, range_info=0x7f1a9806d8e8) at /data/src/10.5/storage/myisam/ha_myisam.cc:2572
#6  0x000055d9a9956ecc in ha_partition::handle_ordered_next (this=0x7f1a9806aed0, buf=0x7f1a9806a4b0 "\377", is_next_same=165) at /data/src/10.5/sql/ha_partition.cc:7978
#7  0x000055d9a9952b4e in ha_partition::multi_range_read_next (this=0x7f1a9806aed0, range_info=0x7f1a982101f0) at /data/src/10.5/sql/ha_partition.cc:6643
#8  0x000055d9a947d75f in JOIN_TAB_SCAN_MRR::next (this=0x7f1a982101f8) at /data/src/10.5/sql/sql_join_cache.cc:3924
#9  0x000055d9a947afea in JOIN_CACHE::join_matching_records (this=0x7f1a982100c0, skip_last=false) at /data/src/10.5/sql/sql_join_cache.cc:2269
#10 0x000055d9a947aa79 in JOIN_CACHE::join_records (this=0x7f1a982100c0, skip_last=false) at /data/src/10.5/sql/sql_join_cache.cc:2092
#11 0x000055d9a9307ce9 in sub_select_cache (join=0x7f1a980164d8, join_tab=0x7f1a9820ea68, end_of_records=true) at /data/src/10.5/sql/sql_select.cc:20398
#12 0x000055d9a9307ef4 in sub_select (join=0x7f1a980164d8, join_tab=0x7f1a9820e6c0, end_of_records=true) at /data/src/10.5/sql/sql_select.cc:20569
#13 0x000055d9a9307676 in do_select (join=0x7f1a980164d8, procedure=0x0) at /data/src/10.5/sql/sql_select.cc:20160
#14 0x000055d9a92db1cb in JOIN::exec_inner (this=0x7f1a980164d8) at /data/src/10.5/sql/sql_select.cc:4450
#15 0x000055d9a92da2f7 in JOIN::exec (this=0x7f1a980164d8) at /data/src/10.5/sql/sql_select.cc:4231
#16 0x000055d9a92dba28 in mysql_select (thd=0x7f1a98000b18, tables=0x7f1a98013fb8, fields=..., conds=0x7f1a980159b8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f1a980164b0, unit=0x7f1a98004b30, select_lex=0x7f1a980139c0) at /data/src/10.5/sql/sql_select.cc:4655
#17 0x000055d9a92cb6ce in handle_select (thd=0x7f1a98000b18, lex=0x7f1a98004a68, result=0x7f1a980164b0, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:429
#18 0x000055d9a9290a9e in execute_sqlcom_select (thd=0x7f1a98000b18, all_tables=0x7f1a98013fb8) at /data/src/10.5/sql/sql_parse.cc:6210
#19 0x000055d9a9287d45 in mysql_execute_command (thd=0x7f1a98000b18) at /data/src/10.5/sql/sql_parse.cc:3932
#20 0x000055d9a92958eb in mysql_parse (thd=0x7f1a98000b18, rawbuf=0x7f1a980138d0 "SELECT * FROM t1 LEFT JOIN t2 USING (a) WHERE t1.pk IN (0, 20, 15, 5)", length=69, parser_state=0x7f1aa9625520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7994
#21 0x000055d9a9281be4 in dispatch_command (command=COM_QUERY, thd=0x7f1a98000b18, packet=0x7f1a981a59e9 "", packet_length=69, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1868
#22 0x000055d9a928031c in do_command (thd=0x7f1a98000b18) at /data/src/10.5/sql/sql_parse.cc:1349
#23 0x000055d9a942616c in do_handle_one_connection (connect=0x55d9ac12a878, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1410
#24 0x000055d9a9425ed4 in handle_one_connection (arg=0x55d9ac12a878) at /data/src/10.5/sql/sql_connect.cc:1312
#25 0x000055d9a996674a in pfs_spawn_thread (arg=0x55d9ac12a4a8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#26 0x00007f1ab0a124a4 in start_thread (arg=0x7f1aa9626700) at pthread_create.c:456
#27 0x00007f1aaeb46d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.3-10.5, debug and non-debug, MyISAM and Aria.

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