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

Spider: Assertions `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory', `thd->status_var.tmp_space_used >= track->previous_file_size' and `!table || !table->in_use || table->in_use == _current_thd()' failed

Details

    Description

      As discussed with ycp, opening a ticket for this testcase. Yuchen also saw memory leak warnings.

      SET sql_mode='';
      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      GRANT ALL ON * TO Spider@localhost;
      CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE'',USER 'Spider',PASSWORD'');
      CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
      CREATE TABLE t1 (c1 CHAR CHARACTER SET UCS2 COLLATE UCS2_bin,KEY(c1)) ENGINE=Spider COMMENT='TABLE "st"' PARTITION BY LIST COLUMNS (c1) (PARTITION p DEFAULT COMMENT='srv "d"' ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"');
      SET spider_quick_page_byte=0,spider_bgs_mode=1;
      SELECT COUNT(*) FROM t1;
      

      Leads to:

      11.2.6 a8517608894f43954e210035d357400b3d637195 (Debug)

      mariadbd: /test/11.2_dbg/sql/sql_class.cc:1812: virtual THD::~THD(): Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed.
      

      11.2.6 a8517608894f43954e210035d357400b3d637195 (Debug)

      Core was generated by `/test/MD130824-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
       
      warning: 44	./nptl/pthread_kill.c: No such file or directory
      [Current thread is 1 (LWP 158643)]
      (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  0x0000151c2e04526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000151c2e0288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000151c2e02881b in __assert_fail_base (fmt=0x151c2e1d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5629835686b8 "status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory", file=file@entry=0x562983566e10 "/test/11.2_dbg/sql/sql_class.cc", line=line@entry=1812, function=function@entry=0x5629837133d7 "virtual THD::~THD()")at ./assert/assert.c:94
      #6  0x0000151c2e03b507 in __assert_fail (assertion=0x5629835686b8 "status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory", file=0x562983566e10 "/test/11.2_dbg/sql/sql_class.cc", line=1812, function=0x5629837133d7 "virtual THD::~THD()")at ./assert/assert.c:103
      #7  0x00005629827da5a0 in THD::~THD (this=0x151bb4000f98, __in_chrg=<optimized out>) at /test/11.2_dbg/sql/sql_class.cc:1812
      #8  0x00005629827da5d3 in THD::~THD (this=0x151bb4000f98, __in_chrg=<optimized out>) at /test/11.2_dbg/sql/sql_class.cc:1818
      #9  0x0000151c2c1bb874 in spider_bg_conn_action (arg=0x151bcc054198)at /test/11.2_dbg/storage/spider/spd_conn.cc:2496
      #10 0x0000151c2e09ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #11 0x0000151c2e129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug confirmed present in:
      MariaDB: 10.5.27 (dbg), 10.6.20 (dbg), 10.11.10 (dbg), 11.1.7 (dbg), 11.2.6 (dbg), 11.4.4 (dbg), 11.5.2 (dbg), 11.6.1 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.27 (opt), 10.6.20 (opt), 10.11.10 (opt), 11.1.7 (opt), 11.2.6 (opt), 11.4.4 (opt), 11.5.2 (opt), 11.6.1 (opt)

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            Please note that on 11.5+ we see a very different assert and stack, note the tmp table frames like free_tmp_table.

            11.5.2 ea75a0b6009b0251e83193cd38c3974e36b65e06 (Debug)

            mariadbd: /test/11.5_dbg/sql/mysqld.cc:3824: int temp_file_size_cb_func(tmp_file_tracking*, int): Assertion `thd->status_var.tmp_space_used >= track->previous_file_size' failed.
            

            11.5.2 ea75a0b6009b0251e83193cd38c3974e36b65e06 (Debug)

            Core was generated by `/test/MD130824-mariadb-11.5.2-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
             
            warning: 44	./nptl/pthread_kill.c: No such file or directory
            [Current thread is 1 (LWP 158065)]
            (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  0x000014e69b84526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
            #4  0x000014e69b8288ff in __GI_abort () at ./stdlib/abort.c:79
            #5  0x000014e69b82881b in __assert_fail_base (fmt=0x14e69b9d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55df17168778 "thd->status_var.tmp_space_used >= track->previous_file_size", file=file@entry=0x55df1732a767 "/test/11.5_dbg/sql/mysqld.cc", line=line@entry=3824, function=function@entry=0x55df17168740 "int temp_file_size_cb_func(tmp_file_tracking*, int)") at ./assert/assert.c:94
            #6  0x000014e69b83b507 in __assert_fail (assertion=0x55df17168778 "thd->status_var.tmp_space_used >= track->previous_file_size", file=0x55df1732a767 "/test/11.5_dbg/sql/mysqld.cc", line=3824, function=0x55df17168740 "int temp_file_size_cb_func(tmp_file_tracking*, int)") at ./assert/assert.c:103
            #7  0x000055df162f0b05 in temp_file_size_cb_func (track=0x14e698747000, no_error=0) at /test/11.5_dbg/sql/mysqld.cc:3824
            #8  0x000055df169639bd in _ma_update_tmp_file_size (track=<optimized out>, file_size=<optimized out>) at /test/11.5_dbg/storage/maria/ma_info.c:234
            #9  0x000055df16970bc6 in ha_maria::drop_table (this=0x14e624029860, name=0x14e624018fa8 "/test/MD130824-mariadb-11.5.2-linux-x86_64-dbg/data/#sql-temptable-26593-8-0") at /test/11.5_dbg/storage/maria/ha_maria.cc:2939
            #10 0x000055df164a0717 in free_tmp_table (thd=0x14e624000f98, entry=0x14e624018160) at /test/11.5_dbg/sql/sql_select.cc:22903
            #11 0x000014e69811fbaf in spider_rm_sys_tmp_table_for_result (thd=<optimized out>, tmp_table=<optimized out>, tmp_tbl_prm=tmp_tbl_prm@entry=0x14e6240173f0)at /test/11.5_dbg/storage/spider/spd_sys_table.cc:3156
            #12 0x000014e69812da01 in spider_db_free_one_result (result_list=result_list@entry=0x14e63c0e0250, result=0x14e6240173a8)at /test/11.5_dbg/storage/spider/spd_db_conn.cc:2824
            #13 0x000014e6981322d2 in spider_db_seek_next (buf=0x14e63c0a43e0 "\377", spider=0x14e63c0dfc50, link_idx=0, table=0x14e63c0a3460)at /test/11.5_dbg/storage/spider/spd_db_conn.cc:4006
            #14 0x000014e6981c4927 in spider_group_by_handler::next_row (this=0x14e63c37de70)at /test/11.5_dbg/storage/spider/spd_group_by_handler.cc:1369
            #15 0x000055df164f949f in Pushdown_query::execute (this=0x14e63c01e930, join=join@entry=0x14e63c01c240)at /test/11.5_dbg/sql/group_by_handler.cc:64
            #16 0x000055df164c735c in do_select (procedure=<optimized out>, join=0x14e63c01c240) at /test/11.5_dbg/sql/sql_select.cc:23058
            #17 JOIN::exec_inner (this=this@entry=0x14e63c01c240)at /test/11.5_dbg/sql/sql_select.cc:5026
            #18 0x000055df164c7d00 in JOIN::exec (this=this@entry=0x14e63c01c240)at /test/11.5_dbg/sql/sql_select.cc:4809
            #19 0x000055df164c5ae7 in mysql_select (thd=thd@entry=0x14e63c000d58, tables=0x14e63c01b128, fields=@0x14e63c01ad00: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e63c01b0b8, last = 0x14e63c01b0b8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x14e63c01c218, unit=0x14e63c005250, select_lex=0x14e63c01aa48) at /test/11.5_dbg/sql/sql_select.cc:5342
            #20 0x000055df164c6310 in handle_select (thd=thd@entry=0x14e63c000d58, lex=lex@entry=0x14e63c005170, result=result@entry=0x14e63c01c218, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.5_dbg/sql/sql_select.cc:628
            #21 0x000055df16425efe in execute_sqlcom_select (thd=thd@entry=0x14e63c000d58, all_tables=0x14e63c01b128) at /test/11.5_dbg/sql/sql_parse.cc:6147
            #22 0x000055df16431343 in mysql_execute_command (thd=thd@entry=0x14e63c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.5_dbg/sql/sql_parse.cc:3953
            #23 0x000055df16437841 in mysql_parse (thd=thd@entry=0x14e63c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14e698748290)at /test/11.5_dbg/sql/sql_parse.cc:7869
            #24 0x000055df16439bc8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e63c000d58, packet=packet@entry=0x14e63c00b329 "", packet_length=packet_length@entry=23, blocking=blocking@entry=true)at /test/11.5_dbg/sql/sql_class.h:256
            #25 0x000055df1643bff0 in do_command (thd=0x14e63c000d58, blocking=blocking@entry=true) at /test/11.5_dbg/sql/sql_parse.cc:1405
            #26 0x000055df165abb47 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55df1ad059a8, put_in_cache=put_in_cache@entry=true)at /test/11.5_dbg/sql/sql_connect.cc:1447
            #27 0x000055df165abe3c in handle_one_connection (arg=arg@entry=0x55df1ad059a8)at /test/11.5_dbg/sql/sql_connect.cc:1349
            #28 0x000055df16a0ea46 in pfs_spawn_thread (arg=0x55df1ac557a8)at /test/11.5_dbg/storage/perfschema/pfs.cc:2201
            #29 0x000014e69b89ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
            #30 0x000014e69b929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
            

            Roel Roel Van de Paar added a comment - - edited Please note that on 11.5+ we see a very different assert and stack, note the tmp table frames like free_tmp_table . 11.5.2 ea75a0b6009b0251e83193cd38c3974e36b65e06 (Debug) mariadbd: /test/11.5_dbg/sql/mysqld.cc:3824: int temp_file_size_cb_func(tmp_file_tracking*, int): Assertion `thd->status_var.tmp_space_used >= track->previous_file_size' failed. 11.5.2 ea75a0b6009b0251e83193cd38c3974e36b65e06 (Debug) Core was generated by `/test/MD130824-mariadb-11.5.2-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   warning: 44 ./nptl/pthread_kill.c: No such file or directory [Current thread is 1 (LWP 158065)] (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 0x000014e69b84526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26 #4 0x000014e69b8288ff in __GI_abort () at ./stdlib/abort.c:79 #5 0x000014e69b82881b in __assert_fail_base (fmt=0x14e69b9d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55df17168778 "thd->status_var.tmp_space_used >= track->previous_file_size", file=file@entry=0x55df1732a767 "/test/11.5_dbg/sql/mysqld.cc", line=line@entry=3824, function=function@entry=0x55df17168740 "int temp_file_size_cb_func(tmp_file_tracking*, int)") at ./assert/assert.c:94 #6 0x000014e69b83b507 in __assert_fail (assertion=0x55df17168778 "thd->status_var.tmp_space_used >= track->previous_file_size", file=0x55df1732a767 "/test/11.5_dbg/sql/mysqld.cc", line=3824, function=0x55df17168740 "int temp_file_size_cb_func(tmp_file_tracking*, int)") at ./assert/assert.c:103 #7 0x000055df162f0b05 in temp_file_size_cb_func (track=0x14e698747000, no_error=0) at /test/11.5_dbg/sql/mysqld.cc:3824 #8 0x000055df169639bd in _ma_update_tmp_file_size (track=<optimized out>, file_size=<optimized out>) at /test/11.5_dbg/storage/maria/ma_info.c:234 #9 0x000055df16970bc6 in ha_maria::drop_table (this=0x14e624029860, name=0x14e624018fa8 "/test/MD130824-mariadb-11.5.2-linux-x86_64-dbg/data/#sql-temptable-26593-8-0") at /test/11.5_dbg/storage/maria/ha_maria.cc:2939 #10 0x000055df164a0717 in free_tmp_table (thd=0x14e624000f98, entry=0x14e624018160) at /test/11.5_dbg/sql/sql_select.cc:22903 #11 0x000014e69811fbaf in spider_rm_sys_tmp_table_for_result (thd=<optimized out>, tmp_table=<optimized out>, tmp_tbl_prm=tmp_tbl_prm@entry=0x14e6240173f0)at /test/11.5_dbg/storage/spider/spd_sys_table.cc:3156 #12 0x000014e69812da01 in spider_db_free_one_result (result_list=result_list@entry=0x14e63c0e0250, result=0x14e6240173a8)at /test/11.5_dbg/storage/spider/spd_db_conn.cc:2824 #13 0x000014e6981322d2 in spider_db_seek_next (buf=0x14e63c0a43e0 "\377", spider=0x14e63c0dfc50, link_idx=0, table=0x14e63c0a3460)at /test/11.5_dbg/storage/spider/spd_db_conn.cc:4006 #14 0x000014e6981c4927 in spider_group_by_handler::next_row (this=0x14e63c37de70)at /test/11.5_dbg/storage/spider/spd_group_by_handler.cc:1369 #15 0x000055df164f949f in Pushdown_query::execute (this=0x14e63c01e930, join=join@entry=0x14e63c01c240)at /test/11.5_dbg/sql/group_by_handler.cc:64 #16 0x000055df164c735c in do_select (procedure=<optimized out>, join=0x14e63c01c240) at /test/11.5_dbg/sql/sql_select.cc:23058 #17 JOIN::exec_inner (this=this@entry=0x14e63c01c240)at /test/11.5_dbg/sql/sql_select.cc:5026 #18 0x000055df164c7d00 in JOIN::exec (this=this@entry=0x14e63c01c240)at /test/11.5_dbg/sql/sql_select.cc:4809 #19 0x000055df164c5ae7 in mysql_select (thd=thd@entry=0x14e63c000d58, tables=0x14e63c01b128, fields=@0x14e63c01ad00: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e63c01b0b8, last = 0x14e63c01b0b8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x14e63c01c218, unit=0x14e63c005250, select_lex=0x14e63c01aa48) at /test/11.5_dbg/sql/sql_select.cc:5342 #20 0x000055df164c6310 in handle_select (thd=thd@entry=0x14e63c000d58, lex=lex@entry=0x14e63c005170, result=result@entry=0x14e63c01c218, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.5_dbg/sql/sql_select.cc:628 #21 0x000055df16425efe in execute_sqlcom_select (thd=thd@entry=0x14e63c000d58, all_tables=0x14e63c01b128) at /test/11.5_dbg/sql/sql_parse.cc:6147 #22 0x000055df16431343 in mysql_execute_command (thd=thd@entry=0x14e63c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.5_dbg/sql/sql_parse.cc:3953 #23 0x000055df16437841 in mysql_parse (thd=thd@entry=0x14e63c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14e698748290)at /test/11.5_dbg/sql/sql_parse.cc:7869 #24 0x000055df16439bc8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e63c000d58, packet=packet@entry=0x14e63c00b329 "", packet_length=packet_length@entry=23, blocking=blocking@entry=true)at /test/11.5_dbg/sql/sql_class.h:256 #25 0x000055df1643bff0 in do_command (thd=0x14e63c000d58, blocking=blocking@entry=true) at /test/11.5_dbg/sql/sql_parse.cc:1405 #26 0x000055df165abb47 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55df1ad059a8, put_in_cache=put_in_cache@entry=true)at /test/11.5_dbg/sql/sql_connect.cc:1447 #27 0x000055df165abe3c in handle_one_connection (arg=arg@entry=0x55df1ad059a8)at /test/11.5_dbg/sql/sql_connect.cc:1349 #28 0x000055df16a0ea46 in pfs_spawn_thread (arg=0x55df1ac557a8)at /test/11.5_dbg/storage/perfschema/pfs.cc:2201 #29 0x000014e69b89ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447 #30 0x000014e69b929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
            Roel Roel Van de Paar added a comment - - edited

            An MTR testcase for this issue:

            --source plugin/spider/spider/include/init_spider.inc
            --source include/have_innodb.inc
            --source include/have_partition.inc
             
            SET spider_same_server_link= on;
            eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (HOST "127.0.0.1", DATABASE "test", USER "root", PORT $MASTER_MYPORT);
             
            SET sql_mode='';
            CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
            CREATE TABLE t1 (c1 CHAR CHARACTER SET UCS2 COLLATE UCS2_bin,KEY(c1)) ENGINE=Spider COMMENT='TABLE "st"' PARTITION BY LIST COLUMNS (c1) (PARTITION p DEFAULT COMMENT='srv "d"' ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"');
            SET spider_quick_page_byte=0,spider_bgs_mode=1;
            SELECT COUNT(*) FROM t1;
             
            # Cleanup
            DROP TABLE t1;
            --source plugin/spider/spider/include/deinit_spider.inc
            

            Leads to still another assert:

            11.2.6 a8517608894f43954e210035d357400b3d637195 (Debug)

            mariadbd: /test/11.2_dbg/sql/handler.cc:3486: THD* handler::ha_thd() const: Assertion `!table || !table->in_use || table->in_use == _current_thd()' failed.
            

            11.2.6 a8517608894f43954e210035d357400b3d637195 (Debug)

            Core was generated by `/test/MD130824-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd --defaults-group-su'.
            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
             
            warning: 44	./nptl/pthread_kill.c: No such file or directory
            [Current thread is 1 (LWP 1109360)]
            (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  0x0000146f9904526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
            #4  0x0000146f990288ff in __GI_abort () at ./stdlib/abort.c:79
            #5  0x0000146f9902881b in __assert_fail_base (fmt=0x146f991d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5564410ab868 "!table || !table->in_use || table->in_use == _current_thd()", file=file@entry=0x55644121183d "/test/11.2_dbg/sql/handler.cc", line=line@entry=3486, function=function@entry=0x556441211d4a "THD* handler::ha_thd() const")at ./assert/assert.c:94
            #6  0x0000146f9903b507 in __assert_fail (assertion=0x5564410ab868 "!table || !table->in_use || table->in_use == _current_thd()", file=0x55644121183d "/test/11.2_dbg/sql/handler.cc", line=3486, function=0x556441211d4a "THD* handler::ha_thd() const")at ./assert/assert.c:103
            #7  0x0000556440626dcc in handler::ha_thd (this=this@entry=0x146f380296f0)at /test/11.2_dbg/sql/handler.cc:3486
            #8  0x0000556440627bba in handler::ha_rnd_next (this=0x146f380296f0, buf=<optimized out>) at /test/11.2_dbg/sql/handler.cc:3712
            #9  0x0000146f923319aa in spider_db_get_row_from_tmp_tbl (current=0x146f38017238, row=row@entry=0x146f94c84198)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:2329
            #10 0x0000146f92331e70 in spider_db_fetch_table (spider=spider@entry=0x146f50074020, buf=buf@entry=0x146f50072550 "\377", table=0x146f50049500, result_list=result_list@entry=0x146f500745f0)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:2422
            #11 0x0000146f92336f99 in spider_db_fetch (buf=buf@entry=0x146f50072550 "\377", spider=spider@entry=0x146f50074020, table=table@entry=0x146f50049500)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:3945
            #12 0x0000146f9233857f in spider_db_seek_next (buf=0x146f50072550 "\377", spider=0x146f50074020, link_idx=0, table=0x146f50049500)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:4398
            #13 0x0000146f923c5725 in spider_group_by_handler::next_row (this=0x146f503368a0)at /test/11.2_dbg/storage/spider/spd_group_by_handler.cc:1369
            #14 0x00005564403d7a63 in Pushdown_query::execute (this=0x146f500188a8, join=join@entry=0x146f500161c0)at /test/11.2_dbg/sql/group_by_handler.cc:64
            #15 0x00005564403aacc4 in do_select (procedure=<optimized out>, join=0x146f500161c0) at /test/11.2_dbg/sql/sql_select.cc:23048
            #16 JOIN::exec_inner (this=this@entry=0x146f500161c0)at /test/11.2_dbg/sql/sql_select.cc:5026
            #17 0x00005564403ab6b4 in JOIN::exec (this=this@entry=0x146f500161c0)at /test/11.2_dbg/sql/sql_select.cc:4803
            #18 0x00005564403a9423 in mysql_select (thd=thd@entry=0x146f50000d58, tables=0x146f500150a8, fields=@0x146f50014c80: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146f50015038, last = 0x146f50015038, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x146f50016198, unit=0x146f500052a8, select_lex=0x146f500149c8) at /test/11.2_dbg/sql/sql_select.cc:5341
            #19 0x00005564403a9c4c in handle_select (thd=thd@entry=0x146f50000d58, lex=lex@entry=0x146f500051c8, result=result@entry=0x146f50016198, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.2_dbg/sql/sql_select.cc:628
            #20 0x00005564403091e1 in execute_sqlcom_select (thd=thd@entry=0x146f50000d58, all_tables=0x146f500150a8) at /test/11.2_dbg/sql/sql_parse.cc:6161
            #21 0x0000556440314c08 in mysql_execute_command (thd=thd@entry=0x146f50000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.2_dbg/sql/sql_parse.cc:3984
            #22 0x000055644031b423 in mysql_parse (thd=thd@entry=0x146f50000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146f94c85290)at /test/11.2_dbg/sql/sql_parse.cc:7922
            #23 0x000055644031d7aa in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146f50000d58, packet=packet@entry=0x146f5000b3a9 "", packet_length=packet_length@entry=23, blocking=blocking@entry=true)at /test/11.2_dbg/sql/sql_class.h:248
            #24 0x000055644031facf in do_command (thd=0x146f50000d58, blocking=blocking@entry=true) at /test/11.2_dbg/sql/sql_parse.cc:1407
            #25 0x0000556440486d1d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5564446104a8, put_in_cache=put_in_cache@entry=true)at /test/11.2_dbg/sql/sql_connect.cc:1439
            #26 0x0000556440487012 in handle_one_connection (arg=arg@entry=0x5564446104a8)at /test/11.2_dbg/sql/sql_connect.cc:1341
            #27 0x00005564408dc5c8 in pfs_spawn_thread (arg=0x55644458c268)at /test/11.2_dbg/storage/perfschema/pfs.cc:2201
            #28 0x0000146f9909ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
            #29 0x0000146f99129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
            

            Roel Roel Van de Paar added a comment - - edited An MTR testcase for this issue: --source plugin/spider/spider/include/init_spider.inc --source include/have_innodb.inc --source include/have_partition.inc   SET spider_same_server_link= on ; eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (HOST "127.0.0.1" , DATABASE "test" , USER "root" , PORT $MASTER_MYPORT);   SET sql_mode= '' ; CREATE TABLE t (c INT KEY ,c1 BLOB,c2 TEXT) ENGINE=InnoDB; CREATE TABLE t1 (c1 CHAR CHARACTER SET UCS2 COLLATE UCS2_bin, KEY (c1)) ENGINE=Spider COMMENT= 'TABLE "st"' PARTITION BY LIST COLUMNS (c1) (PARTITION p DEFAULT COMMENT= 'srv "d"' ENGINE=Spider COMMENT= 'WRAPPER "mysql",SRV "srv",TABLE "t"' ); SET spider_quick_page_byte=0,spider_bgs_mode=1; SELECT COUNT (*) FROM t1;   # Cleanup DROP TABLE t1; --source plugin/spider/spider/include/deinit_spider.inc Leads to still another assert: 11.2.6 a8517608894f43954e210035d357400b3d637195 (Debug) mariadbd: /test/11.2_dbg/sql/handler.cc:3486: THD* handler::ha_thd() const: Assertion `!table || !table->in_use || table->in_use == _current_thd()' failed. 11.2.6 a8517608894f43954e210035d357400b3d637195 (Debug) Core was generated by `/test/MD130824-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd --defaults-group-su'. 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   warning: 44 ./nptl/pthread_kill.c: No such file or directory [Current thread is 1 (LWP 1109360)] (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 0x0000146f9904526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26 #4 0x0000146f990288ff in __GI_abort () at ./stdlib/abort.c:79 #5 0x0000146f9902881b in __assert_fail_base (fmt=0x146f991d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5564410ab868 "!table || !table->in_use || table->in_use == _current_thd()", file=file@entry=0x55644121183d "/test/11.2_dbg/sql/handler.cc", line=line@entry=3486, function=function@entry=0x556441211d4a "THD* handler::ha_thd() const")at ./assert/assert.c:94 #6 0x0000146f9903b507 in __assert_fail (assertion=0x5564410ab868 "!table || !table->in_use || table->in_use == _current_thd()", file=0x55644121183d "/test/11.2_dbg/sql/handler.cc", line=3486, function=0x556441211d4a "THD* handler::ha_thd() const")at ./assert/assert.c:103 #7 0x0000556440626dcc in handler::ha_thd (this=this@entry=0x146f380296f0)at /test/11.2_dbg/sql/handler.cc:3486 #8 0x0000556440627bba in handler::ha_rnd_next (this=0x146f380296f0, buf=<optimized out>) at /test/11.2_dbg/sql/handler.cc:3712 #9 0x0000146f923319aa in spider_db_get_row_from_tmp_tbl (current=0x146f38017238, row=row@entry=0x146f94c84198)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:2329 #10 0x0000146f92331e70 in spider_db_fetch_table (spider=spider@entry=0x146f50074020, buf=buf@entry=0x146f50072550 "\377", table=0x146f50049500, result_list=result_list@entry=0x146f500745f0)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:2422 #11 0x0000146f92336f99 in spider_db_fetch (buf=buf@entry=0x146f50072550 "\377", spider=spider@entry=0x146f50074020, table=table@entry=0x146f50049500)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:3945 #12 0x0000146f9233857f in spider_db_seek_next (buf=0x146f50072550 "\377", spider=0x146f50074020, link_idx=0, table=0x146f50049500)at /test/11.2_dbg/storage/spider/spd_db_conn.cc:4398 #13 0x0000146f923c5725 in spider_group_by_handler::next_row (this=0x146f503368a0)at /test/11.2_dbg/storage/spider/spd_group_by_handler.cc:1369 #14 0x00005564403d7a63 in Pushdown_query::execute (this=0x146f500188a8, join=join@entry=0x146f500161c0)at /test/11.2_dbg/sql/group_by_handler.cc:64 #15 0x00005564403aacc4 in do_select (procedure=<optimized out>, join=0x146f500161c0) at /test/11.2_dbg/sql/sql_select.cc:23048 #16 JOIN::exec_inner (this=this@entry=0x146f500161c0)at /test/11.2_dbg/sql/sql_select.cc:5026 #17 0x00005564403ab6b4 in JOIN::exec (this=this@entry=0x146f500161c0)at /test/11.2_dbg/sql/sql_select.cc:4803 #18 0x00005564403a9423 in mysql_select (thd=thd@entry=0x146f50000d58, tables=0x146f500150a8, fields=@0x146f50014c80: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146f50015038, last = 0x146f50015038, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525824, result=0x146f50016198, unit=0x146f500052a8, select_lex=0x146f500149c8) at /test/11.2_dbg/sql/sql_select.cc:5341 #19 0x00005564403a9c4c in handle_select (thd=thd@entry=0x146f50000d58, lex=lex@entry=0x146f500051c8, result=result@entry=0x146f50016198, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.2_dbg/sql/sql_select.cc:628 #20 0x00005564403091e1 in execute_sqlcom_select (thd=thd@entry=0x146f50000d58, all_tables=0x146f500150a8) at /test/11.2_dbg/sql/sql_parse.cc:6161 #21 0x0000556440314c08 in mysql_execute_command (thd=thd@entry=0x146f50000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.2_dbg/sql/sql_parse.cc:3984 #22 0x000055644031b423 in mysql_parse (thd=thd@entry=0x146f50000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146f94c85290)at /test/11.2_dbg/sql/sql_parse.cc:7922 #23 0x000055644031d7aa in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146f50000d58, packet=packet@entry=0x146f5000b3a9 "", packet_length=packet_length@entry=23, blocking=blocking@entry=true)at /test/11.2_dbg/sql/sql_class.h:248 #24 0x000055644031facf in do_command (thd=0x146f50000d58, blocking=blocking@entry=true) at /test/11.2_dbg/sql/sql_parse.cc:1407 #25 0x0000556440486d1d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5564446104a8, put_in_cache=put_in_cache@entry=true)at /test/11.2_dbg/sql/sql_connect.cc:1439 #26 0x0000556440487012 in handle_one_connection (arg=arg@entry=0x5564446104a8)at /test/11.2_dbg/sql/sql_connect.cc:1341 #27 0x00005564408dc5c8 in pfs_spawn_thread (arg=0x55644458c268)at /test/11.2_dbg/storage/perfschema/pfs.cc:2201 #28 0x0000146f9909ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447 #29 0x0000146f99129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
            Roel Roel Van de Paar added a comment - - edited

            Discussed w/ ycp and tested against bb-11.5-mdev-34518. It still asserts there.

            bb-11.5-mdev-34518 11.5.2 b8dec55ca7b10235d5592d15eac775eed3cbd2f1 (Debug)

            #5  0x00001510a002881b in __assert_fail_base (fmt=0x1510a01d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55d9ef6be6e8 "thd->status_var.tmp_space_used >= track->previous_file_size", file=file@entry=0x55d9ef6be080 "/test/bb-11.5-mdev-34518_dbg/sql/mysqld.cc", line=line@entry=3793, function=function@entry=0x55d9ef6be6b0 "int temp_file_size_cb_func(tmp_file_tracking*, int)") at ./assert/assert.c:94
            

            Roel Roel Van de Paar added a comment - - edited Discussed w/ ycp and tested against bb-11.5-mdev-34518. It still asserts there. bb-11.5-mdev-34518 11.5.2 b8dec55ca7b10235d5592d15eac775eed3cbd2f1 (Debug) #5 0x00001510a002881b in __assert_fail_base (fmt=0x1510a01d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55d9ef6be6e8 "thd->status_var.tmp_space_used >= track->previous_file_size", file=file@entry=0x55d9ef6be080 "/test/bb-11.5-mdev-34518_dbg/sql/mysqld.cc", line=line@entry=3793, function=function@entry=0x55d9ef6be6b0 "int temp_file_size_cb_func(tmp_file_tracking*, int)") at ./assert/assert.c:94
            ycp Yuchen Pei added a comment -

            debug_assert_on_not_freed_memory is just a switch that allows auto assertion failure on nonzero status_var.local_memory_used.

            safemalloc warnings look like it could be a hint:

            Warning: 3624 bytes freed by T@4, allocated by T@9 at 0x5624a8732661, mysys/my_malloc.c:91, mysys/my_alloc.c:244, sql/sql_select.cc:18953, sql/sql_select.cc:19794, spider/spd_sys_table.cc:3095, spider/spd_db_conn.cc:4004, spider/spd_conn.cc:2787

            which points to an if branch in spider_db_store_result(), called from a bg thread in spider_bg_conn_action(). The branch is entered

                  if (
                    result_list->quick_mode == 3 &&
                    page_size == roop_count &&
                    result_list->limit_num > roop_count &&
                    row
                  ) {

            The branch is not entered when we remove spider_quick_page_byte=0 from the SET statement, in which case the test case passes. The reason it is not entered in that case is because page_size != roop_count (== 0). The code path towards page_size having value 0 is rather convoluted and poorly documented.

            The stack:

            0 in Create_tmp_table::start of /home/ycp/source/mariadb-server/10.5/src/sql/sql_select.cc:18953
            1 in create_tmp_table of /home/ycp/source/mariadb-server/10.5/src/sql/sql_select.cc:19794
            2 in spider_mk_sys_tmp_table_for_result of /home/ycp/source/mariadb-server/10.5/src/storage/spider/spd_sys_table.cc:3095
            3 in spider_db_store_result of /home/ycp/source/mariadb-server/10.5/src/storage/spider/spd_db_conn.cc:4004
            4 in spider_bg_conn_action of /home/ycp/source/mariadb-server/10.5/src/storage/spider/spd_conn.cc:2787
            5 in asan_thread_start of ../../../../src/libsanitizer/asan/asan_interceptors.cpp:234
            6 in start_thread of ./nptl/pthread_create.c:442
            7 in clone of ../sysdeps/unix/sysv/linux/x86_64/clone.S:100

            ycp Yuchen Pei added a comment - debug_assert_on_not_freed_memory is just a switch that allows auto assertion failure on nonzero status_var.local_memory_used . safemalloc warnings look like it could be a hint: Warning: 3624 bytes freed by T@4, allocated by T@9 at 0x5624a8732661, mysys/my_malloc.c:91, mysys/my_alloc.c:244, sql/sql_select.cc:18953, sql/sql_select.cc:19794, spider/spd_sys_table.cc:3095, spider/spd_db_conn.cc:4004, spider/spd_conn.cc:2787 which points to an if branch in spider_db_store_result() , called from a bg thread in spider_bg_conn_action() . The branch is entered if ( result_list->quick_mode == 3 && page_size == roop_count && result_list->limit_num > roop_count && row ) { The branch is not entered when we remove spider_quick_page_byte=0 from the SET statement, in which case the test case passes. The reason it is not entered in that case is because page_size != roop_count (== 0) . The code path towards page_size having value 0 is rather convoluted and poorly documented. The stack: 0 in Create_tmp_table::start of /home/ycp/source/mariadb-server/10.5/src/sql/sql_select.cc:18953 1 in create_tmp_table of /home/ycp/source/mariadb-server/10.5/src/sql/sql_select.cc:19794 2 in spider_mk_sys_tmp_table_for_result of /home/ycp/source/mariadb-server/10.5/src/storage/spider/spd_sys_table.cc:3095 3 in spider_db_store_result of /home/ycp/source/mariadb-server/10.5/src/storage/spider/spd_db_conn.cc:4004 4 in spider_bg_conn_action of /home/ycp/source/mariadb-server/10.5/src/storage/spider/spd_conn.cc:2787 5 in asan_thread_start of ../../../../src/libsanitizer/asan/asan_interceptors.cpp:234 6 in start_thread of ./nptl/pthread_create.c:442 7 in clone of ../sysdeps/unix/sysv/linux/x86_64/clone.S:100
            ycp Yuchen Pei added a comment - - edited

            I wonder whether this is a duplicate of MDEV-33197. Both the testcases and assertions look similar.

            ycp Yuchen Pei added a comment - - edited I wonder whether this is a duplicate of MDEV-33197 . Both the testcases and assertions look similar.
            ycp Yuchen Pei added a comment - - edited

            A simplified testcase to trigger the same assertion failure as in the description, tested at the current 10.5 1f306d395d00df158702d35b3338ccfe8663744e

            --disable_query_log
            --disable_result_log
            --source ../../t/test_init.inc
            --enable_result_log
            --enable_query_log
             
            evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
            OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
             
            CREATE TABLE t1 (c int);
            CREATE TABLE t1_s (c int)
            ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ;
            INSERT INTO t1 VALUES (42), (37);
            set spider_same_server_link= 1;
            set spider_quick_page_size= 1;
            set spider_bgs_mode= 1;
            SELECT * FROM t1_s;
             
            drop table t1_s, t1;
            drop server srv;
            --disable_query_log
            --disable_result_log
            --source ../../t/test_deinit.inc
            --enable_result_log
            --enable_query_log

            ycp Yuchen Pei added a comment - - edited A simplified testcase to trigger the same assertion failure as in the description, tested at the current 10.5 1f306d395d00df158702d35b3338ccfe8663744e --disable_query_log --disable_result_log --source ../../t/test_init.inc --enable_result_log --enable_query_log   evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK" , DATABASE 'test' , user 'root' );   CREATE TABLE t1 (c int ); CREATE TABLE t1_s (c int ) ENGINE=SPIDER COMMENT= 'wrapper "mariadb", srv "srv", table "t1"' ; INSERT INTO t1 VALUES (42), (37); set spider_same_server_link= 1; set spider_quick_page_size= 1; set spider_bgs_mode= 1; SELECT * FROM t1_s;   drop table t1_s, t1; drop server srv; --disable_query_log --disable_result_log --source ../../t/test_deinit.inc --enable_result_log --enable_query_log
            Roel Roel Van de Paar added a comment - - edited

            Additional testcase:

            INSTALL PLUGIN Spider SONAME 'ha_spider.so';
            CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET '../socket.sock',DATABASE'',USER'',PASSWORD'');
            CREATE TABLE t (c INT PRIMARY KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
            INSERT INTO t VALUES (1,'',''),(2,0,'');
            CREATE TABLE t2 (c INT PRIMARY KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"';
            SET spider_bgs_mode=1;
            SET SESSION spider_quick_page_byte=0;
            ANALYZE TABLE t2 PERSISTENT FOR ALL;
            

            Leads to a very different assertion:

            CS 11.8.0 cacaaebf01939d387645fb850ceeec5392496171 (Debug, UBASAN, Clang) Build 17/01/2025

            mariadbd: /test/11.8_dbg_san/storage/spider/spd_db_conn.cc:649: int spider_db_errorno(SPIDER_CONN *): Assertion `((&(&conn->mta_conn_mutex)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&conn->mta_conn_mutex)->m_mutex)->thread))' failed.
            

            CS 11.8.0 cacaaebf01939d387645fb850ceeec5392496171 (Debug, UBASAN, Clang) Build 17/01/2025

            Core was generated by `/test/UBASAN_MD170125-mariadb-11.8.0-linux-x86_64-dbg/bin/mariadbd --no-default'.
            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 2038982)]
            (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  0x000014df13c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
            #4  0x000014df13c288ff in __GI_abort () at ./stdlib/abort.c:79
            #5  0x000014df13c2881b in __assert_fail_base (fmt=0x14df13dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x564b57a5ace0 <str> "thd->status_var.tmp_space_used >= track->previous_file_size", file=file@entry=0x564b57a4b908 "/test/11.8_dbg_san/sql/mysqld.cc", line=line@entry=3811, function=function@entry=0x564b57a5ac80 <__PRETTY_FUNCTION__._ZL22temp_file_size_cb_funcP17tmp_file_trackingi> "int temp_file_size_cb_func(struct tmp_file_tracking *, int)") at ./assert/assert.c:94
            #6  0x000014df13c3b507 in __assert_fail (assertion=0x564b57a5ace0 <str> "thd->status_var.tmp_space_used >= track->previous_file_size", file=0x564b57a4b908 "/test/11.8_dbg_san/sql/mysqld.cc", line=3811, function=0x564b57a5ac80 <__PRETTY_FUNCTION__._ZL22temp_file_size_cb_funcP17tmp_file_trackingi> "int temp_file_size_cb_func(struct tmp_file_tracking *, int)") at ./assert/assert.c:103
            #7  0x0000564b5443b3fe in temp_file_size_cb_func (track=0x14dee25c74a0, no_error=no_error@entry=0) at /test/11.8_dbg_san/sql/mysqld.cc:3811
            #8  0x0000564b5620eac6 in _ma_update_tmp_file_size (track=<optimized out>, file_size=<optimized out>)at /test/11.8_dbg_san/storage/maria/ma_info.c:233
            #9  0x0000564b562692ba in ha_maria::drop_table (this=0x52d0006736c8, name=<optimized out>) at /test/11.8_dbg_san/storage/maria/ha_maria.cc:2887
            #10 0x0000564b54bc5703 in free_tmp_table (thd=<optimized out>, entry=0x52d000672438) at /test/11.8_dbg_san/sql/sql_select.cc:23351
            #11 0x000014dee1e649c6 in spider_rm_sys_tmp_table_for_result (thd=0x1f1cad, tmp_table=0x1f1cc6, tmp_tbl_prm=0x6, tmp_tbl_prm@entry=0x5120000d8fb0)at /test/11.8_dbg_san/storage/spider/spd_sys_table.cc:3153
            #12 0x000014dee1ec97d3 in spider_db_free_one_result (result_list=0x5250007cdf58, result=0x5120000d8f68)at /test/11.8_dbg_san/storage/spider/spd_db_conn.cc:2787
            #13 0x000014dee1ed40b7 in spider_db_seek_next (buf=0x5250007ce500 "\377\002", spider=0x5250007cd948, link_idx=<optimized out>, table=0x5190000c7b98)at /test/11.8_dbg_san/storage/spider/spd_db_conn.cc:3959
            #14 0x000014dee20ac245 in ha_spider::rnd_next_internal (this=0x5250007cd948, buf=<optimized out>) at /test/11.8_dbg_san/storage/spider/ha_spider.cc:4394
            #15 0x0000564b55876fe1 in handler::ha_rnd_next (this=0x5250007cd948, buf=<optimized out>) at /test/11.8_dbg_san/sql/handler.cc:3743
            #16 0x0000564b54d9574f in collect_statistics_for_table (thd=<optimized out>, table=0x5190000c7b98) at /test/11.8_dbg_san/sql/sql_statistics.cc:2798
            #17 0x0000564b550eeb18 in mysql_admin_table (thd=<optimized out>, tables=<optimized out>, check_opt=<optimized out>, operator_name=<optimized out>, lock_type=<optimized out>, org_open_for_modify=true, no_errors_from_open=<optimized out>, extra_open_options=<optimized out>, prepare_func=<optimized out>, operator_func=(int (handler::*)(class handler * const, class THD *, HA_CHECK_OPT *)) 0x564b55895590 <handler::ha_analyze(THD*, st_ha_check_opt*)>, view_operator_func=<optimized out>, is_cmd_replicated=<optimized out>)at /test/11.8_dbg_san/sql/sql_admin.cc:1092
            #18 0x0000564b550f1579 in Sql_cmd_analyze_table::execute (this=<optimized out>, thd=0x52b000165218)at /test/11.8_dbg_san/sql/sql_admin.cc:1619
            #19 0x0000564b549f7687 in mysql_execute_command (thd=0x52b000165218, is_called_from_prepared_stmt=<optimized out>)at /test/11.8_dbg_san/sql/sql_parse.cc:5886
            #20 0x0000564b549d6589 in mysql_parse (thd=thd@entry=0x52b000165218, rawbuf=rawbuf@entry=0x52d0003c0438 "ANALYZE TABLE t2 PERSISTENT FOR ALL", length=<optimized out>, parser_state=parser_state@entry=0x14dee2b198a0)at /test/11.8_dbg_san/sql/sql_parse.cc:7915
            #21 0x0000564b549ca64c in dispatch_command (command=<optimized out>, thd=0x52b000165218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/11.8_dbg_san/sql/sql_parse.cc:1903
            #22 0x0000564b549d8fae in do_command (thd=thd@entry=0x52b000165218, blocking=true) at /test/11.8_dbg_san/sql/sql_parse.cc:1416
            #23 0x0000564b5509c76d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x508000002fb8, put_in_cache=true)at /test/11.8_dbg_san/sql/sql_connect.cc:1415
            #24 0x0000564b5509c028 in handle_one_connection (arg=0x508000002fb8)at /test/11.8_dbg_san/sql/sql_connect.cc:1327
            #25 0x0000564b543dbb5d in asan_thread_start(void*) ()
            #26 0x000014df13c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
            #27 0x000014df13d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
            

            This testcase is also discussed here in connection with the spider_db_get_row_from_tmp_tbl UBSAN error it produces.

            Roel Roel Van de Paar added a comment - - edited Additional testcase: INSTALL PLUGIN Spider SONAME 'ha_spider.so' ; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET '../socket.sock' , DATABASE '' , USER '' , PASSWORD '' ); CREATE TABLE t (c INT PRIMARY KEY ,c1 BLOB,c2 TEXT) ENGINE=InnoDB; INSERT INTO t VALUES (1, '' , '' ),(2,0, '' ); CREATE TABLE t2 (c INT PRIMARY KEY ,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT= 'WRAPPER "mysql",SRV "srv",TABLE "t"' ; SET spider_bgs_mode=1; SET SESSION spider_quick_page_byte=0; ANALYZE TABLE t2 PERSISTENT FOR ALL ; Leads to a very different assertion: CS 11.8.0 cacaaebf01939d387645fb850ceeec5392496171 (Debug, UBASAN, Clang) Build 17/01/2025 mariadbd: /test/11.8_dbg_san/storage/spider/spd_db_conn.cc:649: int spider_db_errorno(SPIDER_CONN *): Assertion `((&(&conn->mta_conn_mutex)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&conn->mta_conn_mutex)->m_mutex)->thread))' failed. CS 11.8.0 cacaaebf01939d387645fb850ceeec5392496171 (Debug, UBASAN, Clang) Build 17/01/2025 Core was generated by `/test/UBASAN_MD170125-mariadb-11.8.0-linux-x86_64-dbg/bin/mariadbd --no-default'. 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 2038982)] (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 0x000014df13c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26 #4 0x000014df13c288ff in __GI_abort () at ./stdlib/abort.c:79 #5 0x000014df13c2881b in __assert_fail_base (fmt=0x14df13dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x564b57a5ace0 <str> "thd->status_var.tmp_space_used >= track->previous_file_size", file=file@entry=0x564b57a4b908 "/test/11.8_dbg_san/sql/mysqld.cc", line=line@entry=3811, function=function@entry=0x564b57a5ac80 <__PRETTY_FUNCTION__._ZL22temp_file_size_cb_funcP17tmp_file_trackingi> "int temp_file_size_cb_func(struct tmp_file_tracking *, int)") at ./assert/assert.c:94 #6 0x000014df13c3b507 in __assert_fail (assertion=0x564b57a5ace0 <str> "thd->status_var.tmp_space_used >= track->previous_file_size", file=0x564b57a4b908 "/test/11.8_dbg_san/sql/mysqld.cc", line=3811, function=0x564b57a5ac80 <__PRETTY_FUNCTION__._ZL22temp_file_size_cb_funcP17tmp_file_trackingi> "int temp_file_size_cb_func(struct tmp_file_tracking *, int)") at ./assert/assert.c:103 #7 0x0000564b5443b3fe in temp_file_size_cb_func (track=0x14dee25c74a0, no_error=no_error@entry=0) at /test/11.8_dbg_san/sql/mysqld.cc:3811 #8 0x0000564b5620eac6 in _ma_update_tmp_file_size (track=<optimized out>, file_size=<optimized out>)at /test/11.8_dbg_san/storage/maria/ma_info.c:233 #9 0x0000564b562692ba in ha_maria::drop_table (this=0x52d0006736c8, name=<optimized out>) at /test/11.8_dbg_san/storage/maria/ha_maria.cc:2887 #10 0x0000564b54bc5703 in free_tmp_table (thd=<optimized out>, entry=0x52d000672438) at /test/11.8_dbg_san/sql/sql_select.cc:23351 #11 0x000014dee1e649c6 in spider_rm_sys_tmp_table_for_result (thd=0x1f1cad, tmp_table=0x1f1cc6, tmp_tbl_prm=0x6, tmp_tbl_prm@entry=0x5120000d8fb0)at /test/11.8_dbg_san/storage/spider/spd_sys_table.cc:3153 #12 0x000014dee1ec97d3 in spider_db_free_one_result (result_list=0x5250007cdf58, result=0x5120000d8f68)at /test/11.8_dbg_san/storage/spider/spd_db_conn.cc:2787 #13 0x000014dee1ed40b7 in spider_db_seek_next (buf=0x5250007ce500 "\377\002", spider=0x5250007cd948, link_idx=<optimized out>, table=0x5190000c7b98)at /test/11.8_dbg_san/storage/spider/spd_db_conn.cc:3959 #14 0x000014dee20ac245 in ha_spider::rnd_next_internal (this=0x5250007cd948, buf=<optimized out>) at /test/11.8_dbg_san/storage/spider/ha_spider.cc:4394 #15 0x0000564b55876fe1 in handler::ha_rnd_next (this=0x5250007cd948, buf=<optimized out>) at /test/11.8_dbg_san/sql/handler.cc:3743 #16 0x0000564b54d9574f in collect_statistics_for_table (thd=<optimized out>, table=0x5190000c7b98) at /test/11.8_dbg_san/sql/sql_statistics.cc:2798 #17 0x0000564b550eeb18 in mysql_admin_table (thd=<optimized out>, tables=<optimized out>, check_opt=<optimized out>, operator_name=<optimized out>, lock_type=<optimized out>, org_open_for_modify=true, no_errors_from_open=<optimized out>, extra_open_options=<optimized out>, prepare_func=<optimized out>, operator_func=(int (handler::*)(class handler * const, class THD *, HA_CHECK_OPT *)) 0x564b55895590 <handler::ha_analyze(THD*, st_ha_check_opt*)>, view_operator_func=<optimized out>, is_cmd_replicated=<optimized out>)at /test/11.8_dbg_san/sql/sql_admin.cc:1092 #18 0x0000564b550f1579 in Sql_cmd_analyze_table::execute (this=<optimized out>, thd=0x52b000165218)at /test/11.8_dbg_san/sql/sql_admin.cc:1619 #19 0x0000564b549f7687 in mysql_execute_command (thd=0x52b000165218, is_called_from_prepared_stmt=<optimized out>)at /test/11.8_dbg_san/sql/sql_parse.cc:5886 #20 0x0000564b549d6589 in mysql_parse (thd=thd@entry=0x52b000165218, rawbuf=rawbuf@entry=0x52d0003c0438 "ANALYZE TABLE t2 PERSISTENT FOR ALL", length=<optimized out>, parser_state=parser_state@entry=0x14dee2b198a0)at /test/11.8_dbg_san/sql/sql_parse.cc:7915 #21 0x0000564b549ca64c in dispatch_command (command=<optimized out>, thd=0x52b000165218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/11.8_dbg_san/sql/sql_parse.cc:1903 #22 0x0000564b549d8fae in do_command (thd=thd@entry=0x52b000165218, blocking=true) at /test/11.8_dbg_san/sql/sql_parse.cc:1416 #23 0x0000564b5509c76d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x508000002fb8, put_in_cache=true)at /test/11.8_dbg_san/sql/sql_connect.cc:1415 #24 0x0000564b5509c028 in handle_one_connection (arg=0x508000002fb8)at /test/11.8_dbg_san/sql/sql_connect.cc:1327 #25 0x0000564b543dbb5d in asan_thread_start(void*) () #26 0x000014df13c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447 #27 0x000014df13d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 This testcase is also discussed here in connection with the spider_db_get_row_from_tmp_tbl UBSAN error it produces.

            People

              ycp Yuchen Pei
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.