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

Assertion `not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0' failed

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
      CREATE TABLE t1 (c1 DATE KEY,c2 INT(1) ZEROFILL,c3 DATE) ENGINE=InnoDB;
      SET unique_checks=0,foreign_key_checks=0,autocommit=0;
      CREATE TABLE t2 LIKE t1;
      DROP TABLE t1;
      CREATE TABLE t1 (c1 INT)Engine=InnoDB;
      BINLOG 'AMqaOw8BAAAAdAAAAHgAAAAAAAQANS42LjM0LTc5LjEtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAYVx w2w=';
      INSERT INTO t1 VALUES(1);
      BINLOG 'iiZAZwIBAAAAjAAAAKTEAAAAADQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYH2AgAAAAAAAIIEDAEAAAAAAAB0ZXN0AGFsdGVyIHRhYmxlIHQyIGFkZCBjb2x1bW4gZCBpbnQsIGZvcmNlLCBhbGdvcml0aG09Y29weU8mFH4=';
      

      Leads to:

      CS 10.11.16 c0acc3cc8f1ec24e96b1ee192fdf6e4b6ccf4e0a (Debug, Clang 18.1.3-11) Build 27/01/2026

      mariadbd: /test/10.11_dbg/storage/innobase/handler/ha_innodb.cc:16306: virtual int ha_innobase::external_lock(THD *, int): Assertion `not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0' failed.
      

      CS 10.11.16 c0acc3cc8f1ec24e96b1ee192fdf6e4b6ccf4e0a (Debug, Clang 18.1.3-11) Build 27/01/2026

      Core was generated by `/test/MD270126-mariadb-10.11.16-linux-x86_64-dbg/bin/mariadbd --no-defaults --m'.
      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 3344296)]
      (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  0x00007a0bd464527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007a0bd46288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007a0bd462881b in __assert_fail_base (fmt=0x7a0bd47d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x64b222b8d5ee "not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0", file=file@entry=0x64b222b89e10 "/test/10.11_dbg/storage/innobase/handler/ha_innodb.cc", line=line@entry=16306, function=function@entry=0x64b222b8d4ee "virtual int ha_innobase::external_lock(THD *, int)") at ./assert/assert.c:96
      #6  0x00007a0bd463b517 in __assert_fail (assertion=0x64b222b8d5ee "not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0", file=0x64b222b89e10 "/test/10.11_dbg/storage/innobase/handler/ha_innodb.cc", line=16306, function=0x64b222b8d4ee "virtual int ha_innobase::external_lock(THD *, int)") at ./assert/assert.c:105
      #7  0x000064b2222afd79 in ha_innobase::external_lock (this=0x7a0ae809b008, thd=0x7a0ae8000d58, lock_type=0)at /test/10.11_dbg/storage/innobase/handler/ha_innodb.cc:16305
      #8  0x000064b221ecbbbc in handler::ha_external_lock (this=0x7a0ae809b008, thd=0x7a0ae8000d58, lock_type=0) at /test/10.11_dbg/sql/handler.cc:7319
      #9  0x000064b22206b8d9 in lock_external (thd=0x7a0ae8000d58, tables=0x7a0ae8027298, count=1) at /test/10.11_dbg/sql/lock.cc:396
      #10 0x000064b22206b546 in mysql_lock_tables (thd=0x7a0ae8000d58, sql_lock=0x7a0ae8027278, flags=16384) at /test/10.11_dbg/sql/lock.cc:341
      #11 0x000064b22206aab9 in mysql_lock_tables (thd=0x7a0ae8000d58, tables=0x7a0ae8015328, count=1, flags=16384)at /test/10.11_dbg/sql/lock.cc:304
      #12 0x000064b221a3238f in lock_tables (thd=0x7a0ae8000d58, tables=0x7a0ae8013790, count=1, flags=16384)at /test/10.11_dbg/sql/sql_base.cc:6023
      #13 0x000064b221c07620 in mysql_alter_table (thd=0x7a0ae8000d58, new_db=0x7a0ae8005908, new_name=0x7a0ae8005d68, create_info=0x7a0baf50d8e0, table_list=0x7a0ae8013790, recreate_info=0x7a0baf50cfc0, alter_info=0x7a0baf50d770, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/10.11_dbg/sql/sql_table.cc:11489
      #14 0x000064b221cc753e in Sql_cmd_alter_table::execute (this=0x7a0ae8013fd0, thd=0x7a0ae8000d58) at /test/10.11_dbg/sql/sql_alter.cc:688
      #15 0x000064b221af05d9 in mysql_execute_command (thd=0x7a0ae8000d58, is_called_from_prepared_stmt=false)at /test/10.11_dbg/sql/sql_parse.cc:6201
      #16 0x000064b221ade314 in mysql_parse (thd=0x7a0ae8000d58, rawbuf=0x7a0ae8083643 "alter table t2 add column d int, force, algorithm=copy", length=54, parser_state=0x7a0baf50efe0)at /test/10.11_dbg/sql/sql_parse.cc:8223
      #17 0x000064b2220812fb in Query_log_event::do_apply_event (this=0x7a0ae808dce8, rgi=0x7a0ae808d380, query_arg=0x7a0ae8083643 "alter table t2 add column d int, force, algorithm=copy", q_len_arg=54) at /test/10.11_dbg/sql/log_event_server.cc:2206
      #18 0x000064b2220801ea in Query_log_event::do_apply_event (this=0x7a0ae808dce8, rgi=0x7a0ae808d380)at /test/10.11_dbg/sql/log_event_server.cc:1633
      #19 0x000064b222078a42 in Log_event::apply_event (this=0x7a0ae808dce8, rgi=0x7a0ae808d380) at /test/10.11_dbg/sql/log_event.cc:4255
      #20 0x000064b221c8a7eb in save_restore_context_apply_event (ev=0x7a0ae808dce8, rgi=0x7a0ae808d380) at /test/10.11_dbg/sql/sql_binlog.cc:212
      #21 0x000064b221c8af23 in mysql_client_binlog_statement (thd=0x7a0ae8000d58)at /test/10.11_dbg/sql/sql_binlog.cc:428
      #22 0x000064b221aeff70 in mysql_execute_command (thd=0x7a0ae8000d58, is_called_from_prepared_stmt=false)at /test/10.11_dbg/sql/sql_parse.cc:6111
      #23 0x000064b221ade314 in mysql_parse (thd=0x7a0ae8000d58, rawbuf=0x7a0ae8013460 "BINLOG 'iiZAZwIBAAAAjAAAAKTEAAAAADQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYH2AgAAAAAAAIIEDAEAAAAAAAB0ZXN0AGFsdGVyIHRhYmxlIHQyIGFkZCBjb2x1bW4gZCBpbnQsIGZvcmNlLCBhbGdvcml0aG09Y29weU8mFH4='", length=197, parser_state=0x7a0baf510a20) at /test/10.11_dbg/sql/sql_parse.cc:8223
      #24 0x000064b221adb7b9 in dispatch_command (command=COM_QUERY, thd=0x7a0ae8000d58, packet=0x7a0ae800aee9 "BINLOG 'iiZAZwIBAAAAjAAAAKTEAAAAADQAAAAAAAAABAAALQAAAAAAAQEAACBUAAAAAAYDc3RkBAgACAAACYH2AgAAAAAAAIIEDAEAAAAAAAB0ZXN0AGFsdGVyIHRhYmxlIHQyIGFkZCBjb2x1bW4gZCBpbnQsIGZvcmNlLCBhbGdvcml0aG09Y29weU8mFH4='", packet_length=197, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1924
      #25 0x000064b221adeec3 in do_command (thd=0x7a0ae8000d58, blocking=true)at /test/10.11_dbg/sql/sql_parse.cc:1434
      #26 0x000064b221cbc429 in do_handle_one_connection (connect=0x64b231197058, put_in_cache=true) at /test/10.11_dbg/sql/sql_connect.cc:1475
      #27 0x000064b221cbc1c2 in handle_one_connection (arg=0x64b23127e238)at /test/10.11_dbg/sql/sql_connect.cc:1387
      #28 0x00007a0bd469caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #29 0x00007a0bd4729c6c 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  270126  5b6ad325d2e523b95ab7463f093bd8c0d9529edd  No bug found                  
      CS  10.6   opt  270126  5b6ad325d2e523b95ab7463f093bd8c0d9529edd  No bug found                  
      CS  10.11  dbg  270126  c0acc3cc8f1ec24e96b1ee192fdf6e4b6ccf4e0a  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      CS  10.11  opt  270126  c0acc3cc8f1ec24e96b1ee192fdf6e4b6ccf4e0a  No bug found                  
      CS  11.4   dbg  270126  ca39e66060d4735f91fd46d9784b4c91ed6746aa  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      CS  11.4   opt  270126  ca39e66060d4735f91fd46d9784b4c91ed6746aa  No bug found                  
      CS  11.8   dbg  270126  8a0f327675e9b4a1e0ae2e3a97fe001122a9db03  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      CS  11.8   opt  270126  8a0f327675e9b4a1e0ae2e3a97fe001122a9db03  No bug found                  
      CS  12.2   dbg  270126  d640758b9478f4da9ac0023b1ac389ffc23aa9bb  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      CS  12.2   opt  270126  d640758b9478f4da9ac0023b1ac389ffc23aa9bb  No bug found                  
      CS  12.3   dbg  270126  346c7afe9b7071ce9c47892a83d69944b608b3da  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      CS  12.3   opt  270126  346c7afe9b7071ce9c47892a83d69944b608b3da  No bug found                  
      ES  10.6   dbg  270126  0fe345fff3a0463224ca714831303d40fb83648b  No bug found                  
      ES  10.6   opt  270126  0fe345fff3a0463224ca714831303d40fb83648b  No bug found                  
      ES  11.4   dbg  270126  34f616d5fd2c649d0c79acb4e2423c90b8f10436  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      ES  11.4   opt  270126  34f616d5fd2c649d0c79acb4e2423c90b8f10436  No bug found                  
      ES  11.8   dbg  270126  405ee76b60c4ab82155f339136ed20d3b7363717  not_autocommit || trx->n_mysql_tables_in_use || (trx->lock.trx_locks).count == 0|SIGABRT|ha_innobase::external_lock|handler::ha_external_lock|lock_external|mysql_lock_tables
      ES  11.8   opt  270126  405ee76b60c4ab82155f339136ed20d3b7363717  No bug found                  
      

      Attachments

        Issue Links

          Activity

            People

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