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

Assertion `next_insert_id == 0' failed in handler::ha_external_lock on INSERT

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Q4/2026 Server Maintenance

    Description

      INSTALL SONAME 'ha_mroonga';
      SET SESSION insert_id=1;
      CREATE TEMPORARY TABLE t (c INT AUTO_INCREMENT KEY) ENGINE=Mroonga;
      INSERT INTO t VALUES ();
      

      Leads to:

      CS 10.11.19 50faece416f0642b57a515d546f20cefd9062379 (Debug, Clang 22.1.8-20260622) Build 16/07/2026

      mariadbd: /test/10.11_dbg/sql/handler.cc:7289: int handler::ha_external_lock(THD *, int): Assertion `next_insert_id == 0' failed.
      

      CS 10.11.19 50faece416f0642b57a515d546f20cefd9062379 (Debug, Clang 22.1.8-20260622) Build 16/07/2026

      Core was generated by `/test/MD160726-mariadb-10.11.19-linux-x86_64-dbg/bin/mariadbd --no-defaults --l'.
      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 1698692)]
      (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  0x0000709f8084527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000709f808288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000709f8082881b in __assert_fail_base (fmt=0x709f809d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5f35c1b676ab "next_insert_id == 0", file=file@entry=0x5f35c1b656c6 "/test/10.11_dbg/sql/handler.cc", line=line@entry=7289, function=function@entry=0x5f35c1b676bf "int handler::ha_external_lock(THD *, int)") at ./assert/assert.c:96
      #6  0x0000709f8083b517 in __assert_fail (assertion=0x5f35c1b676ab "next_insert_id == 0", file=0x5f35c1b656c6 "/test/10.11_dbg/sql/handler.cc", line=7289, function=0x5f35c1b676bf "int handler::ha_external_lock(THD *, int)")at ./assert/assert.c:105
      #7  0x00005f35c0fecf91 in handler::ha_external_lock (this=0x689e816d3d68, thd=0x689e80000d58, lock_type=0) at /test/10.11_dbg/sql/handler.cc:7289
      #8  0x0000709f58308d9d in mrn::ExternalLock::ExternalLock (this=0x709f58aeed48, thd=0x689e80000d58, handler=0x689e816d3d68, lock_type=0)at /test/10.11_dbg/storage/mroonga/lib/mrn_external_lock.cpp:28
      #9  0x0000709f582c58b8 in ha_mroonga::storage_info (this=0x689e816d3d68, flag=64) at /test/10.11_dbg/storage/mroonga/ha_mroonga.cpp:5318
      #10 0x0000709f582cb4f0 in ha_mroonga::storage_write_row (this=0x689e816d3d68, buf=0x689e816d5420 "\377\001")at /test/10.11_dbg/storage/mroonga/ha_mroonga.cpp:6234
      #11 0x0000709f582ccdb3 in ha_mroonga::write_row (this=0x689e816d3d68, buf=0x689e816d5420 "\377\001")at /test/10.11_dbg/storage/mroonga/ha_mroonga.cpp:6485
      #12 0x00005f35c0ff89f6 in handler::ha_write_row (this=0x689e816d3d68, buf=0x689e816d5420 "\377\001") at /test/10.11_dbg/sql/handler.cc:7809
      #13 0x00005f35c0c063a2 in Write_record::single_insert (this=0x709f58af31c0, inserted=0x709f58af2ea0) at /test/10.11_dbg/sql/sql_insert.cc:2319
      #14 0x00005f35c0c04523 in Write_record::write_record (this=0x709f58af31c0)at /test/10.11_dbg/sql/sql_insert.cc:2361
      #15 0x00005f35c0c02035 in mysql_insert (thd=0x689e80000d58, table_list=0x689e80013558, fields=@0x689e80005f70: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5f35c2649560 <end_of_list>, last = 0x689e80005f70, elements = 0}, <No data fields>}, values_list=@0x689e80005fb8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x689e80014158, last = 0x689e80014158, elements = 1}, <No data fields>}, update_fields=@0x689e80005fa0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5f35c2649560 <end_of_list>, last = 0x689e80005fa0, elements = 0}, <No data fields>}, update_values=@0x689e80005f88: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x5f35c2649560 <end_of_list>, last = 0x689e80005f88, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0)at /test/10.11_dbg/sql/sql_insert.cc:1216
      #16 0x00005f35c0c5819b in mysql_execute_command (thd=0x689e80000d58, is_called_from_prepared_stmt=false)at /test/10.11_dbg/sql/sql_parse.cc:4660
      #17 0x00005f35c0c4e8c8 in mysql_parse (thd=0x689e80000d58, rawbuf=0x689e80013480 "INSERT INTO t VALUES ()", length=23, parser_state=0x709f58af4a20) at /test/10.11_dbg/sql/sql_parse.cc:8219
      #18 0x00005f35c0c4c11a in dispatch_command (command=COM_QUERY, thd=0x689e80000d58, packet=0x689e8000af09 "INSERT INTO t VALUES ()", packet_length=23, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1924
      #19 0x00005f35c0c4f34a in do_command (thd=0x689e80000d58, blocking=true)at /test/10.11_dbg/sql/sql_parse.cc:1434
      #20 0x00005f35c0e03a4e in do_handle_one_connection (connect=0x5f35d0a802e8, put_in_cache=true) at /test/10.11_dbg/sql/sql_connect.cc:1482
      #21 0x00005f35c0e03835 in handle_one_connection (arg=0x5f35d0b7a588)at /test/10.11_dbg/sql/sql_connect.cc:1394
      #22 0x0000709f8089caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #23 0x0000709f80929c6c 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  160726  85ab366da3fc5d13b61d9e491e63e2b62c017cf4  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  10.6   opt  160726  85ab366da3fc5d13b61d9e491e63e2b62c017cf4  No bug found                  
      CS  10.11  dbg  160726  50faece416f0642b57a515d546f20cefd9062379  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  10.11  opt  160726  50faece416f0642b57a515d546f20cefd9062379  No bug found                  
      CS  11.4   dbg  160726  17fe060a549d2bfa56f6efb82456b20146ac569f  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  11.4   opt  160726  17fe060a549d2bfa56f6efb82456b20146ac569f  No bug found                  
      CS  11.8   dbg  160726  bf58d4cb5fccd4078ec91c065a2de86be3b46281  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  11.8   opt  160726  bf58d4cb5fccd4078ec91c065a2de86be3b46281  No bug found                  
      CS  12.3   dbg  160726  f9d797f1ccb8bbdbad0b50005644f29cd6125a6c  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  12.3   opt  160726  f9d797f1ccb8bbdbad0b50005644f29cd6125a6c  No bug found                  
      CS  13.0   dbg  160726  84c246ca5387c0611f75097136ff4f4bea092aa3  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  13.0   opt  160726  84c246ca5387c0611f75097136ff4f4bea092aa3  No bug found                  
      CS  13.1   dbg  160726  7322a6656a5357b4574b7413493c76ba2fc41f84  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      CS  13.1   opt  160726  7322a6656a5357b4574b7413493c76ba2fc41f84  No bug found                  
      ES  10.6   dbg  160726  fcecb2620f25965723d640decede7c018bcb1dcc  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      ES  10.6   opt  160726  fcecb2620f25965723d640decede7c018bcb1dcc  No bug found                  
      ES  11.4   dbg  160726  3b34189bfe675c18c4ced3ef531d016ea74c76f4  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      ES  11.4   opt  160726  3b34189bfe675c18c4ced3ef531d016ea74c76f4  No bug found                  
      ES  11.8   dbg  160726  4694e931d10fecf733c34f83ea2146d31b708eb3  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      ES  11.8   opt  160726  4694e931d10fecf733c34f83ea2146d31b708eb3  No bug found                  
      ES  12.3   dbg  160726  9d8abb61e913bec023cd8caeccad4b42717151cb  next_insert_id == 0|SIGABRT|handler::ha_external_lock|mrn::ExternalLock::ExternalLock|ha_mroonga::storage_info|ha_mroonga::storage_write_row
      ES  12.3   opt  160726  9d8abb61e913bec023cd8caeccad4b42717151cb  No bug found                  
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.