Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37718

Assertion '!thd->rgi_slave' failed in open_global_temporary_table on CREATE/ANALYZE GTT

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q4/2025 Server Maintenance

    Description

      --source include/have_binlog_format_statement.inc
      --source include/master-slave.inc
      CREATE GLOBAL TEMPORARY TABLE t (c INT) ON COMMIT PRESERVE ROWS SELECT 1 a;
      DROP TABLE t;  # Cleanup
      --source include/rpl_end.inc
      

      Leads to, on the replica:

      MDEV-35915-6 CS 12.2.0 ed3c63488a1613377d92ee3ade3fe6870e39b4db (Optimized, Clang 21.1.0-20250811) Build 24/09/2025

      Core was generated by `/test/MDEV-35915_6_MD240925-mariadb-12.2.0-linux-x86_64-opt/bin/mariadbd --defa'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x000060dfd5d261b8 in open_global_temporary_table (thd=thd@entry=0x7854b00015b8, source=source@entry=0x7854b0026570, out_table=out_table@entry=0x7854b000d3e8, mdl_ticket=mdl_ticket@entry=0x7854b0017870)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:6309
      6309	    ++thd->temporary_tables->global_temporary_tables_count;
      [Current thread is 1 (LWP 2503876)]
      (gdb) bt
      #0  0x000060dfd5d261b8 in open_global_temporary_table (thd=thd@entry=0x7854b00015b8, source=source@entry=0x7854b0026570, out_table=out_table@entry=0x7854b000d3e8, mdl_ticket=mdl_ticket@entry=0x7854b0017870)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:6309
      #1  0x000060dfd5b87024 in open_table (thd=thd@entry=0x7854b00015b8, table_list=0x7854b000d3e8, ot_ctx=ot_ctx@entry=0x7855b811bd18)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_base.cc:2351
      #2  0x000060dfd5c205ff in select_create::create_table_from_items (this=this@entry=0x7854b000ed40, thd=0x7854b00015b8, items=items@entry=0x7855b811c6e0, lock=lock@entry=0x7855b811c6d8)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_insert.cc:4943
      #3  0x000060dfd5c20c43 in select_create::prepare (this=0x7854b000ed40, _values=<optimized out>, u=0x7854b00059e0)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_insert.cc:5102
      #4  0x000060dfd5c99b91 in JOIN::prepare (this=this@entry=0x7854b000ee80, tables_init=tables_init@entry=0x0, conds_init=conds_init@entry=0x0, og_num=og_num@entry=0, order_init=order_init@entry=0x0, skip_order_by=<optimized out>, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7854b000dc40, unit_arg=0x7854b00059e0)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_select.cc:1886
      #5  0x000060dfd5c95241 in mysql_select (thd=thd@entry=0x7854b00015b8, tables=0x0, fields=@0x7854b000def8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7854b000e1a8, last = 0x7854b000e1a8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x7854b000ed40, unit=0x7854b00059e0, select_lex=0x7854b000dc40)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_select.cc:5377
      #6  0x000060dfd5c94fe9 in handle_select (thd=thd@entry=0x7854b00015b8, lex=lex@entry=0x7854b0005900, result=result@entry=0x7854b000ed40, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_select.cc:634
      #7  0x000060dfd5d35588 in Sql_cmd_create_table_like::execute (this=<optimized out>, thd=0x7854b00015b8)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:13964
      #8  0x000060dfd5c5ab1c in mysql_execute_command (thd=thd@entry=0x7854b00015b8, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_parse.cc:5861
      #9  0x000060dfd5c55dc4 in mysql_parse (thd=0x7854b00015b8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7855b811d350)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_parse.cc:7894
      #10 0x000060dfd5a7ff12 in Query_log_event::do_apply_event (this=0x7854b001f308, rgi=0x7854b0000c50, query_arg=0x7854b001f463 "CREATE GLOBAL TEMPORARY TABLE t (c INT) ON COMMIT PRESERVE ROWS SELECT 1 state", q_len_arg=<optimized out>)at /test/bb-12.2-nikita-global-tmp_opt/sql/log_event_server.cc:2090
      #11 0x000060dfd5a979d4 in Log_event::apply_event (this=0x7854b001f308, rgi=0x7854b0000c50)at /test/bb-12.2-nikita-global-tmp_opt/sql/log_event.cc:3984
      #12 0x000060dfd5b37370 in apply_event_and_update_pos_apply (ev=ev@entry=0x7854b001f308, thd=thd@entry=0x7854b00015b8, rgi=rgi@entry=0x7854b0000c50, reason=1, reason@entry=0)at /test/bb-12.2-nikita-global-tmp_opt/sql/slave.cc:3615
      #13 0x000060dfd5b33e5d in apply_event_and_update_pos (ev=0x7854b001f308, thd=0x7854b00015b8, rgi=0x7854b0000c50)at /test/bb-12.2-nikita-global-tmp_opt/sql/slave.cc:3791
      #14 exec_relay_log_event (thd=0x7854b00015b8, rli=0x60dfd868f5f0, serial_rgi=0x7854b0000c50)at /test/bb-12.2-nikita-global-tmp_opt/sql/slave.cc:4233
      #15 handle_slave_sql (arg=arg@entry=0x60dfd868d920)at /test/bb-12.2-nikita-global-tmp_opt/sql/slave.cc:5465
      #16 0x000060dfd5f70bb9 in pfs_spawn_thread (arg=0x7854bc036af8)at /test/bb-12.2-nikita-global-tmp_opt/storage/perfschema/pfs.cc:2198
      #17 0x00007855bee9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #18 0x00007855bef29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      MDEV-35915-6 CS 12.2.0 ed3c63488a1613377d92ee3ade3fe6870e39b4db (Debug, Clang 21.1.0-20250811) Build 24/09/2025

      mariadbd: /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc:6239: my_bool open_global_temporary_table(THD *, TABLE_SHARE *, TABLE_LIST *, MDL_ticket *): Assertion `!thd->rgi_slave' failed.
      

      MDEV-35915-6 CS 12.2.0 ed3c63488a1613377d92ee3ade3fe6870e39b4db (Debug, Clang 21.1.0-20250811) Build 24/09/2025

      Core was generated by `/test/MDEV-35915_6_MD240925-mariadb-12.2.0-linux-x86_64-dbg/bin/mariadbd --defa'.
      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 2504923)]
      (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  0x0000791d1684526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000791d168288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000791d1682881b in __assert_fail_base (fmt=0x791d169d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5b06c0e788e5 "!thd->rgi_slave", file=file@entry=0x5b06c0db1d3a "/test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc", line=line@entry=6239, function=function@entry=0x5b06c0e405ce "my_bool open_global_temporary_table(THD *, TABLE_SHARE *, TABLE_LIST *, MDL_ticket *)") at ./assert/assert.c:94
      #6  0x0000791d1683b507 in __assert_fail (assertion=0x5b06c0e788e5 "!thd->rgi_slave", file=0x5b06c0db1d3a "/test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc", line=6239, function=0x5b06c0e405ce "my_bool open_global_temporary_table(THD *, TABLE_SHARE *, TABLE_LIST *, MDL_ticket *)") at ./assert/assert.c:103
      #7  0x00005b06c1b9e81b in open_global_temporary_table (thd=0x791c0c001b18, source=0x791c0c038310, out_table=0x791c0c00fd88, mdl_ticket=0x791c0c01c4c0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc:6239
      #8  0x00005b06c1919e69 in open_table (thd=0x791c0c001b18, table_list=0x791c0c00fd88, ot_ctx=0x791d0ffaf8c0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:2351
      #9  0x00005b06c1a21e40 in select_create::create_table_from_items (this=0x791c0c0116e0, thd=0x791c0c001b18, items=0x791d0ffb04d0, lock=0x791d0ffb04a8)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_insert.cc:4943
      #10 0x00005b06c1a228d0 in select_create::prepare (this=0x791c0c0116e0, _values=@0x791c0c010898: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x791c0c010b48, last = 0x791c0c010b48, elements = 1}, <No data fields>}, u=0x791c0c005f18) at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_insert.cc:5102
      #11 0x00005b06c1add61f in JOIN::prepare (this=0x791c0c011820, tables_init=0x0, 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=0x791c0c0105e0, unit_arg=0x791c0c005f18)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_select.cc:1886
      #12 0x00005b06c1ad808c in mysql_select (thd=0x791c0c001b18, tables=0x0, fields=@0x791c0c010898: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x791c0c010b48, last = 0x791c0c010b48, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2201187781376, result=0x791c0c0116e0, unit=0x791c0c005f18, select_lex=0x791c0c0105e0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_select.cc:5377
      #13 0x00005b06c1ad7c6d in handle_select (thd=0x791c0c001b18, lex=0x791c0c005e38, result=0x791c0c0116e0, setup_tables_done_option=0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_select.cc:634
      #14 0x00005b06c1bb4e6a in Sql_cmd_create_table_like::execute (this=0x791c0c00fd10, thd=0x791c0c001b18)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc:13964
      #15 0x00005b06c1a81dc5 in mysql_execute_command (thd=0x791c0c001b18, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:5861
      #16 0x00005b06c1a73088 in mysql_parse (thd=0x791c0c001b18, rawbuf=0x791c0c034cf3 "CREATE GLOBAL TEMPORARY TABLE t (c INT) ON COMMIT PRESERVE ROWS SELECT 1 state", length=78, parser_state=0x791d0ffb2760)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:7894
      #17 0x00005b06c178c309 in Query_log_event::do_apply_event (this=0x791c0c034b98, rgi=0x791c0c000cf0, query_arg=0x791c0c034cf3 "CREATE GLOBAL TEMPORARY TABLE t (c INT) ON COMMIT PRESERVE ROWS SELECT 1 state", q_len_arg=78)at /test/bb-12.2-nikita-global-tmp_dbg/sql/log_event_server.cc:2090
      #18 0x00005b06c178b327 in Query_log_event::do_apply_event (this=0x791c0c034b98, rgi=0x791c0c000cf0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/log_event_server.cc:1515
      #19 0x00005b06c17b12a2 in Log_event::apply_event (this=0x791c0c034b98, rgi=0x791c0c000cf0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/log_event.cc:3984
      #20 0x00005b06c189a19b in apply_event_and_update_pos_apply (ev=0x791c0c034b98, thd=0x791c0c001b18, rgi=0x791c0c000cf0, reason=0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/slave.cc:3615
      #21 0x00005b06c1899fcc in apply_event_and_update_pos (ev=0x791c0c034b98, thd=0x791c0c001b18, rgi=0x791c0c000cf0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/slave.cc:3791
      #22 0x00005b06c18a30e6 in exec_relay_log_event (thd=0x791c0c001b18, rli=0x5b06c4fbb0c0, serial_rgi=0x791c0c000cf0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/slave.cc:4233
      #23 0x00005b06c1895f57 in handle_slave_sql (arg=0x5b06c4fb8ff0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/slave.cc:5465
      #24 0x0000791d1689ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x0000791d16929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      MDEV-35915-6 CS 12.2.0 ed3c63488a1613377d92ee3ade3fe6870e39b4db (Optimized, UBASAN, Clang 21.1.0-20250811) Build 24/09/2025

          #0 0x6036cf0c125e in open_global_temporary_table(THD*, TABLE_SHARE*, TABLE_LIST*, MDL_ticket*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_table.cc:6309:30
          #1 0x6036ce6cd04e in open_table(THD*, TABLE_LIST*, Open_table_context*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_base.cc:2351:22
          #2 0x6036ceaaa6e3 in select_create::create_table_from_items(THD*, List<Item>*, st_mysql_lock**) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_insert.cc:4943:11
          #3 0x6036ceaad67c in select_create::prepare(List<Item>&, st_select_lex_unit*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_insert.cc:5102:16
          #4 0x6036ced50f69 in JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_select.cc:1886:39
          #5 0x6036ced3b13d in 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*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_select.cc:5377:21
          #6 0x6036ced39cc5 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_select.cc:634:10
          #7 0x6036cf12f55d in Sql_cmd_create_table_like::execute(THD*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_table.cc:13964:20
          #8 0x6036cebd1a9f in mysql_execute_command(THD*, bool) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_parse.cc:5861:26
          #9 0x6036cebb51a5 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_parse.cc:7894:18
          #10 0x6036ce143cae in Query_log_event::do_apply_event(rpl_group_info*, char const*, unsigned int) /test/bb-12.2-nikita-global-tmp_opt_san/sql/log_event_server.cc:2090:11
          #11 0x6036ce1c3ba8 in Log_event::apply_event(rpl_group_info*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/log_event.cc:3984:8
          #12 0x6036ce522e5c in apply_event_and_update_pos_apply(Log_event*, THD*, rpl_group_info*, int) /test/bb-12.2-nikita-global-tmp_opt_san/sql/slave.cc:3615:19
          #13 0x6036ce511efe in exec_relay_log_event(THD*, Relay_log_info*, rpl_group_info*) /test/bb-12.2-nikita-global-tmp_opt_san/sql/slave.cc:4233:15
          #14 0x6036ce511efe in handle_slave_sql /test/bb-12.2-nikita-global-tmp_opt_san/sql/slave.cc:5465:9
          #15 0x6036cdb9638a in asan_thread_start(void*) crtstuff.c
          #16 0x7cc58d29ca93 in start_thread nptl/pthread_create.c:447:8
          #17 0x7cc58d329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: null-pointer-use /test/bb-12.2-nikita-global-tmp_opt_san/sql/sql_table.cc:6309:30 
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.