Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
13.1
-
Not for Release Notes
-
Q3/2026 Server Maintenance
Description
CREATE TABLE t1(a INT); |
DELIMITER $$;
|
CREATE FUNCTION f() RETURNS INT |
BEGIN
|
EXECUTE IMMEDIATE 'LOCK TABLES t1 WRITE'; |
RETURN 1; |
END$$ |
CREATE PROCEDURE p() BEGIN DECLARE v INT DEFAULT f(); END$$ |
DELIMITER ;$$
|
CALL p();
|
|
|
#cleanup
|
DROP PROCEDURE p; |
DROP FUNCTION f; |
DROP TABLE t1; |
Leads to
|
MDEV-39518 CS 13.1.0 ba0a2e08727bc136c1b25d527f9441389d22bf7b (Debug, Clang 18.1.3-11) Build 30/06/2026 |
mariadbd: /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_base.cc:2689: int Locked_tables_list::unlock_locked_tables(THD *): Assertion `!thd->in_sub_stmt && !(thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.
|
|
MDEV-39518 CS 13.1.0 ba0a2e08727bc136c1b25d527f9441389d22bf7b (Debug, Clang 18.1.3-11) Build 30/06/2026 |
Core was generated by `/test/mtest/MDEV-39518/MD300626-mariadb-13.1.0-linux-x86_64-dbg/bin/mariadbd --'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
|
|
|
[Current thread is 1 (LWP 3189193)]
|
(gdb) bt
|
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
|
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
|
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
|
#3 0x00007e5e1444527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
|
#4 0x00007e5e144288ff in __GI_abort () at ./stdlib/abort.c:79
|
#5 0x00007e5e1442881b in __assert_fail_base (fmt=0x7e5e145d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x6486d561459d "!thd->in_sub_stmt && !(thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=file@entry=0x6486d5613c9f "/test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_base.cc", line=line@entry=2689, function=function@entry=0x6486d56145e9 "int Locked_tables_list::unlock_locked_tables(THD *)") at ./assert/assert.c:96
|
#6 0x00007e5e1443b517 in __assert_fail (assertion=0x6486d561459d "!thd->in_sub_stmt && !(thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=0x6486d5613c9f "/test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_base.cc", line=2689, function=0x6486d56145e9 "int Locked_tables_list::unlock_locked_tables(THD *)") at ./assert/assert.c:105
|
#7 0x00006486d43f793b in Locked_tables_list::unlock_locked_tables (this=0x763b640050b0, thd=0x763b64000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_base.cc:2688
|
#8 0x00006486d44d09fc in mysql_execute_command (thd=0x763b64000d60, is_called_from_prepared_stmt=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:4969
|
#9 0x00006486d45141a2 in Prepared_statement::execute (this=0x763b64067c30, expanded_query=0x7e5e1022f820, open_cursor=false, result_arg=0x763b64067d80, cursor_arg=0x763b64067df0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_prepare.cc:5542
|
#10 0x00006486d4513619 in Prepared_statement::execute_loop (this=0x763b64067c30, expanded_query=0x7e5e1022f820, open_cursor=false, result_arg=0x763b64067d80, cursor_arg=0x763b64067df0, instrs_set_placeholder=@0x7e5e1022fb30: {<Slice<unsigned int>> = {m_offset = 0, m_count = 0}, <No data fields>}, packet=0x0, packet_end=0x0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_prepare.cc:4875
|
#11 0x00006486d4516d4f in Prepared_statement::execute_immediate (this=0x763b64067c30, query=0x763b6405c590 "LOCK TABLES t1 WRITE", query_len=20, dynamic_open_cursor=false, result_arg=0x763b64067d80, cursor_arg=0x763b64067df0, instrs_set_placeholder=@0x7e5e1022fb30: {<Slice<unsigned int>> = {m_offset = 0, m_count = 0}, <No data fields>})at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_prepare.cc:5720
|
#12 0x00006486d450de6c in mysql_sql_stmt_execute_immediate (thd=0x763b64000d60, dynamic_open_cursor=false, result_arg=0x0, cursor_arg=0x0, instrs_set_placeholder=@0x7e5e1022fb30: {<Slice<unsigned int>> = {m_offset = 0, m_count = 0}, <No data fields>})at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_prepare.cc:3118
|
#13 0x00006486d450d9e7 in mysql_sql_stmt_execute_immediate (thd=0x763b64000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_prepare.cc:3141
|
#14 0x00006486d44cc16a in mysql_execute_command (thd=0x763b64000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:3997
|
#15 0x00006486d479fac7 in sp_instr_stmt::exec_core (this=0x763b6405c6b0, thd=0x763b64000d60, nextp=0x7e5e10231628)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:1281
|
#16 0x00006486d479cf96 in sp_lex_keeper::reset_lex_and_exec_core (this=0x763b6405c6f0, thd=0x763b64000d60, nextp=0x7e5e10231628, open_tables=false, instr=0x763b6405c6b0, rerun_the_same_instr=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:420
|
#17 0x00006486d479d70c in sp_lex_keeper::validate_lex_and_exec_core (this=0x763b6405c6f0, thd=0x763b64000d60, nextp=0x7e5e10231628, open_tables=false, instr=0x763b6405c6b0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:599
|
#18 0x00006486d479ed39 in sp_instr_stmt::execute (this=0x763b6405c6b0, thd=0x763b64000d60, nextp=0x7e5e10231628)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:1183
|
#19 0x00006486d439b90c in sp_head::execute (this=0x763b6405b160, thd=0x763b64000d60, merge_da_on_success=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:1292
|
#20 0x00006486d439efaa in sp_head::execute_function (this=0x763b6405b160, thd=0x763b64000d60, argp=0x0, argcount=0, return_value_fld=0x763b6402a080, func_ctx=0x763b64029e08, call_arena=0x763b64053b10)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:2064
|
#21 0x00006486d4956b1c in Item_sp::execute_impl (this=0x763b64029da0, thd=0x763b64000d60, args=0x0, arg_count=0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/item.cc:3110
|
#22 0x00006486d4956474 in Item_sp::execute (this=0x763b64029da0, thd=0x763b64000d60, null_value=0x763b64029d56, args=0x0, arg_count=0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/item.cc:3012
|
#23 0x00006486d49e7608 in Item_func_sp::execute (this=0x763b64029ce0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/item_func.cc:6768
|
#24 0x00006486d49f2899 in Item_func_sp::val_int (this=0x763b64029ce0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/item_func.h:4358
|
#25 0x00006486d4964cf8 in Item::save_int_in_field (this=0x763b64029ce0, field=0x763b6401c430, no_conversions=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/item.cc:7340
|
#26 0x00006486d47bd7a0 in Type_handler_int_result::Item_save_in_field (this=0x6486d63395d0 <type_handler_slong>, item=0x763b64029ce0, field=0x763b6401c430, no_conversions=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_type.cc:4512
|
#27 0x00006486d4964e35 in Item::save_in_field (this=0x763b64029ce0, field=0x763b6401c430, no_conversions=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/item.cc:7360
|
#28 0x00006486d48e5bef in Field::sp_prepare_and_store_item (this=0x763b6401c430, thd=0x763b64000d60, value=0x763b64029f58)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/field.cc:1527
|
#29 0x00006486d43989b8 in THD::sp_eval_expr (this=0x763b64000d60, result_field=0x763b6401c430, expr_item_ptr=0x763b64029f58)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:448
|
#30 0x00006486d43b18ce in sp_rcontext::set_variable (this=0x763b6401b820, thd=0x763b64000d60, idx=0, value=0x763b64029f58)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_rcontext.cc:676
|
#31 0x00006486d479fbc2 in sp_instr_set::exec_core (this=0x763b64029ea0, thd=0x763b64000d60, nextp=0x7e5e10232708)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:1314
|
#32 0x00006486d479cf96 in sp_lex_keeper::reset_lex_and_exec_core (this=0x763b64029ee0, thd=0x763b64000d60, nextp=0x7e5e10232708, open_tables=true, instr=0x763b64029ea0, rerun_the_same_instr=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:420
|
#33 0x00006486d479d70c in sp_lex_keeper::validate_lex_and_exec_core (this=0x763b64029ee0, thd=0x763b64000d60, nextp=0x7e5e10232708, open_tables=true, instr=0x763b64029ea0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:599
|
#34 0x00006486d479fb2e in sp_instr_set::execute (this=0x763b64029ea0, thd=0x763b64000d60, nextp=0x7e5e10232708)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:1301
|
#35 0x00006486d439b90c in sp_head::execute (this=0x763b640286a0, thd=0x763b64000d60, merge_da_on_success=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:1292
|
#36 0x00006486d439e30e in sp_head::execute_procedure (this=0x763b640286a0, thd=0x763b64000d60, args=0x763b64006280)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:2332
|
#37 0x00006486d44c9197 in do_execute_sp (thd=0x763b64000d60, sp=0x763b640286a0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:3084
|
#38 0x00006486d44c8cb8 in Sql_cmd_call::execute (this=0x763b6401a690, thd=0x763b64000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:3322
|
#39 0x00006486d44d50e8 in mysql_execute_command (thd=0x763b64000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:5905
|
#40 0x00006486d44c4264 in mysql_parse (thd=0x763b64000d60, rawbuf=0x763b6401a3f0 "CALL p()", length=8, parser_state=0x7e5e102349f0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:7945
|
#41 0x00006486d44c15ad in dispatch_command (command=COM_QUERY, thd=0x763b64000d60, packet=0x763b6400b621 "CALL p()", packet_length=8, blocking=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:1903
|
#42 0x00006486d44c4e13 in do_command (thd=0x763b64000d60, blocking=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:1437
|
#43 0x00006486d46c4b19 in do_handle_one_connection (connect=0x6487070ca2b0, put_in_cache=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_connect.cc:1503
|
#44 0x00006486d46c48be in handle_one_connection (arg=0x6487070af3b0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_connect.cc:1415
|
#45 0x00007e5e1449caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
|
#46 0x00007e5e14529c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
Attachments
Issue Links
- is caused by
-
MDEV-39518 Allow prepared statements in stored functions in assignment right hand
-
- In Testing
-