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

void buf_page_t::init(uint32_t, page_id_t): Assertion `!lock.is_locked_or_waiting()' failed

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
        CREATE TABLE t1 (
        id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
        pt POINT NOT NULL,
        SPATIAL INDEX(pt)
        ) ENGINE=InnoDB;
        delimiter $$;
        CREATE PROCEDURE p1(IN imax INT)
        BEGIN
          DECLARE i INT DEFAULT 0;
          DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
          SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
          SET SESSION autocommit = 0;
          WHILE i < imax DO
            INSERT INTO t1 (pt) VALUES (ST_GeomFromText(CONCAT('POINT(', FLOOR(RAND() * 10), ' ', FLOOR(RAND() * 10), ')')));
            SELECT id, ST_AsText(pt) FROM t1 WHERE ST_Within(pt, ST_GeomFromText('POLYGON((0 0, 100 0, 100 100, 0 100, 0 0))')) LIMIT 3;
            IF i MOD 5 = 4 THEN
              ROLLBACK;
            END IF;
            SET i = i + 1;
          END WHILE;
          ROLLBACK;
        END$$
        delimiter ;$$
        --connect (con1,localhost,root,,test)
        --connect (con2,localhost,root,,test)
        --connection con1
        --disable_result_log
        --send CALL p1(20000)
        --connection con2
        --disable_result_log
        --send CALL p1(20000)
        --connection con1
        --reap
        --enable_result_log
        --connection con2
        --reap
        --enable_result_log
        --connection default
        --disconnect con1
        --disconnect con2
        DROP PROCEDURE p1;
        DROP TABLE t1;
      

      Leads to:

      ES 10.6.28-24 07b87fa33b7263c3b46b1a820474f88803d25a04 (Debug, Clang 22.1.8-20260622) Build 07/07/2026

      mariadbd: /test/10.6-es_dbg/storage/innobase/include/buf0buf.h:627: void buf_page_t::init(uint32_t, page_id_t): Assertion `!lock.is_locked_or_waiting()' failed.
      

      ES 10.6.28-24 07b87fa33b7263c3b46b1a820474f88803d25a04 (Debug, Clang 22.1.8-20260622) Build 07/07/2026

      Core was generated by `/test/EMD070726-mariadb-10.6.28-24-linux-x86_64-dbg/bin/mariadbd --defaults-gro'.
      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 1093362)]
      (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  0x00007d1c8bc4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007d1c8bc288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007d1c8bc2881b in __assert_fail_base (fmt=0x7d1c8bdd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5fbc1b1328c8 "!lock.is_locked_or_waiting()", file=file@entry=0x5fbc1b1058e5 "/test/10.6-es_dbg/storage/innobase/include/buf0buf.h", line=line@entry=627, function=function@entry=0x5fbc1b13289d "void buf_page_t::init(uint32_t, page_id_t)") at ./assert/assert.c:96
      #6  0x00007d1c8bc3b517 in __assert_fail (assertion=0x5fbc1b1328c8 "!lock.is_locked_or_waiting()", file=0x5fbc1b1058e5 "/test/10.6-es_dbg/storage/innobase/include/buf0buf.h", line=627, function=0x5fbc1b13289d "void buf_page_t::init(uint32_t, page_id_t)")at ./assert/assert.c:105
      #7  0x00005fbc1ac00905 in buf_page_t::init (this=0x751c6400f630, state=1, id={m_id = 21474836484}) at include/buf0buf.h:627
      #8  0x00005fbc1ae5a8af in rtr_init_match (matches=0x751b8c050d90, block=0x751c6400f560, page=0x751c644d4000 "")at /test/10.6-es_dbg/storage/innobase/gis/gis0sea.cc:1880
      #9  0x00005fbc1ae571d6 in rtr_cur_search_with_match (block=0x751c6400f560, index=0x751b980aa460, tuple=0x751b8c04c0b0, mode=PAGE_CUR_CONTAIN, cursor=0x751b8c04bf20, rtr_info=0x751b8c050c70)at /test/10.6-es_dbg/storage/innobase/gis/gis0sea.cc:2217
      #10 0x00005fbc1ac7554e in sel_set_rtr_rec_lock (pcur=0x751b8c04bf20, first_rec=0x751c644d80a8 "", index=0x751b980aa460, offsets=0x7d1c8a5242e0, mode=2, type=1024, thr=0x751b8c04c6a0, mtr=0x7d1c8a524c30)at /test/10.6-es_dbg/storage/innobase/row/row0sel.cc:1251
      #11 0x00005fbc1ac6c06d in sel_set_rec_lock (pcur=0x751b8c04bf20, rec=0x751c644d80a8 "", index=0x751b980aa460, offsets=0x7d1c8a5242e0, mode=2, type=1024, thr=0x751b8c04c6a0, mtr=0x7d1c8a524c30)at /test/10.6-es_dbg/storage/innobase/row/row0sel.cc:1367
      #12 0x00005fbc1ac67ec0 in row_search_mvcc (buf=0x751b8c04a4c8 "", mode=PAGE_CUR_CONTAIN, prebuilt=0x751b8c04bd50, match_mode=0, direction=0)at /test/10.6-es_dbg/storage/innobase/row/row0sel.cc:5246
      #13 0x00005fbc1aa641aa in ha_innobase::index_read (this=0x751b8c049cc8, buf=0x751b8c04a4c8 "", key_ptr=0x751b8c0535e0 "", key_len=34, find_flag=HA_READ_MBR_CONTAIN)at /test/10.6-es_dbg/storage/innobase/handler/ha_innodb.cc:9008
      #14 0x00005fbc1a5dd36a in handler::index_read_map (this=0x751b8c049cc8, buf=0x751b8c04a4c8 "", key=0x751b8c0535e0 "", keypart_map=1, find_flag=HA_READ_MBR_CONTAIN) at /test/10.6-es_dbg/sql/handler.h:3992
      #15 0x00005fbc1a6bad5f in handler::ha_index_read_map (this=0x751b8c049cc8, buf=0x751b8c04a4c8 "", key=0x751b8c0535e0 "", keypart_map=1, find_flag=HA_READ_MBR_CONTAIN) at /test/10.6-es_dbg/sql/handler.cc:3661
      #16 0x00005fbc1a8724ee in QUICK_RANGE_SELECT_GEOM::get_next (this=0x751b8c050b10) at /test/10.6-es_dbg/sql/opt_range.cc:13005
      #17 0x00005fbc1a88989d in rr_quick (info=0x751b8c054608)at /test/10.6-es_dbg/sql/records.cc:403
      #18 0x00005fbc1a27b546 in READ_RECORD::read_record (this=0x751b8c054608)at /test/10.6-es_dbg/sql/records.h:81
      #19 0x00005fbc1a39fbd2 in join_init_read_record (tab=0x751b8c054530)at /test/10.6-es_dbg/sql/sql_select.cc:23524
      #20 0x00005fbc1a38058a in sub_select (join=0x751b8c0426b0, join_tab=0x751b8c054530, end_of_records=false)at /test/10.6-es_dbg/sql/sql_select.cc:22488
      #21 0x00005fbc1a3a2ad8 in do_select (join=0x751b8c0426b0, procedure=0x0)at /test/10.6-es_dbg/sql/sql_select.cc:22014
      #22 0x00005fbc1a3a1f5d in JOIN::exec_inner (this=0x751b8c0426b0)at /test/10.6-es_dbg/sql/sql_select.cc:4969
      #23 0x00005fbc1a3a1049 in JOIN::exec (this=0x751b8c0426b0)at /test/10.6-es_dbg/sql/sql_select.cc:4747
      #24 0x00005fbc1a380e09 in mysql_select (thd=0x751b8c000d58, tables=0x751b8c033ef8, fields=@0x751b8c02fbf0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x751b8c02fe08, last = 0x751b8c033e80, elements = 2}, <No data fields>}, conds=0x751b8c034b18, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2148273664, result=0x751b8c042688, unit=0x751b8c031f88, select_lex=0x751b8c02f918)at /test/10.6-es_dbg/sql/sql_select.cc:5283
      #25 0x00005fbc1a38091d in handle_select (thd=0x751b8c000d58, lex=0x751b8c031ec0, result=0x751b8c042688, setup_tables_done_option=0)at /test/10.6-es_dbg/sql/sql_select.cc:575
      #26 0x00005fbc1a331e91 in execute_sqlcom_select (thd=0x751b8c000d58, all_tables=0x751b8c033ef8) at /test/10.6-es_dbg/sql/sql_parse.cc:6449
      #27 0x00005fbc1a32711a in mysql_execute_command (thd=0x751b8c000d58, is_called_from_prepared_stmt=false)at /test/10.6-es_dbg/sql/sql_parse.cc:4029
      #28 0x00005fbc1a238057 in sp_instr_stmt::exec_core (this=0x751b8c035650, thd=0x751b8c000d58, nextp=0x7d1c8a527748)at /test/10.6-es_dbg/sql/sp_head.cc:3898
      #29 0x00005fbc1a236bbb in sp_lex_keeper::reset_lex_and_exec_core (this=0x751b8c035698, thd=0x751b8c000d58, nextp=0x7d1c8a527748, open_tables=false, instr=0x751b8c035650)at /test/10.6-es_dbg/sql/sp_head.cc:3609
      #30 0x00005fbc1a237410 in sp_instr_stmt::execute (this=0x751b8c035650, thd=0x751b8c000d58, nextp=0x7d1c8a527748)at /test/10.6-es_dbg/sql/sp_head.cc:3801
      #31 0x00005fbc1a22f850 in sp_head::execute (this=0x751b8c01cac0, thd=0x751b8c000d58, merge_da_on_success=true)at /test/10.6-es_dbg/sql/sp_head.cc:1443
      #32 0x00005fbc1a232185 in sp_head::execute_procedure (this=0x751b8c01cac0, thd=0x751b8c000d58, args=0x751b8c005eb0)at /test/10.6-es_dbg/sql/sp_head.cc:2523
      #33 0x00005fbc1a324730 in do_execute_sp (thd=0x751b8c000d58, sp=0x751b8c01cac0)at /test/10.6-es_dbg/sql/sql_parse.cc:3105
      #34 0x00005fbc1a3242c1 in Sql_cmd_call::execute (this=0x751b8c013270, thd=0x751b8c000d58) at /test/10.6-es_dbg/sql/sql_parse.cc:3351
      #35 0x00005fbc1a330059 in mysql_execute_command (thd=0x751b8c000d58, is_called_from_prepared_stmt=false)at /test/10.6-es_dbg/sql/sql_parse.cc:6174
      #36 0x00005fbc1a31f948 in mysql_parse (thd=0x751b8c000d58, rawbuf=0x751b8c0131c0 "CALL p1(20000)", length=14, parser_state=0x7d1c8a529a28) at /test/10.6-es_dbg/sql/sql_parse.cc:8228
      #37 0x00005fbc1a31d141 in dispatch_command (command=COM_QUERY, thd=0x751b8c000d58, packet=0x751b8c00aed9 "", packet_length=14, blocking=true) at /test/10.6-es_dbg/sql/sql_parse.cc:1918
      #38 0x00005fbc1a3203ef in do_command (thd=0x751b8c000d58, blocking=true)at /test/10.6-es_dbg/sql/sql_parse.cc:1428
      #39 0x00005fbc1a4ce6be in do_handle_one_connection (connect=0x5fbc4d1328d8, put_in_cache=true) at /test/10.6-es_dbg/sql/sql_connect.cc:1393
      #40 0x00005fbc1a4ce4a5 in handle_one_connection (arg=0x5fbc4d1328d8)at /test/10.6-es_dbg/sql/sql_connect.cc:1305
      #41 0x00007d1c8bc9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #42 0x00007d1c8bd29c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  070726  736edbe77ce5db44ea38347280f77d6a304fa3ae  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  10.6   opt  070726  736edbe77ce5db44ea38347280f77d6a304fa3ae  No bug found                  
      CS  10.11  dbg  070726  d12f950d5d961bb4eb2dee20997765bbacc2d222  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  10.11  opt  070726  d12f950d5d961bb4eb2dee20997765bbacc2d222  No bug found                  
      CS  11.4   dbg  070726  176589bf19ea6e2261bb3ef57886c13b9c0b6759  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  11.4   opt  070726  176589bf19ea6e2261bb3ef57886c13b9c0b6759  No bug found                  
      CS  11.8   dbg  070726  666b2aca09cb84d59b4ece2185a9200d745cb287  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  11.8   opt  070726  666b2aca09cb84d59b4ece2185a9200d745cb287  No bug found                  
      CS  12.3   dbg  070726  8da34620ac3935814cc7f9ba30bb51a6e2070237  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  12.3   opt  070726  8da34620ac3935814cc7f9ba30bb51a6e2070237  No bug found                  
      CS  13.0   dbg  070726  172609526b93ac278203607274b70e6b6d8e67fd  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  13.0   opt  070726  172609526b93ac278203607274b70e6b6d8e67fd  No bug found                  
      CS  13.1   dbg  080726  fd8cec54af7a9d79749df25ea70dac695b371641  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      CS  13.1   opt  080726  fd8cec54af7a9d79749df25ea70dac695b371641  No bug found                  
      ES  10.6   dbg  070726  07b87fa33b7263c3b46b1a820474f88803d25a04  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      ES  10.6   opt  070726  07b87fa33b7263c3b46b1a820474f88803d25a04  No bug found                  
      ES  11.4   dbg  070726  89bb238190d313ead3b68e508099974e3728515e  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      ES  11.4   opt  070726  89bb238190d313ead3b68e508099974e3728515e  No bug found                  
      ES  11.8   dbg  070726  97386db1d887891fb17e5210536bfe8756bae3cf  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      ES  11.8   opt  070726  97386db1d887891fb17e5210536bfe8756bae3cf  No bug found                  
      ES  12.3   dbg  070726  b96de078339ebc1995fd6185bf5433c72fedbdaf  !lock.is_locked_or_waiting()|SIGABRT|buf_page_t::init|rtr_init_match|rtr_cur_search_with_match|sel_set_rtr_rec_lock
      ES  12.3   opt  070726  b96de078339ebc1995fd6185bf5433c72fedbdaf  No bug found                  
      

      Attachments

        Activity

          People

            tafzeel Mohammad Tafzeel Shams
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1.5h
                1.5h

                Git Integration

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