[MDEV-16694] Memory leak with EXPLAIN UPDATE, crash in multi_update::initialize_tables Created: 2018-07-05  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 1
Labels: None

Issue Links:
Duplicate
duplicates MDEV-14575 [Draft] Server crashes in in multi_up... Closed
duplicates MDEV-24877 Memory not freed, Indirect leak, Asse... Closed
Relates
relates to MDEV-22732 AddressSanitizer: use-after-poison up... Confirmed

 Description   

CREATE TABLE t1 ( i2 int, v2 varchar(1)) ;
CREATE TABLE t2 ( i1 int, i2 int, v1 varchar(1)) ;
 
EXPLAIN
UPDATE t2 JOIN t1 ON (t2.v1 = t1.v2)
SET t2.i1 = 1, t1.i2 = 1
WHERE t2.i2 IN (SELECT 1 UNION SELECT 2);

In 10.0-10.2

mysqld: /home/alice/git/10.1/sql/sql_class.cc:1608: virtual THD::~THD(): Assertion `status_var.local_memory_used == 0' failed.
mysqld: /home/alice/git/10.2/sql/sql_class.cc:1550: virtual THD::~THD(): Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed.

Version: '10.3.9-MariaDB-debug-log'  socket: '/home/alice/git/10.3/mysql-test/var/tmp/mysqld.1.sock'  port: 16000  Source distribution
ASAN:SIGSEGV
=================================================================
==29499==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x5590f60b8a90 bp 0x7ffb07ec3e90 sp 0x7ffb07ec3c40 T5)
    #0 0x5590f60b8a8f in multi_update::initialize_tables(JOIN*) /home/alice/git/10.3/sql/sql_update.cc:2100
    #1 0x5590f5ef85ee in JOIN::optimize_stage2() /home/alice/git/10.3/sql/sql_select.cc:1952
    #2 0x5590f5ef7fa3 in JOIN::optimize_inner() /home/alice/git/10.3/sql/sql_select.cc:1907
    #3 0x5590f5ef3ea3 in JOIN::optimize() /home/alice/git/10.3/sql/sql_select.cc:1448
    #4 0x5590f5f0db32 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*) /home/alice/git/10.3/sql/sql_select.cc:4206
    #5 0x5590f60a4ce2 in st_select_lex_unit::exec() /home/alice/git/10.3/sql/sql_union.cc:1592
    #6 0x5590f5f9ca09 in mysql_explain_union(THD*, st_select_lex_unit*, select_result*) /home/alice/git/10.3/sql/sql_select.cc:25705
    #7 0x5590f5f9c550 in select_describe /home/alice/git/10.3/sql/sql_select.cc:25675
    #8 0x5590f5f4a3bf in return_zero_rows /home/alice/git/10.3/sql/sql_select.cc:13231
    #9 0x5590f5f0c37d in JOIN::exec_inner() /home/alice/git/10.3/sql/sql_select.cc:3956
    #10 0x5590f5f0a951 in JOIN::exec() /home/alice/git/10.3/sql/sql_select.cc:3815
    #11 0x5590f5f0dd23 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*) /home/alice/git/10.3/sql/sql_select.cc:4220
    #12 0x5590f60b575d in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /home/alice/git/10.3/sql/sql_update.cc:1761
    #13 0x5590f5e61cab in mysql_execute_command(THD*) /home/alice/git/10.3/sql/sql_parse.cc:4635
    #14 0x5590f5e779c7 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /home/alice/git/10.3/sql/sql_parse.cc:8073
    #15 0x5590f5e526ae in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /home/alice/git/10.3/sql/sql_parse.cc:1847
    #16 0x5590f5e4f846 in do_command(THD*) /home/alice/git/10.3/sql/sql_parse.cc:1392
    #17 0x5590f619eca1 in do_handle_one_connection(CONNECT*) /home/alice/git/10.3/sql/sql_connect.cc:1402
    #18 0x5590f619e67e in handle_one_connection /home/alice/git/10.3/sql/sql_connect.cc:1308
    #19 0x5590f74b61d4 in pfs_spawn_thread /home/alice/git/10.3/storage/perfschema/pfs.cc:1862
    #20 0x7ffb128216b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
    #21 0x7ffb11cb641c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)

also crashes on non-debug build:

210209 14:33:49 [ERROR] mysqld got signal 11 ;
Server version: 10.5.9-MariaDB
 
??:0(__restore_rt)[0x7fecb3b0a730]
sql/sql_update.cc:2296(multi_update::initialize_tables(JOIN*))[0x5592a77bdef4]
sql/sql_select.cc:2329(JOIN::optimize_stage2())[0x5592a7769810]
sql/sql_select.cc:2281(JOIN::optimize_inner())[0x5592a776d16b]
sql/sql_select.cc:1629(JOIN::optimize())[0x5592a776f023]
sql/sql_select.cc:4705(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*))[0x5592a776f0e7]
sql/sql_union.cc:2360(st_select_lex_unit::exec())[0x5592a77b87e5]
sql/sql_select.cc:27278(mysql_explain_union(THD*, st_select_lex_unit*, select_result*))[0x5592a776fda0]
sql/sql_select.cc:27245(select_describe(JOIN*, bool, bool, bool, char const*) [clone .constprop.511])[0x5592a776feb5]
sql/sql_select.cc:4428(JOIN::exec_inner())[0x5592a7770510]
sql/sql_select.cc:4247(JOIN::exec())[0x5592a7770d70]
sql/sql_select.cc:4721(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*))[0x5592a776f138]
sql/sql_class.h:4061(mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**))[0x5592a77c1179]
sql/sql_parse.cc:4530(mysql_execute_command(THD*))[0x5592a7719b91]
sql/sql_parse.cc:8079(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5592a770be52]
sql/sql_parse.cc:1892(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5592a7716ce2]
sql/sql_parse.cc:1370(do_command(THD*))[0x5592a7717b9f]
sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x5592a7800170]
sql/sql_connect.cc:1312(handle_one_connection)[0x5592a780054d]
perfschema/pfs.cc:2204(pfs_spawn_thread)[0x5592a7b2e1bb]
nptl/pthread_create.c:487(start_thread)[0x7fecb3afffa3]
x86_64/clone.S:97(clone)[0x7fecb31084cf]
 
Query (0x7fec5c011de0): EXPLAIN UPDATE t2 JOIN t1 ON (t2.v1 = t1.v2) SET t2.i1 = 1, t1.i2 = 1 WHERE t2.i2 IN (SELECT 1 UNION SELECT 2)



 Comments   
Comment by Elena Stepanova [ 2021-05-23 ]

Same test case, on non-debug ASAN build:

10.2 f70b11c8

 
=================================================================
==1973818==ERROR: LeakSanitizer: detected memory leaks
 
Indirect leak of 4832 byte(s) in 1 object(s) allocated from:
    #0 0x7fe52fb3cbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x563caa7c2096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x563caa7ad8eb in alloc_root /data/src/10.2/mysys/my_alloc.c:243
    #3 0x563caa7add1f in multi_alloc_root /data/src/10.2/mysys/my_alloc.c:312
    #4 0x563ca91ef19d 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:16812
    #5 0x563ca9367f3a in multi_update::initialize_tables(JOIN*) /data/src/10.2/sql/sql_update.cc:2097
    #6 0x563ca924ee07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #7 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #8 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #9 0x563ca925e81f 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:3835
    #10 0x563ca93749d2 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /data/src/10.2/sql/sql_update.cc:1643
    #11 0x563ca910fcc9 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4132
    #12 0x563ca9124a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #13 0x563ca912e4d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #14 0x563ca9132e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #15 0x563ca9433df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #16 0x563ca943453e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #17 0x563caa709738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #18 0x7fe52f4c2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
Indirect leak of 1152 byte(s) in 1 object(s) allocated from:
    #0 0x7fe52fb3cbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x563caa7c2096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x563caa7ad8eb in alloc_root /data/src/10.2/mysys/my_alloc.c:243
    #3 0x563ca9c5f733 in Sql_alloc::operator new(unsigned long, st_mem_root*) /data/src/10.2/sql/sql_list.h:45
    #4 0x563ca9c5f733 in heap_create_handler /data/src/10.2/storage/heap/ha_heap.cc:66
    #5 0x563ca96b6834 in get_new_handler(TABLE_SHARE*, st_mem_root*, handlerton*) /data/src/10.2/sql/handler.cc:299
    #6 0x563ca91f10b2 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:17115
    #7 0x563ca9367f3a in multi_update::initialize_tables(JOIN*) /data/src/10.2/sql/sql_update.cc:2097
    #8 0x563ca924ee07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #9 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #10 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #11 0x563ca925e81f 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:3835
    #12 0x563ca93749d2 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /data/src/10.2/sql/sql_update.cc:1643
    #13 0x563ca910fcc9 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4132
    #14 0x563ca9124a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #15 0x563ca912e4d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #16 0x563ca9132e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #17 0x563ca9433df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #18 0x563ca943453e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #19 0x563caa709738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #20 0x7fe52f4c2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
Indirect leak of 992 byte(s) in 1 object(s) allocated from:
    #0 0x7fe52fb3cbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x563caa7c2096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x563caa7ad8eb in alloc_root /data/src/10.2/mysys/my_alloc.c:243
    #3 0x563caa7ae759 in memdup_root /data/src/10.2/mysys/my_alloc.c:464
    #4 0x563ca9656111 in Field::make_new_field(st_mem_root*, TABLE*, bool) /data/src/10.2/sql/field.cc:2387
    #5 0x563ca91d8ecf in create_tmp_field_from_field(THD*, Field*, char const*, TABLE*, Item_field*) /data/src/10.2/sql/sql_select.cc:16284
    #6 0x563ca91da1a8 in create_tmp_field(THD*, TABLE*, Item*, Item::Type, Item***, Field**, Field**, bool, bool, bool, bool) /data/src/10.2/sql/sql_select.cc:16540
    #7 0x563ca91f01ed 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:16988
    #8 0x563ca9367f3a in multi_update::initialize_tables(JOIN*) /data/src/10.2/sql/sql_update.cc:2097
    #9 0x563ca924ee07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #10 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #11 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #12 0x563ca925e81f 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:3835
    #13 0x563ca93749d2 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /data/src/10.2/sql/sql_update.cc:1643
    #14 0x563ca910fcc9 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4132
    #15 0x563ca9124a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #16 0x563ca912e4d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #17 0x563ca9132e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #18 0x563ca9433df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #19 0x563ca943453e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #20 0x563caa709738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #21 0x7fe52f4c2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
Indirect leak of 744 byte(s) in 1 object(s) allocated from:
    #0 0x7fe52fb3cbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x563caa7c2096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x563ca9c6c10e in heap_open_from_share /data/src/10.2/storage/heap/hp_open.c:33
    #3 0x563ca9c62b77 in ha_heap::open(char const*, int, unsigned int) /data/src/10.2/storage/heap/ha_heap.cc:112
    #4 0x563ca96bd665 in handler::ha_open(TABLE*, char const*, int, unsigned int) /data/src/10.2/sql/handler.cc:2592
    #5 0x563ca91dbe9e in open_tmp_table(TABLE*) /data/src/10.2/sql/sql_select.cc:17657
    #6 0x563ca91f3f34 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:17525
    #7 0x563ca9367f3a in multi_update::initialize_tables(JOIN*) /data/src/10.2/sql/sql_update.cc:2097
    #8 0x563ca924ee07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #9 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #10 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #11 0x563ca925e81f 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:3835
    #12 0x563ca93749d2 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /data/src/10.2/sql/sql_update.cc:1643
    #13 0x563ca910fcc9 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4132
    #14 0x563ca9124a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #15 0x563ca912e4d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #16 0x563ca9132e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #17 0x563ca9433df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #18 0x563ca943453e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #19 0x563caa709738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #20 0x7fe52f4c2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
Indirect leak of 616 byte(s) in 1 object(s) allocated from:
    #0 0x7fe52fb3cbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x563caa7c2096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x563ca9c742a0 in heap_create /data/src/10.2/storage/heap/hp_create.c:162
    #3 0x563ca9c62a6d in ha_heap::open(char const*, int, unsigned int) /data/src/10.2/storage/heap/ha_heap.cc:105
    #4 0x563ca96bd665 in handler::ha_open(TABLE*, char const*, int, unsigned int) /data/src/10.2/sql/handler.cc:2592
    #5 0x563ca91dbe9e in open_tmp_table(TABLE*) /data/src/10.2/sql/sql_select.cc:17657
    #6 0x563ca91f3f34 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:17525
    #7 0x563ca9367f3a in multi_update::initialize_tables(JOIN*) /data/src/10.2/sql/sql_update.cc:2097
    #8 0x563ca924ee07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #9 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #10 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #11 0x563ca925e81f 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:3835
    #12 0x563ca93749d2 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /data/src/10.2/sql/sql_update.cc:1643
    #13 0x563ca910fcc9 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4132
    #14 0x563ca9124a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #15 0x563ca912e4d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #16 0x563ca9132e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #17 0x563ca9433df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #18 0x563ca943453e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #19 0x563caa709738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #20 0x7fe52f4c2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
Indirect leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7fe52fb3cbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x563caa7c2096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x563caa7c24bb in my_strdup /data/src/10.2/mysys/my_malloc.c:241
    #3 0x563ca9c74c85 in heap_create /data/src/10.2/storage/heap/hp_create.c:225
    #4 0x563ca9c62a6d in ha_heap::open(char const*, int, unsigned int) /data/src/10.2/storage/heap/ha_heap.cc:105
    #5 0x563ca96bd665 in handler::ha_open(TABLE*, char const*, int, unsigned int) /data/src/10.2/sql/handler.cc:2592
    #6 0x563ca91dbe9e in open_tmp_table(TABLE*) /data/src/10.2/sql/sql_select.cc:17657
    #7 0x563ca91f3f34 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:17525
    #8 0x563ca9367f3a in multi_update::initialize_tables(JOIN*) /data/src/10.2/sql/sql_update.cc:2097
    #9 0x563ca924ee07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #10 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #11 0x563ca92565cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #12 0x563ca925e81f 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:3835
    #13 0x563ca93749d2 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /data/src/10.2/sql/sql_update.cc:1643
    #14 0x563ca910fcc9 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4132
    #15 0x563ca9124a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #16 0x563ca912e4d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #17 0x563ca9132e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #18 0x563ca9433df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #19 0x563ca943453e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #20 0x563caa709738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #21 0x7fe52f4c2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
SUMMARY: AddressSanitizer: 8424 byte(s) leaked in 6 allocation(s).
210524  2:18:41 [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.39-MariaDB-log
read_buffer_size=131072
max_used_connections=1
thread_count=0
Thread pointer: 0x0
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 = 0x0 thread_stack 0x5b000
/lib/x86_64-linux-gnu/libasan.so.5(+0x6cd30)[0x7fe52fa9bd30]
mysys/stacktrace.c:173(my_print_stacktrace)[0x563caa7cc536]
sql/signal_handler.cc:218(handle_fatal_signal)[0x563ca96b0862]
sigaction.c:0(__restore_rt)[0x7fe52f4ce3c0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fe52efc218b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fe52efa1859]
/lib/x86_64-linux-gnu/libasan.so.5(+0x12b6a2)[0x7fe52fb5a6a2]
/lib/x86_64-linux-gnu/libasan.so.5(+0x13624c)[0x7fe52fb6524c]
/lib/x86_64-linux-gnu/libasan.so.5(+0x13bb9c)[0x7fe52fb6ab9c]
/lib/x86_64-linux-gnu/libasan.so.5(+0x13b3dd)[0x7fe52fb6a3dd]
/lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0xce)[0x7fe52efc615e]
/lib/x86_64-linux-gnu/libasan.so.5(+0x22be7)[0x7fe52fa51be7]
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_ENre/mysqld.1/data
Resource Limits:
Fatal signal 11 while backtracing

A bit different test case, same build:

CREATE TABLE t (a INT);
EXPLAIN DELETE FROM t1.*, t2.* USING t AS t1 JOIN t AS t2 WHERE t1.a IN (SELECT 9 UNION SELECT 8);

Warning: Memory not freed: 65544
 
=================================================================
==1975593==ERROR: LeakSanitizer: detected memory leaks
 
Direct leak of 65544 byte(s) in 1 object(s) allocated from:
    #0 0x7f55bc2edbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x557db4fd6096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x557db4fa1ba3 in init_io_cache /data/src/10.2/mysys/mf_iocache.c:247
    #3 0x557db4f9b957 in open_cached_file /data/src/10.2/mysys/mf_cache.c:75
    #4 0x557db3beeca3 in Unique::Unique(int (*)(void*, void const*, void const*), void*, unsigned int, unsigned long, unsigned int) /data/src/10.2/sql/uniques.cc:107
    #5 0x557db436ad10 in multi_delete::initialize_tables(JOIN*) /data/src/10.2/sql/sql_delete.cc:1010
    #6 0x557db3a62e07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #7 0x557db3a6a5cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #8 0x557db3a6a5cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #9 0x557db3a7281f 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:3835
    #10 0x557db3923788 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4477
    #11 0x557db3938a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #12 0x557db39424d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #13 0x557db3946e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #14 0x557db3c47df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #15 0x557db3c4853e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #16 0x557db4f1d738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #17 0x7f55bbc73608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
Direct leak of 776 byte(s) in 1 object(s) allocated from:
    #0 0x7f55bc2edbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x557db4fd6096 in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #2 0x557db4f8c529 in init_dynamic_array2 /data/src/10.2/mysys/array.c:70
    #3 0x557db3beec12 in Unique::Unique(int (*)(void*, void const*, void const*), void*, unsigned int, unsigned long, unsigned int) /data/src/10.2/sql/uniques.cc:97
    #4 0x557db436ad10 in multi_delete::initialize_tables(JOIN*) /data/src/10.2/sql/sql_delete.cc:1010
    #5 0x557db3a62e07 in JOIN::optimize_inner() /data/src/10.2/sql/sql_select.cc:1622
    #6 0x557db3a6a5cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1127
    #7 0x557db3a6a5cd in JOIN::optimize() /data/src/10.2/sql/sql_select.cc:1119
    #8 0x557db3a7281f 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:3835
    #9 0x557db3923788 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4477
    #10 0x557db3938a8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7793
    #11 0x557db39424d3 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1827
    #12 0x557db3946e25 in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1381
    #13 0x557db3c47df6 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1336
    #14 0x557db3c4853e in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #15 0x557db4f1d738 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1869
    #16 0x7f55bbc73608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
 
SUMMARY: AddressSanitizer: 66320 byte(s) leaked in 2 allocation(s).

Generated at Thu Feb 08 08:30:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.