Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.2(EOL), 11.4, 11.6(EOL), 11.7(EOL)
Description
Distinct from MDEV-34757 and not fixed by the patch thereof, with this testcase:
CREATE VIEW c AS SELECT 1; |
PREPARE s FROM 'ALTER VIEW c AS SELECT 2'; |
EXECUTE s; |
EXECUTE s; |
We see:
CS 10.6.20 c630e23a186c7ecfe0afac21163cb4fa2cdc5f7a (Debug) |
mariadbd: /test/10.6_dbg/mysys/my_alloc.c:212: alloc_root: Assertion `(mem_root->flags & 4) == 0' failed.
|
CS 10.6.20 c630e23a186c7ecfe0afac21163cb4fa2cdc5f7a (Debug) |
Core was generated by `/test/MD090924-mariadb-10.6.20-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
|
Program terminated with signal SIGABRT, Aborted.
|
Download failed: Invalid argument. Continuing without source file ./nptl/./nptl/pthread_kill.c.
|
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
|
|
[Current thread is 1 (LWP 3934036)]
|
(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 0x000014d63f44526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
|
#4 0x000014d63f4288ff in __GI_abort () at ./stdlib/abort.c:79
|
#5 0x000014d63f42881b in __assert_fail_base (fmt=0x14d63f5d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5632839cc63e "(mem_root->flags & 4) == 0", file=file@entry=0x563283961088 "/test/10.6_dbg/mysys/my_alloc.c", line=line@entry=212, function=function@entry=0x563283b3b040 <__PRETTY_FUNCTION__.0> "alloc_root") at ./assert/assert.c:94
|
#6 0x000014d63f43b507 in __assert_fail (assertion=assertion@entry=0x5632839cc63e "(mem_root->flags & 4) == 0", file=file@entry=0x563283961088 "/test/10.6_dbg/mysys/my_alloc.c", line=line@entry=212, function=function@entry=0x563283b3b040 <__PRETTY_FUNCTION__.0> "alloc_root") at ./assert/assert.c:103
|
#7 0x00005632835d58b0 in alloc_root (mem_root=0x14d5e401c238, length=16)at /test/10.6_dbg/mysys/my_alloc.c:212
|
#8 0x0000563282a18417 in parse_escaped_string (ptr=ptr@entry=0x14d5e4024ea8 "select 2 AS `2`\nmd5=df27c95c6eba6092cfb7e3c801af0d09\nupdatable=0\nalgorithm=0\ndefiner_user=root\ndefiner_host=localhost\nsuid=1\nwith_check_option=0\ntimestamp=0001725831891150816\ncreate-version=2\nsource=S"..., end=end@entry=0x14d5e4024feb "", mem_root=mem_root@entry=0x14d5e401c238, str=0x14d63cdb1760)at /test/10.6_dbg/sql/parse_file.cc:656
|
#9 0x0000563282a18745 in File_parser::parse (this=0x14d5e4024e70, base=base@entry=0x14d63cdb1510 "", mem_root=0x14d5e401c238, parameters=parameters@entry=0x5632840f2b40 <view_parameters>, required=required@entry=15, hook=0x5632840ddbd0 <file_parser_dummy_hook>)at /test/10.6_dbg/sql/parse_file.cc:855
|
#10 0x0000563282c0a0b0 in mysql_make_view (thd=thd@entry=0x14d5e4000d58, share=share@entry=0x14d5e4026820, table=table@entry=0x14d63cdb1510, open_view_no_parse=open_view_no_parse@entry=true)at /test/10.6_dbg/sql/sql_view.cc:1385
|
#11 0x0000563282a84783 in tdc_open_view (thd=thd@entry=0x14d5e4000d58, table_list=table_list@entry=0x14d63cdb1510, flags=flags@entry=16384)at /test/10.6_dbg/sql/sql_base.cc:3000
|
#12 0x0000563282c08223 in fill_defined_view_parts (view=0x14d5e401efa0, thd=0x14d5e4000d58) at /test/10.6_dbg/sql/sql_view.cc:225
|
#13 mysql_create_view (thd=thd@entry=0x14d5e4000d58, views=views@entry=0x14d5e401efa0, mode=VIEW_ALTER)at /test/10.6_dbg/sql/sql_view.cc:490
|
#14 0x0000563282b07ce7 in mysql_execute_command (thd=0x14d5e4000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true)at /test/10.6_dbg/sql/sql_parse.cc:5943
|
#15 0x0000563282b20b40 in Prepared_statement::execute (this=this@entry=0x14d5e401bea8, expanded_query=expanded_query@entry=0x14d63cdb2cc0, open_cursor=open_cursor@entry=false)at /test/10.6_dbg/sql/sql_prepare.cc:5264
|
#16 0x0000563282b20ee8 in Prepared_statement::execute_loop (this=this@entry=0x14d5e401bea8, expanded_query=expanded_query@entry=0x14d63cdb2cc0, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/10.6_dbg/sql/sql_prepare.cc:4670
|
#17 0x0000563282b213a3 in mysql_sql_stmt_execute (thd=thd@entry=0x14d5e4000d58)at /test/10.6_dbg/sql/sql_prepare.cc:3696
|
#18 0x0000563282b02897 in mysql_execute_command (thd=thd@entry=0x14d5e4000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/10.6_dbg/sql/sql_parse.cc:4004
|
#19 0x0000563282b09d84 in mysql_parse (thd=thd@entry=0x14d5e4000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d63cdb32b0)at /test/10.6_dbg/sql/sql_parse.cc:8181
|
#20 0x0000563282b0c21b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d5e4000d58, packet=packet@entry=0x14d5e400b0c9 "EXECUTE s", packet_length=packet_length@entry=9, blocking=blocking@entry=true)at /test/10.6_dbg/sql/sql_class.h:242
|
#21 0x0000563282b0e442 in do_command (thd=0x14d5e4000d58, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1410
|
#22 0x0000563282c5b224 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563286765c18, put_in_cache=put_in_cache@entry=true)at /test/10.6_dbg/sql/sql_connect.cc:1417
|
#23 0x0000563282c5b524 in handle_one_connection (arg=arg@entry=0x563286765c18)at /test/10.6_dbg/sql/sql_connect.cc:1319
|
#24 0x00005632830a92c4 in pfs_spawn_thread (arg=0x563286750818)at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
|
#25 0x000014d63f49ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
|
#26 0x000014d63f529c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
|
Testcase is both CLI and MTR compatible.
The commit that triggered this to be found:
8ed3c375929b449ef8556cfa0c49a35707d59b84 is the first bad commit
|
commit 8ed3c375929b449ef8556cfa0c49a35707d59b84
|
Author: Oleksandr Byelkin <sanja@mariadb.com>
|
Date: Thu Jul 4 09:27:30 2024 +0200
|
|
Make PROTECT_STATEMENT_MEMROOT default for version less then 11.2
|
|
CMakeLists.txt | 11 +++++++++--
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
Attachments
Issue Links
- relates to
-
MDEV-33858 Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON
-
- Closed
-
-
MDEV-14959 Control over memory allocated for SP/PS
-
- Closed
-
Adds this stack:
CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)
mariadbd: /test/11.2_dbg/mysys/my_alloc.c:275: alloc_root: Assertion `(mem_root->flags & 4) == 0' failed.
CS 11.2.6 e91a79945822def1452787f825e6047c6a64dbd9 (Debug)
Core was generated by `/test/MD090924-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
Program terminated with signal SIGABRT, Aborted.
Download failed: Invalid argument. Continuing without source file ./nptl/./nptl/pthread_kill.c.
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
[Current thread is 1 (LWP 1870416)]
(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 0x0000150e32c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
#4 0x0000150e32c288ff in __GI_abort () at ./stdlib/abort.c:79
#5 0x0000150e32c2881b in __assert_fail_base (fmt=0x150e32dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5617b89f6f5d "(mem_root->flags & 4) == 0", file=file@entry=0x5617b8983290 "/test/11.2_dbg/mysys/my_alloc.c", line=line@entry=275, function=function@entry=0x5617b8b65110 <__PRETTY_FUNCTION__.1> "alloc_root") at ./assert/assert.c:94
#6 0x0000150e32c3b507 in __assert_fail (assertion=assertion@entry=0x5617b89f6f5d "(mem_root->flags & 4) == 0", file=file@entry=0x5617b8983290 "/test/11.2_dbg/mysys/my_alloc.c", line=line@entry=275, function=function@entry=0x5617b8b65110 <__PRETTY_FUNCTION__.1> "alloc_root") at ./assert/assert.c:103
#7 0x00005617b85cb1d5 in alloc_root (mem_root=0x150dd401b698, length=272)at /test/11.2_dbg/mysys/my_alloc.c:275
#8 0x00005617b7e30d83 in Item::operator new (mem_root=<optimized out>, size=272) at /test/11.2_dbg/sql/item.h:862
#9 Type_std_attributes::agg_item_set_converter (this=this@entry=0x150dd407e1c8, coll=@0x150e308fff20: {collation = 0x5617b9250980 <my_charset_latin1>, derivation = DERIVATION_IMPLICIT, repertoire = MY_REPERTOIRE_UNICODE30}, fname=@0x150e308fff60: {str = 0x5617b89c56e6 "=", length = 1}, args=args@entry=0x150dd407e248, nargs=nargs@entry=1, flags=flags@entry=7, item_sep=1, single_err=0x150e308fff40) at /test/11.2_dbg/sql/item.cc:2739
#10 0x00005617b7e65f7c in Item_func_or_sum::agg_arg_charsets_for_comparison (this=0x150dd407e1c0, cs=cs@entry=0x150dd407e290, a=0x150dd407e240, b=0x150dd407e248, allow_narrowing=<optimized out>)at /test/11.2_dbg/sql/item.h:5647
#11 0x00005617b7e4e073 in Arg_comparator::set_cmp_func_string (this=0x150dd407e278, thd=0x150dd4000d58)at /test/11.2_dbg/sql/item_cmpfunc.cc:591
#12 0x00005617b7d1c702 in Type_handler_string_result::set_comparator_func (this=<optimized out>, thd=<optimized out>, cmp=<optimized out>)at /test/11.2_dbg/sql/sql_type.cc:4481
#13 0x00005617b7e4d540 in Arg_comparator::set_cmp_func (this=this@entry=0x150dd407e278, thd=thd@entry=0x150dd4000d58, owner_arg=owner_arg@entry=0x150dd407e1c0, compare_handler=compare_handler@entry=0x5617b93247f0 <type_handler_long_blob>, a1=a1@entry=0x150dd407e240, a2=a2@entry=0x150dd407e248)at /test/11.2_dbg/sql/item_cmpfunc.cc:524
#14 0x00005617b7d1cc03 in Arg_comparator::set_cmp_func (set_null_arg=true, a2=0x150dd407e248, a1=0x150dd407e240, compare_handler=0x5617b93247f0 <type_handler_long_blob>, owner_arg=0x150dd407e1c0, thd=0x150dd4000d58, this=0x150dd407e278)at /test/11.2_dbg/sql/item_cmpfunc.h:104
#15 Item_bool_rowready_func2::fix_length_and_dec_generic (compare_handler=0x5617b93247f0 <type_handler_long_blob>, thd=0x150dd4000d58, this=0x150dd407e1c0)at /test/11.2_dbg/sql/item_cmpfunc.h:584
#16 Type_handler::Item_bool_rowready_func2_fix_length_and_dec (this=0x5617b93247f0 <type_handler_long_blob>, thd=0x150dd4000d58, func=0x150dd407e1c0) at /test/11.2_dbg/sql/sql_type.cc:5810
#17 0x00005617b7e4d438 in Item_bool_rowready_func2::fix_length_and_dec (this=0x150dd407e1c0, thd=0x150dd4000d58)at /test/11.2_dbg/sql/item_cmpfunc.cc:491
#18 0x00005617b7e83b47 in Item_func::fix_fields (this=0x150dd407e1c0, thd=0x150dd4000d58, ref=<optimized out>)at /test/11.2_dbg/sql/item_func.cc:380
#19 0x00005617b7a725c0 in Item::fix_fields_if_needed (ref=0x150dd4013d20, thd=0x150dd4000d58, this=0x150dd407e1c0) at /test/11.2_dbg/sql/item.h:802
#20 Item::fix_fields_if_needed_for_scalar (ref=0x150dd4013d20, thd=0x150dd4000d58, this=0x150dd407e1c0) at /test/11.2_dbg/sql/item.h:1176
#21 Item::fix_fields_if_needed_for_bool (ref=0x150dd4013d20, thd=0x150dd4000d58, this=0x150dd407e1c0) at /test/11.2_dbg/sql/item.h:1180
#22 setup_conds (thd=thd@entry=0x150dd4000d58, tables=tables@entry=0x150dd407d7d0, leaves=@0x150dd407bdb8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x150dd4013878, last = 0x150dd4013878, elements = 1}, <No data fields>}, conds=conds@entry=0x150dd4013d20) at /test/11.2_dbg/sql/sql_base.cc:8940
#23 0x00005617b7b69579 in setup_without_group (hidden_group_fields=0x150dd4013be7, win_funcs=@0x150dd407c040: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5617b92f71e0 <end_of_list>, last = 0x150dd407c040, elements = 0}, <No data fields>}, win_specs=@0x150dd407c020: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5617b92f71e0 <end_of_list>, last = 0x150dd407c020, elements = 0}, <No data fields>}, group=0x0, order=0x0, conds=0x150dd4013d20, all_fields=@0x150dd4013c38: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5617b92f71e0 <end_of_list>, last = 0x150dd4013c38, elements = 0}, <No data fields>}, fields=@0x150dd407e430: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5617b92f71e0 <end_of_list>, last = 0x150dd407e430, elements = 0}, <No data fields>}, leaves=@0x150dd407bdb8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x150dd4013878, last = 0x150dd4013878, elements = 1}, <No data fields>}, tables=0x150dd407d7d0, ref_pointer_array=<optimized out>, thd=0x150dd4000d58) at /test/11.2_dbg/sql/sql_select.cc:950
#24 JOIN::prepare (this=this@entry=0x150dd4013888, tables_init=tables_init@entry=0x150dd407d7d0, conds_init=<optimized out>, og_num=<optimized out>, order_init=<optimized out>, skip_order_by=skip_order_by@entry=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x150dd407bba0, unit_arg=0x150dd407b368) at /test/11.2_dbg/sql/sql_select.cc:1572
#25 0x00005617b7a9c70b in Sql_cmd_delete::prepare_inner (this=0x150dd407e3f0, thd=0x150dd4000d58) at /test/11.2_dbg/sql/sql_delete.cc:1698
#26 0x00005617b7b30227 in Sql_cmd_dml::prepare (this=0x150dd407e3f0, thd=0x150dd4000d58) at /test/11.2_dbg/sql/sql_select.cc:33715
#27 0x00005617b7b32035 in Sql_cmd_dml::execute (this=0x150dd407e3f0, thd=0x150dd4000d58) at /test/11.2_dbg/sql/sql_select.cc:33768
#28 0x00005617b7aee3ea in mysql_execute_command (thd=0x150dd4000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true)at /test/11.2_dbg/sql/sql_parse.cc:4433
#29 0x00005617b7b1bde3 in Prepared_statement::execute (this=this@entry=0x150dd401b308, expanded_query=expanded_query@entry=0x150e30900c70, open_cursor=open_cursor@entry=false)at /test/11.2_dbg/sql/sql_prepare.cc:5077
#30 0x00005617b7b1c199 in Prepared_statement::execute_loop (this=this@entry=0x150dd401b308, expanded_query=expanded_query@entry=0x150e30900c70, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/11.2_dbg/sql/sql_prepare.cc:4461
#31 0x00005617b7b1c64b in mysql_sql_stmt_execute (thd=thd@entry=0x150dd4000d58)at /test/11.2_dbg/sql/sql_prepare.cc:3480
#32 0x00005617b7aed0e1 in mysql_execute_command (thd=thd@entry=0x150dd4000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.2_dbg/sql/sql_parse.cc:4000
#33 0x00005617b7af3d26 in mysql_parse (thd=thd@entry=0x150dd4000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x150e309012a0)at /test/11.2_dbg/sql/sql_parse.cc:7929
#34 0x00005617b7af61bd in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150dd4000d58, packet=packet@entry=0x150dd400b309 "EXECUTE s5 USING @a", packet_length=packet_length@entry=19, blocking=blocking@entry=true)at /test/11.2_dbg/sql/sql_class.h:248
#35 0x00005617b7af83e3 in do_command (thd=0x150dd4000d58, blocking=blocking@entry=true) at /test/11.2_dbg/sql/sql_parse.cc:1407
#36 0x00005617b7c6435c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5617bae96e18, put_in_cache=put_in_cache@entry=true)at /test/11.2_dbg/sql/sql_connect.cc:1439
#37 0x00005617b7c6465c in handle_one_connection (arg=arg@entry=0x5617bae96e18)at /test/11.2_dbg/sql/sql_connect.cc:1341
#38 0x00005617b80ab62c in pfs_spawn_thread (arg=0x5617bae65f68)at /test/11.2_dbg/storage/perfschema/pfs.cc:2201
#39 0x0000150e32c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
#40 0x0000150e32d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
This stack looks to be present in 11.1+ debub builds only. Testcase is MTR and CLI compatible.