Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.6, 10.11
-
None
-
Can result in unexpected behaviour
-
JSON_TABLE under conditions where it exceeded the stack limit now correctly produces a ER_STACK_OVERRUN_NEED_MORE error rather than continuing to process.
Description
A small allocation of a warning in safemalloc calls backtrace overflowing memory.
TLDR - test with WITH_SAFEMALLOC=OFF
10.6 |
|
main.json_debug_nonembedded_noasan w5 [ fail ]
|
Test ended at 2025-06-20 02:10:16
|
|
CURRENT_TEST: main.json_debug_nonembedded_noasan
|
mysqltest: At line 17: query 'SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt' failed with wrong errno <Unknown> (2013): 'Lost connection to server during query', instead of ER_STACK_OVERRUN_NEED_MORE (1436)...
|
|
The result from queries just before the failure was:
|
#
|
# Beginning of 10.6 test
|
#
|
# MDEV-28762: recursive call of some json functions without stack control
|
#
|
SET @saved_debug= @@debug_dbug;
|
SET @@debug_dbug='+d,json_check_min_stack_requirement';
|
SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
|
|
|
[Thread debugging using libthread_db enabled]
|
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
|
Core was generated by `/build/sql/mariadbd --defaults-group-suffix=.1 --defaults-file=/build/mysql-tes'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 0x0000ffffa0193db8 in ?? () from /lib/aarch64-linux-gnu/libunwind.so.1
|
[Current thread is 1 (Thread 0xffff95f92fe0 (LWP 11240))]
|
|
|
Thread 1 (Thread 0xffff95f92fe0 (LWP 11240)):
|
#0 0x0000ffffa0193db8 in ?? () from /lib/aarch64-linux-gnu/libunwind.so.1
|
#1 0x0000ffffa01960b8 in ?? () from /lib/aarch64-linux-gnu/libunwind.so.1
|
#2 0x0000ffffa01934c4 in ?? () from /lib/aarch64-linux-gnu/libunwind.so.1
|
#3 0x0000ffffa0191990 in unw_init_local () from /lib/aarch64-linux-gnu/libunwind.so.1
|
#4 0x0000ffffa0197ccc in _Unwind_Find_FDE () from /lib/aarch64-linux-gnu/libunwind.so.1
|
#5 0x0000ffffa008d140 in ?? () from /lib/aarch64-linux-gnu/libgcc_s.so.1
|
#6 0x0000ffffa008e0a8 in ?? () from /lib/aarch64-linux-gnu/libgcc_s.so.1
|
#7 0x0000ffffa008ebf4 in _Unwind_Backtrace () from /lib/aarch64-linux-gnu/libgcc_s.so.1
|
#8 0x0000ffff9ffc5178 in backtrace () from /lib/aarch64-linux-gnu/libc.so.6
|
#9 0x0000aaaab1507020 in __interceptor_backtrace ()
|
#10 0x0000aaaab6c6b5b0 in sf_malloc (size=448, my_flags=69648) at /source/mysys/safemalloc.c:147
|
#11 0x0000aaaab6bc8c68 in my_malloc (key=0, size=424, my_flags=69648) at /source/mysys/my_malloc.c:91
|
#12 0x0000aaaab6b45234 in alloc_root (mem_root=0xe2b0000452e0, length=424) at /source/mysys/my_alloc.c:196
|
#13 0x0000aaaab15a79bc in Sql_alloc::operator new (size=400, mem_root=0xe2b0000452e0) at /source/sql/sql_alloc.h:37
|
#14 0x0000aaaab1bb6eb8 in Warning_info::push_warning (this=0xe2b0000452e0, thd=0xe2b00003f088, value=0xffff95d97eb0, msg=0xe14000010000 "Thread stack overrun: 2082688 bytes used of a 2097152 byte stack, and 16000 bytes needed. Consider increasing the thread_stack system variable.") at /source/sql/sql_error.cc:700
|
#15 0x0000aaaab1b32448 in Diagnostics_area::push_warning (this=0xe2b0000450a0, thd=0xe2b00003f088, sql_errno_arg=1436, sqlstate=0xaaaab7481ab2 "HY000", level=Sql_state_errno_level::WARN_LEVEL_ERROR, ucid=..., msg=0xe14000010000 "Thread stack overrun: 2082688 bytes used of a 2097152 byte stack, and 16000 bytes needed. Consider increasing the thread_stack system variable.") at /source/sql/sql_error.h:1220
|
#16 0x0000aaaab1aa2fb8 in THD::raise_condition (this=0xe2b00003f088, sql_errno=1436, sqlstate=0xaaaab7481ab2 "HY000", level=Sql_state_errno_level::WARN_LEVEL_ERROR, ucid=..., msg=0xe14000010000 "Thread stack overrun: 2082688 bytes used of a 2097152 byte stack, and 16000 bytes needed. Consider increasing the thread_stack system variable.") at /source/sql/sql_class.cc:1217
|
#17 0x0000aaaab15a9f64 in THD::raise_condition (this=0xe2b00003f088, sql_errno=1436, sqlstate=0x0, level=Sql_state_errno_level::WARN_LEVEL_ERROR, msg=0xe14000010000 "Thread stack overrun: 2082688 bytes used of a 2097152 byte stack, and 16000 bytes needed. Consider increasing the thread_stack system variable.") at /source/sql/sql_class.h:5056
|
#18 0x0000aaaab1552a98 in my_message_sql (error=1436, str=0xe14000010000 "Thread stack overrun: 2082688 bytes used of a 2097152 byte stack, and 16000 bytes needed. Consider increasing the thread_stack system variable.", MyFlags=4096) at /source/sql/mysqld.cc:3262
|
#19 0x0000aaaab6b83d50 in my_message (error=1436, str=0xe14000010000 "Thread stack overrun: 2082688 bytes used of a 2097152 byte stack, and 16000 bytes needed. Consider increasing the thread_stack system variable.", MyFlags=4096) at /source/mysys/my_error.c:195
|
#20 0x0000aaaab1e7a040 in check_stack_overrun (thd=0xe2b00003f088, margin=16000, buf=0x0) at /source/sql/sql_parse.cc:7622
|
#21 0x0000aaaab3064228 in get_disallowed_table_deps_for_list (mem_root=0xe2b000045060, table_func=0xe1c0000200a0, join_list=0xe1a00000fe58, disallowed_tables=0xe0c0000200e0) at /source/sql/json_table.cc:127
|
#22 0x0000aaaab305dfa0 in get_disallowed_table_deps (mem_root=0xe2b000045060, select=0xe1a00000fca0, table_func=0xe1c0000200a0) at /source/sql/json_table.cc:181
|
#23 0x0000aaaab305d130 in Table_function_json_table::setup (this=0xe1e0000114a0, thd=0xe2b00003f088, sql_table=0xe1c0000200a0, s_lex=0xe1a00000fca0) at /source/sql/json_table.cc:1172
|
#24 0x0000aaaab2015e50 in JOIN::prepare (this=0xe1b000020da0, tables_init=0xe1c0000200a0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0xe1a00000fca0, unit_arg=0xe2b0000434a8) at /source/sql/sql_select.cc:1507
|
#25 0x0000aaaab1ffd6bc in mysql_select (thd=0xe2b00003f088, tables=0xe1c0000200a0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0xe0d00001b010, unit=0xe2b0000434a8, select_lex=0xe1a00000fca0) at /source/sql/sql_select.cc:5172
|
#26 0x0000aaaab1ffb258 in handle_select (thd=0xe2b00003f088, lex=0xe2b0000433e0, result=0xe0d00001b010, setup_tables_done_option=0) at /source/sql/sql_select.cc:573
|
#27 0x0000aaaab1e6318c in execute_sqlcom_select (thd=0xe2b00003f088, all_tables=0xe1c0000200a0) at /source/sql/sql_parse.cc:6422
|
#28 0x0000aaaab1e27200 in mysql_execute_command (thd=0xe2b00003f088, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:4013
|
#29 0x0000aaaab1df93e8 in mysql_parse (thd=0xe2b00003f088, rawbuf=0xe1200004d7a0 "SELECT * from JSON_TABLE('[{\"a\": 1, \"b\": [11,111]}, {\"a\": 2, \"b\": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt", length=119, parser_state=0xffff95f90b10) at /source/sql/sql_parse.cc:8200
|
#30 0x0000aaaab1deb128 in dispatch_command (command=COM_QUERY, thd=0xe2b00003f088, packet=0xe29000069089 "SELECT * from JSON_TABLE('[{\"a\": 1, \"b\": [11,111]}, {\"a\": 2, \"b\": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt", packet_length=119, blocking=true) at /source/sql/sql_parse.cc:1908
|
#31 0x0000aaaab1dfd4c4 in do_command (thd=0xe2b00003f088, blocking=true) at /source/sql/sql_parse.cc:1421
|
#32 0x0000aaaab2956eb8 in do_handle_one_connection (connect=0xe0e00001f268, put_in_cache=true) at /source/sql/sql_connect.cc:1386
|
#33 0x0000aaaab2955c7c in handle_one_connection (arg=0xe0e00001f188) at /source/sql/sql_connect.cc:1298
|
#34 0x0000aaaab4e4cc78 in pfs_spawn_thread (arg=0xe17000003188) at /source/storage/perfschema/pfs.cc:2201
|
#35 0x0000ffff9ff4eea0 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
|
#36 0x0000ffff9ffb7b1c in ?? () from /lib/aarch64-linux-gnu/libc.so.6
|
WITH_SAFEMALLOC=OFF |
worker[01] Using MTR_BUILD_THREAD 300, with reserved ports 19000..19029
|
main.json_debug_nonembedded_noasan [ pass ] 19
|
--------------------------------------------------------------------------
|
So can we force SAFEMALLOC=OFF in MSAN builds?
Attachments
Issue Links
- blocks
-
MDBF-1076 create MSAN Debug builder
-
- Closed
-
- is part of
-
MDEV-37225 Remove ASAN limitation from MTR tests
-
- Open
-
- relates to
-
MDEV-33209 Stack overflow in main.json_debug_nonembedded due to incorrect debug injection
-
- Closed
-
-
MDEV-34099 AddressSanitizer running out of memory regardless of stack_thread size
-
- Closed
-