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

Assertion `mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)' failed in btr_block_reget

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      # mysqld options required for replay:  --sql_mode=
      SET NAMES latin1;
      CREATE TABLE t (a INT KEY,c CHAR,INDEX sec_index (c));
      INSERT INTO t VALUES (1,'İóëɠ');
      SET GLOBAL innodb_limit_optimistic_insert_debug=2;
      INSERT INTO t VALUES (0,0);
      INSERT INTO t VALUES ('24:00:00','24:00:');
      DELETE FROM t LIMIT 3;
      INSERT INTO t SET a=1;
      SET GLOBAL innodb_limit_optimistic_insert_debug=0;
      DELETE FROM t LIMIT 2;
      INSERT INTO t VALUES (1,'a');
      

      Leads to:

      CS 11.8.3 c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f (Debug) Build 17/06/2025

      mariadbd: /test/11.8_dbg/storage/innobase/btr/btr0btr.cc:541: buf_block_t *btr_block_reget(mtr_t *, const dict_index_t &, const page_id_t, dberr_t *): Assertion `mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)' failed.
      

      CS 11.8.3 c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f (Debug) Build 17/06/2025

      Core was generated by `/test/MD170625-mariadb-11.8.3-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 1319926)]
      (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  0x0000715a31c4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000715a31c288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000715a31c2881b in __assert_fail_base (fmt=0x715a31dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x63b817bf57f9 "mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)", file=file@entry=0x63b817bf25cc "/test/11.8_dbg/storage/innobase/btr/btr0btr.cc", line=line@entry=541, function=function@entry=0x63b817bf5832 "buf_block_t *btr_block_reget(mtr_t *, const dict_index_t &, const page_id_t, dberr_t *)") at ./assert/assert.c:96
      #6  0x0000715a31c3b517 in __assert_fail (assertion=0x63b817bf57f9 "mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)", file=0x63b817bf25cc "/test/11.8_dbg/storage/innobase/btr/btr0btr.cc", line=541, function=0x63b817bf5832 "buf_block_t *btr_block_reget(mtr_t *, const dict_index_t &, const page_id_t, dberr_t *)") at ./assert/assert.c:105
      #7  0x000063b817593820 in btr_block_reget (mtr=0x715a300b6e18, index=@0x71592402c208: {static MAX_N_FIELDS = 1023, id = 24, heap = 0x71592402c420, name = {m_name = 0x71592402c338 "sec_index"}, table = 0x715924029e08, page = 4, merge_threshold = 50, type = 0, trx_id_offset = 0, n_user_defined_cols = 1, n_uniq = 2, n_def = 2, n_fields = 2, n_nullable = 1, n_core_fields = 2, n_core_null_bytes = 1, static NO_CORE_NULL_BYTES = 255, static DICT_INDEXES_ID = 3, cached = 1, to_be_dropped = 0, online_status = 0, uncommitted = 0, is_dummy = false, in_instant_init = false, magic_n = 76789786, fields = 0x71592402c348, parser = 0x0, new_vcol_info = 0x0, change_col_info = 0x0, indexes = {prev = 0x71592402a7d8, next = 0x0}, search_info = {root_guess = 0x7159fc00e4c0, static HASH_ANALYSIS = 16 '\020', hash_analysis = {m = std::atomic<unsigned char> = { 0 '\000' }}, n_hash_potential = {m = std::atomic<unsigned char> = { 0 '\000' }}, last_hash_succ = {m = std::atomic<bool> = { false }}, left_bytes_fields = {m = std::atomic<unsigned int> = { 0 }}, ref_count = {m_counter = std::atomic<unsigned long> = { 0 }}}, online_log = 0x0, stat_n_diff_key_vals = 0x71592402c398, stat_n_sample_sizes = 0x71592402c3a8, stat_n_non_null_key_vals = 0x71592402c3b8, stat_index_size = 1, stat_n_leaf_pages = 1, rtr_ssn = {m = std::atomic<unsigned int> = { 0 }}, rtr_track = 0x0, trx_id = 16, zip_pad = {mutex = {<std::__mutex_base> = {_M_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, <No data fields>}, pad = {m = std::atomic<unsigned long> = { 0 }}, success = 0, failure = 0, n_rounds = 0}, lock = {lock = {writer = {lock = std::atomic<unsigned int> = { 3 }, static HOLDER = 1, static WAITER = 2}, readers = std::atomic<unsigned int> = { 0 }, static WRITER = 2147483648}, recursive = 65536, writer = std::atomic<unsigned long> = { 124632167069376 }, static FOR_IO = 18446744073709551615, readers_lock = {lock = std::atomic<unsigned int> = { 0 }, static HOLDER = 1, static WAITER = 2}, readers = std::atomic<class std::unordered_multiset<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long> > *> = { 0x715924077970 }, static RECURSIVE_X = 1, static RECURSIVE_U = 65536, static RECURSIVE_MAX = 65535}}, id={m_id = 34359738378}, err=0x715a300b5990)at /test/11.8_dbg/storage/innobase/btr/btr0btr.cc:541
      #8  0x000063b817592ec3 in btr_discard_page (cursor=0x715a300b6158, mtr=0x715a300b6e18) at /test/11.8_dbg/storage/innobase/btr/btr0btr.cc:4106
      #9  0x000063b8175c3784 in btr_cur_pessimistic_delete (err=0x715a300b5e2c, has_reserved_extents=1, cursor=0x715a300b6158, flags=16, rollback=false, mtr=0x715a300b6e18) at /test/11.8_dbg/storage/innobase/btr/btr0cur.cc:4629
      #10 0x000063b8175c45f5 in btr_cur_node_ptr_delete (parent=0x715a300b6158, mtr=0x715a300b6e18) at /test/11.8_dbg/storage/innobase/btr/btr0cur.cc:4774
      #11 0x000063b817591924 in btr_compress (cursor=0x715a300b6d98, adjust=false, mtr=0x715a300b6e18) at /test/11.8_dbg/storage/innobase/btr/btr0btr.cc:3749
      #12 0x000063b8175c0a00 in btr_cur_compress_if_useful (cursor=0x715a300b6d98, adjust=false, mtr=0x715a300b6e18)at /test/11.8_dbg/storage/innobase/btr/btr0cur.cc:4303
      #13 0x000063b8175bfc6b in btr_cur_pessimistic_update (flags=4, cursor=0x715a300b6d98, offsets=0x715a300b6b28, offsets_heap=0x715a300b6840, entry_heap=0x71592407b5b0, big_rec=0x715a300b6830, update=0x71592407b628, cmpl_info=0, thr=0x7159240312d0, trx_id=34, mtr=0x715a300b6e18)at /test/11.8_dbg/storage/innobase/btr/btr0cur.cc:4033
      #14 0x000063b81747392c in row_ins_sec_index_entry_by_modify (flags=0, mode=74, cursor=0x715a300b6d98, offsets=0x715a300b6b28, offsets_heap=0x71592407adf0, heap=0x71592407b5b0, entry=0x71592402bd18, thr=0x7159240312d0, mtr=0x715a300b6e18)at /test/11.8_dbg/storage/innobase/row/row0ins.cc:250
      #15 0x000063b8174726ec in row_ins_sec_index_entry_low (flags=0, mode=BTR_INSERT_TREE, index=0x71592402c208, offsets_heap=0x71592407adf0, heap=0x71592407b5b0, entry=0x71592402bd18, trx_id=0, thr=0x7159240312d0)at /test/11.8_dbg/storage/innobase/row/row0ins.cc:3184
      #16 0x000063b817474563 in row_ins_sec_index_entry (index=0x71592402c208, entry=0x71592402bd18, thr=0x7159240312d0, check_foreign=true)at /test/11.8_dbg/storage/innobase/row/row0ins.cc:3404
      #17 0x000063b81747c90e in row_ins_index_entry (index=0x71592402c208, entry=0x71592402bd18, thr=0x7159240312d0)at /test/11.8_dbg/storage/innobase/row/row0ins.cc:3457
      #18 0x000063b81747ba3e in row_ins_index_entry_step (node=0x7159240310b0, thr=0x7159240312d0) at /test/11.8_dbg/storage/innobase/row/row0ins.cc:3621
      #19 0x000063b817474fb2 in row_ins (node=0x7159240310b0, thr=0x7159240312d0)at /test/11.8_dbg/storage/innobase/row/row0ins.cc:3738
      #20 0x000063b817474c00 in row_ins_step (thr=0x7159240312d0)at /test/11.8_dbg/storage/innobase/row/row0ins.cc:3867
      #21 0x000063b8174a107c in row_insert_for_mysql (mysql_rec=0x71592402f490 "\375\001", prebuilt=0x715924030c78, ins_mode=ROW_INS_NORMAL)at /test/11.8_dbg/storage/innobase/row/row0mysql.cc:1299
      #22 0x000063b81729e4f5 in ha_innobase::write_row (this=0x71592402ec38, record=0x71592402f490 "\375\001")at /test/11.8_dbg/storage/innobase/handler/ha_innodb.cc:7781
      #23 0x000063b816ecbaee in handler::ha_write_row (this=0x71592402ec38, buf=0x71592402f490 "\375\001") at /test/11.8_dbg/sql/handler.cc:8221
      #24 0x000063b816a42067 in write_record (thd=0x715924000d58, table=0x715924028c48, info=0x715a300b80b0, sink=0x0)at /test/11.8_dbg/sql/sql_insert.cc:2415
      #25 0x000063b816a3e4c4 in mysql_insert (thd=0x715924000d58, table_list=0x715924019e08, fields=@0x715924005fe0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x63b8186828b0 <end_of_list>, last = 0x715924005fe0, elements = 0}, <No data fields>}, values_list=@0x715924006028: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x71592401ab40, last = 0x71592401ab40, elements = 1}, <No data fields>}, update_fields=@0x715924006010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x63b8186828b0 <end_of_list>, last = 0x715924006010, elements = 0}, <No data fields>}, update_values=@0x715924005ff8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x63b8186828b0 <end_of_list>, last = 0x715924005ff8, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0)at /test/11.8_dbg/sql/sql_insert.cc:1212
      #26 0x000063b816a9e002 in mysql_execute_command (thd=0x715924000d58, is_called_from_prepared_stmt=false) at /test/11.8_dbg/sql/sql_parse.cc:4484
      #27 0x000063b816a93cc4 in mysql_parse (thd=0x715924000d58, rawbuf=0x715924019d20 "INSERT INTO t VALUES (1,'a')", length=28, parser_state=0x715a300b9a20) at /test/11.8_dbg/sql/sql_parse.cc:7906
      #28 0x000063b816a91094 in dispatch_command (command=COM_QUERY, thd=0x715924000d58, packet=0x71592400b099 "INSERT INTO t VALUES (1,'a')", packet_length=28, blocking=true) at /test/11.8_dbg/sql/sql_parse.cc:1902
      #29 0x000063b816a94873 in do_command (thd=0x715924000d58, blocking=true)at /test/11.8_dbg/sql/sql_parse.cc:1415
      #30 0x000063b816c7e529 in do_handle_one_connection (connect=0x63b82291c8f8, put_in_cache=true) at /test/11.8_dbg/sql/sql_connect.cc:1415
      #31 0x000063b816c7e2ce in handle_one_connection (arg=0x63b82292f738)at /test/11.8_dbg/sql/sql_connect.cc:1327
      #32 0x0000715a31c9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #33 0x0000715a31d29c3c 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  090625  888663ce12647c5aefee5e18accd80843d726741  No bug found                  
      CS  10.6   opt  090625  888663ce12647c5aefee5e18accd80843d726741  No bug found                                  
      CS  10.11  dbg  200625  e69f8cae1a15e15b9e4f5e0f8497e1f17bdc81a4  No bug found                               
      CS  10.11  opt  200625  e69f8cae1a15e15b9e4f5e0f8497e1f17bdc81a4  No bug found                  
      CS  11.4   dbg  090625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.4   opt  090625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.8   dbg  170625  c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f  mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)|SIGABRT|btr_block_reget|btr_discard_page|btr_cur_pessimistic_delete|btr_cur_node_ptr_delete        
      CS  11.8   opt  170625  c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f  No bug found                  
      CS  12.0   dbg  090625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)|SIGABRT|btr_block_reget|btr_discard_page|btr_cur_pessimistic_delete|btr_cur_node_ptr_delete
      CS  12.0   opt  090625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  No bug found                  
      CS  12.1   dbg  090625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)|SIGABRT|btr_block_reget|btr_discard_page|btr_cur_pessimistic_delete|btr_cur_node_ptr_delete
      CS  12.1   opt  090625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  No bug found                  
      ES  10.6   dbg  070525  6111fbaf7bdcb6f1170f556ffd05d6e1a4159f62  No bug found                          
      ES  10.6   opt  070525  6111fbaf7bdcb6f1170f556ffd05d6e1a4159f62  No bug found                  
      ES  11.4   dbg  070525  9cd12544ebfd0d52d2158af66b5aced58121cf1f  No bug found                                  
      ES  11.4   opt  070525  9cd12544ebfd0d52d2158af66b5aced58121cf1f  No bug found                                  
      ES  11.8   dbg  170625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  mtr->memo_contains_flagged(&index.lock, MTR_MEMO_X_LOCK)|SIGABRT|btr_block_reget|btr_discard_page|btr_cur_pessimistic_delete|btr_cur_node_ptr_delete
      ES  11.8   opt  170625  b9f97a5bc42a4f23889996d2891bcbb0cafcf0bc  No bug found                  
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              saahil Saahil Alam
              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.