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

InnoDB: Failing assertion: trx->lock.table_locks.empty()

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

        --let $restart_noprint=2
        --let $restart_parameters=--innodb-rollback-on-timeout=1
        --source include/restart_mysqld.inc
        --source include/have_innodb.inc
        CREATE DATABASE db1;
        --connect (con1,localhost,root,,test)
        BEGIN;
        SELECT COUNT(*) INTO @c FROM mysql.innodb_table_stats FOR UPDATE;
        --connection default
        SET innodb_lock_wait_timeout=1;
        DROP DATABASE db1;
      

      Leads to:

      ES 10.6.28-24 47e099839c30841f59054ff738662d3fd5f58a08 (Debug, Clang 22.1.8-20260621) Build 03/09/2026

      Core was generated by `/test/EMD030926-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 90728)]
      (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  0x00007e1acba4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007e1acba288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00005ab745cd6ecd in ut_dbg_assertion_failed (expr=0x0, file=0x5ab74612f204 "/test/10.6-es_dbg/storage/innobase/trx/trx0sys.cc", line=57) at /test/10.6-es_dbg/storage/innobase/ut/ut0dbg.cc:60
      #6  0x00005ab745cbc7d7 in rw_trx_hash_t::validate_element (trx=0x7e1acb600680)at /test/10.6-es_dbg/storage/innobase/trx/trx0sys.cc:57
      #7  0x00005ab745cca761 in rw_trx_hash_t::insert (this=0x5ab74685da00 <trx_sys+49536>, trx=0x7e1acb600680)at include/trx0sys.h:671
      #8  0x00005ab745cc98dc in trx_sys_t::register_rw (this=0x5ab746851880 <trx_sys>, trx=0x7e1acb600680)at include/trx0sys.h:1146
      #9  0x00005ab745cc6c3d in trx_assign_rseg_low (trx=0x7e1acb600680)at /test/10.6-es_dbg/storage/innobase/trx/trx0trx.cc:801
      #10 0x00005ab745cc696b in trx_set_rw_mode (trx=0x7e1acb600680)at /test/10.6-es_dbg/storage/innobase/trx/trx0trx.cc:2232
      #11 0x00005ab745af7f87 in lock_table (table=0x5ab76058a8c0, fktable=0x0, mode=LOCK_X, thr=0x7619d80a3360)at /test/10.6-es_dbg/storage/innobase/lock/lock0lock.cc:3958
      #12 0x00005ab745af882a in lock_table_for_trx (table=0x5ab76058a8c0, trx=0x7e1acb600680, mode=LOCK_X, no_wait=false)at /test/10.6-es_dbg/storage/innobase/lock/lock0lock.cc:4119
      #13 0x00005ab745af8fba in lock_sys_tables (trx=0x7e1acb600680)at /test/10.6-es_dbg/storage/innobase/lock/lock0lock.cc:4210
      #14 0x00005ab745a6559f in innodb_drop_database (path=0x7e1aca4542a0 "./db1/")at /test/10.6-es_dbg/storage/innobase/handler/ha_innodb.cc:1381
      #15 0x00005ab7456960e4 in dropdb_handlerton (unused1=0x0, plugin=0x7619d8056238, path=0x7e1aca4542a0)at /test/10.6-es_dbg/sql/handler.cc:845
      #16 0x00005ab745339057 in plugin_foreach_with_mask (thd=0x0, func=0x5ab7456960a0 <dropdb_handlerton(THD*, st_plugin_int**, void*)>, type=1, state_mask=8, arg=0x7e1aca4542a0)at /test/10.6-es_dbg/sql/sql_plugin.cc:2561
      #17 0x00005ab74569609a in ha_drop_database (path=0x7e1aca4542a0 "./db1/")at /test/10.6-es_dbg/sql/handler.cc:852
      #18 0x00005ab7452a5953 in drop_database_objects (thd=0x7619d8000d58, path=0x7e1aca453dd8, db=0x7e1aca453e00, rm_mysql_schema=false)at /test/10.6-es_dbg/sql/sql_db.cc:995
      #19 0x00005ab7452a5f8b in mysql_rm_db_internal (thd=0x7619d8000d58, db=0x7619d8005ca0, if_exists=false, silent=false)at /test/10.6-es_dbg/sql/sql_db.cc:1139
      #20 0x00005ab7452a5a5c in mysql_rm_db (thd=0x7619d8000d58, db=0x7619d8005ca0, if_exists=false) at /test/10.6-es_dbg/sql/sql_db.cc:1314
      #21 0x00005ab74530e23a in mysql_execute_command (thd=0x7619d8000d58, is_called_from_prepared_stmt=false)at /test/10.6-es_dbg/sql/sql_parse.cc:5367
      #22 0x00005ab7453011a8 in mysql_parse (thd=0x7619d8000d58, rawbuf=0x7619d8016ab0 "DROP DATABASE db1", length=17, parser_state=0x7e1aca455a28) at /test/10.6-es_dbg/sql/sql_parse.cc:8228
      #23 0x00005ab7452fe9a1 in dispatch_command (command=COM_QUERY, thd=0x7619d8000d58, packet=0x7619d800aed9 "DROP DATABASE db1", packet_length=17, blocking=true) at /test/10.6-es_dbg/sql/sql_parse.cc:1918
      #24 0x00005ab745301c4f in do_command (thd=0x7619d8000d58, blocking=true)at /test/10.6-es_dbg/sql/sql_parse.cc:1428
      #25 0x00005ab7454b0f5e in do_handle_one_connection (connect=0x5ab7608a2de8, put_in_cache=true) at /test/10.6-es_dbg/sql/sql_connect.cc:1393
      #26 0x00005ab7454b0d45 in handle_one_connection (arg=0x5ab7608a2de8)at /test/10.6-es_dbg/sql/sql_connect.cc:1305
      #27 0x00007e1acba9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #28 0x00007e1acbb29d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      ES 10.6.28-24 47e099839c30841f59054ff738662d3fd5f58a08 (Optimized, Clang 22.1.8-20260621) Build 03/09/2026

      InnoDB: Failing assertion: trx->lock.table_locks.empty()
      

      ES 10.6.28-24 47e099839c30841f59054ff738662d3fd5f58a08 (Optimized, Clang 22.1.8-20260621) Build 03/09/2026

      Core was generated by `/test/EMD030926-mariadb-10.6.28-24-linux-x86_64-opt/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 96090)]
      (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  0x000073a42784527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000073a4278288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00005cbc4290b389 in ut_dbg_assertion_failed (expr=0x5cbc432c5207 "trx->lock.table_locks.empty()", file=0x5cbc432c4d37 "/test/10.6-es_opt/storage/innobase/trx/trx0trx.cc", line=918) at /test/10.6-es_opt/storage/innobase/ut/ut0dbg.cc:60
      #6  0x00005cbc4305a13e in trx_start_low (trx=0x73a421f0a680, read_write=false)at /test/10.6-es_opt/storage/innobase/trx/trx0trx.cc:918
      #7  0x00005cbc43022ae5 in row_sel_step (thr=thr@entry=0x6ba33004e948)at /test/10.6-es_opt/storage/innobase/row/row0sel.cc:2374
      #8  0x00005cbc42fe556e in que_thr_step (thr=0x6ba33004e948)at /test/10.6-es_opt/storage/innobase/que/que0que.cc:529
      #9  que_run_threads_low (thr=0x6ba33004e948)at /test/10.6-es_opt/storage/innobase/que/que0que.cc:609
      #10 que_run_threads (thr=0x6ba33004e948)at /test/10.6-es_opt/storage/innobase/que/que0que.cc:629
      #11 0x00005cbc42fe58ae in que_eval_sql (info=info@entry=0x6ba33004b310, sql=<optimized out>, trx=trx@entry=0x73a421f0a680)at /test/10.6-es_opt/storage/innobase/que/que0que.cc:668
      #12 0x00005cbc42f6ecd2 in innodb_drop_database (path=<optimized out>)at /test/10.6-es_opt/storage/innobase/handler/ha_innodb.cc:1453
      #13 0x00005cbc42c749e9 in dropdb_handlerton (unused1=<optimized out>, plugin=<optimized out>, path=0x6) at /test/10.6-es_opt/sql/handler.cc:845
      #14 0x00005cbc42a4eaff in plugin_foreach_with_mask (thd=0x0, func=0x5cbc42c749d0 <dropdb_handlerton(THD*, st_plugin_int*, void*)>, type=<optimized out>, state_mask=<optimized out>, arg=0x73a421c14b00)at /test/10.6-es_opt/sql/sql_plugin.cc:2561
      #15 0x00005cbc429ec30b in drop_database_objects (thd=thd@entry=0x6ba330000c68, path=0x1775a, path@entry=0x73a421c14820, db=0x6, db@entry=0x73a421c147c0, rm_mysql_schema=12) at /test/10.6-es_opt/sql/sql_db.cc:995
      #16 0x00005cbc429ecf89 in mysql_rm_db_internal (thd=0x6ba330000c68, db=0x6ba330005be0, if_exists=<optimized out>, silent=false)at /test/10.6-es_opt/sql/sql_db.cc:1139
      #17 0x00005cbc42a30ce0 in mysql_execute_command (thd=thd@entry=0x6ba330000c68, is_called_from_prepared_stmt=false)at /test/10.6-es_opt/sql/sql_parse.cc:5367
      #18 0x00005cbc42a2b71d in mysql_parse (thd=thd@entry=0x6ba330000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x73a421c154b0)at /test/10.6-es_opt/sql/sql_parse.cc:8228
      #19 0x00005cbc42a29d7b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x6ba330000c68, packet=packet@entry=0x6ba330008689 "DROP DATABASE db1", packet_length=packet_length@entry=17, blocking=true)at /test/10.6-es_opt/sql/sql_parse.cc:1918
      #20 0x00005cbc42a2bba0 in do_command (thd=thd@entry=0x6ba330000c68, blocking=true) at /test/10.6-es_opt/sql/sql_parse.cc:1428
      #21 0x00005cbc42b4dc2d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5cbc6f345e28, put_in_cache=true)at /test/10.6-es_opt/sql/sql_connect.cc:1393
      #22 0x00005cbc42b4d9f3 in handle_one_connection (arg=arg@entry=0x5cbc6f345e28)at /test/10.6-es_opt/sql/sql_connect.cc:1305
      #23 0x00005cbc42ec583e in pfs_spawn_thread (arg=0x5cbc6f345e98)at /test/10.6-es_opt/storage/perfschema/pfs.cc:2201
      #24 0x000073a42789cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x000073a427929d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed
      CS  10.11  dbg  030926  1bc9eca856a32065fddce1db68edcfa6f4342578  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      CS  10.11  opt  030926  1bc9eca856a32065fddce1db68edcfa6f4342578  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      CS  11.4   dbg  030926  79f96bf15d2538cb78201cc85681571f56548957  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      CS  11.4   opt  030926  79f96bf15d2538cb78201cc85681571f56548957  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      CS  11.8   dbg  030926  e2e060ce3d8c3ce11b6c7ba28ced0f1a30c50a54  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      CS  11.8   opt  030926  e2e060ce3d8c3ce11b6c7ba28ced0f1a30c50a54  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      CS  12.3   dbg  030926  ab9657491197ac6a32f4f325388badda974f2fe2  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      CS  12.3   opt  030926  ab9657491197ac6a32f4f325388badda974f2fe2  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      CS  13.0   dbg  030926  b2c4e675049e23ce8c7346985f40840fcd4e583f  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      CS  13.0   opt  030926  b2c4e675049e23ce8c7346985f40840fcd4e583f  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      CS  13.1   dbg  030926  b2a8c2234dbc276fe3947633c9ffea454badf48f  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      CS  13.1   opt  030926  b2a8c2234dbc276fe3947633c9ffea454badf48f  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      ES  10.6   dbg  030926  47e099839c30841f59054ff738662d3fd5f58a08  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      ES  10.6   opt  030926  47e099839c30841f59054ff738662d3fd5f58a08  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      ES  11.4   dbg  030926  e953e9092e7e78da74eec4a80ead7b67d55f3772  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      ES  11.4   opt  030926  e953e9092e7e78da74eec4a80ead7b67d55f3772  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      ES  11.8   dbg  030926  72bfb892c8537baa3e0e5ea16e24e79171a9be22  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      ES  11.8   opt  030926  72bfb892c8537baa3e0e5ea16e24e79171a9be22  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      ES  12.3   dbg  030926  31a1c7393d7f943ff9e335c84923988876681b44  SIGABRT|ut_dbg_assertion_failed|rw_trx_hash_t::validate_element|rw_trx_hash_t::insert|trx_sys_t::register_rw
      ES  12.3   opt  030926  31a1c7393d7f943ff9e335c84923988876681b44  trx->lock.table_locks.empty()|SIGABRT|ut_dbg_assertion_failed|trx_start_low|row_sel_step|que_thr_step
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              saahil Saahil Alam
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.75h
                  1.75h

                  Git Integration

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