[MDEV-25027] SIGABRT in DbugExit from my_malloc in JOIN_CACHE::alloc_buffer Created: 2021-03-02  Updated: 2021-07-10  Resolved: 2021-07-10

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.5, 10.6
Fix Version/s: 10.5.10, 10.6.0

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Roel Van de Paar
Resolution: Duplicate Votes: 0
Labels: not-10.2, not-10.3, not-10.4, regression

Issue Links:
Relates
relates to MDEV-24858 SIGABRT in DbugExit from my_malloc in... Closed

 Description   

SET GLOBAL join_buffer_space_limit=4095;
SET join_buffer_space_limit=DEFAULT;
CREATE TEMPORARY TABLE t (e INT,c CHAR(100),c2 CHAR(100),PRIMARY KEY(e),INDEX a(c)) ENGINE=InnoDB;
INSERT INTO t SELECT a.* FROM t a,t b,t c,t d,t e;

Leads to:

10.6.0 27d66d644cf2ebe9201e0362f2050036cce2908a (Debug)

Core was generated by `/test/MD260221-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x1545800d8700 (LWP 2932073))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x00005562dea58ab8 in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
#2  0x00005562de1ed317 in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:331
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x000015458173d859 in __GI_abort () at abort.c:79
#6  0x00005562dea74fd5 in DbugExit (why=why@entry=0x1545800d66e0 "missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"my_malloc\"\n") at /test/10.6_dbg/dbug/dbug.c:2043
#7  0x00005562dea76f86 in _db_return_ (_stack_frame_=_stack_frame_@entry=0x1545800d6940) at /test/10.6_dbg/dbug/dbug.c:1210
#8  0x00005562dea53cb5 in my_malloc (key=0, size=18446744073709551409, my_flags=my_flags@entry=65536) at /test/10.6_dbg/mysys/my_malloc.c:116
#9  0x00005562de0c8372 in JOIN_CACHE::alloc_buffer (this=this@entry=0x154538033bd8) at /test/10.6_dbg/sql/sql_join_cache.cc:940
#10 0x00005562de0c8b0f in JOIN_CACHE::init (this=this@entry=0x154538033bd8, for_explain=for_explain@entry=false) at /test/10.6_dbg/sql/sql_join_cache.cc:1073
#11 0x00005562de0c8bec in JOIN_CACHE_BNL::init (this=0x154538033bd8, for_explain=<optimized out>) at /test/10.6_dbg/sql/sql_join_cache.cc:3634
#12 0x00005562ddfa1928 in JOIN::init_join_cache_and_keyread (this=this@entry=0x1545380176b8) at /test/10.6_dbg/sql/sql_select.cc:29461
#13 0x00005562ddfa6595 in JOIN::optimize_stage2 (this=this@entry=0x1545380176b8) at /test/10.6_dbg/sql/sql_select.cc:3000
#14 0x00005562ddfa808b in JOIN::optimize_inner (this=this@entry=0x1545380176b8) at /test/10.6_dbg/sql/sql_select.cc:2282
#15 0x00005562ddfa82b6 in JOIN::optimize (this=this@entry=0x1545380176b8) at /test/10.6_dbg/sql/sql_select.cc:1628
#16 0x00005562ddfa8c07 in mysql_select (thd=thd@entry=0x154538000db8, tables=0x154538014948, fields=@0x154538014490: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1545380148f0, last = 0x154538018048, elements = 3}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2202244745984, result=0x154538017600, unit=0x154538004f88, select_lex=0x154538014340) at /test/10.6_dbg/sql/sql_select.cc:4716
#17 0x00005562ddfa8f1c in handle_select (thd=thd@entry=0x154538000db8, lex=lex@entry=0x154538004ec0, result=result@entry=0x154538017600, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /test/10.6_dbg/sql/sql_select.cc:417
#18 0x00005562ddf2a910 in mysql_execute_command (thd=thd@entry=0x154538000db8) at /test/10.6_dbg/sql/sql_parse.cc:4665
#19 0x00005562ddf14cdc in mysql_parse (thd=thd@entry=0x154538000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1545800d73d0) at /test/10.6_dbg/sql/sql_parse.cc:7972
#20 0x00005562ddf22b3b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x154538000db8, packet=packet@entry=0x15453800b319 "INSERT INTO t SELECT a.* FROM t a,t b,t c,t d,t e", packet_length=packet_length@entry=49, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1295
#21 0x00005562ddf25fbe in do_command (thd=0x154538000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1397
#22 0x00005562de081c2e in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5562e1166148, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#23 0x00005562de082331 in handle_one_connection (arg=arg@entry=0x5562e1166148) at /test/10.6_dbg/sql/sql_connect.cc:1312
#24 0x00005562de5369b9 in pfs_spawn_thread (arg=0x5562e1097c28) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#25 0x0000154581c4b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#26 0x000015458183a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.5.10 (dbg), 10.6.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (dbg), 10.4.19 (opt), 10.5.10 (opt), 10.6.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.29 (dbg), 5.7.30 (dbg), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)



 Comments   
Comment by Elena Stepanova [ 2021-03-03 ]

This must be already fixed, by the patch for MDEV-24858.

Comment by Roel Van de Paar [ 2021-07-10 ]

Confirmed, no longer crashes.

Comment by Roel Van de Paar [ 2021-07-10 ]

Interesting it does not crash 10.5 anymore either, though the patch for MDEV-24858 seems to apply to 10.6 only? serg Can you confirm fix in 10.5 please?

Comment by Sergei Golubchik [ 2021-07-10 ]

Yes, fixed in 10.5 and 10.6

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