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

Assertion `inited == NONE || table->open_by_handler' failed in int handler::ha_external_lock(THD *, int)

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q3/2026 Server Development

    Description

      Testcase is CLI/MTR compatible.

      DELIMITER $$
      CREATE FUNCTION f1() RETURNS INT BEGIN EXECUTE IMMEDIATE 'SELECT 1 INTO @x'; RETURN 5; END$$
      DELIMITER ;
      CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1,2);
      CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET NEW.b = f1();
      UPDATE t1 SET a = a + 1;
      

      Leads to:

      MDEV-39518 CS 13.1.0 3716d0c58dd4a2abdef84cee36d919b9c916802d (Debug, Clang 18.1.3-11) Build 02/09/2026

      mariadbd: /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/handler.cc:8014: int handler::ha_external_lock(THD *, int): Assertion `inited == NONE || table->open_by_handler' failed.
      

      MDEV-39518 CS 13.1.0 3716d0c58dd4a2abdef84cee36d919b9c916802d (Debug, Clang 18.1.3-11) Build 02/09/2026

      Core was generated by `/test/mtest/MDEV-39518/MD020926-mariadb-13.1.0-linux-x86_64-dbg/bin/mariadbd --'.
      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 2245825)]
      (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  0x00007b40cb64527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007b40cb6288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007b40cb62881b in __assert_fail_base (fmt=0x7b40cb7d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56626313c64e "inited == NONE || table->open_by_handler", file=file@entry=0x56626313a119 "/test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/handler.cc", line=line@entry=8014, function=function@entry=0x56626313c54c "int handler::ha_external_lock(THD *, int)") at ./assert/assert.c:96
      #6  0x00007b40cb63b517 in __assert_fail (assertion=0x56626313c64e "inited == NONE || table->open_by_handler", file=0x56626313a119 "/test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/handler.cc", line=8014, function=0x56626313c54c "int handler::ha_external_lock(THD *, int)")at ./assert/assert.c:105
      #7  0x000056626239151e in handler::ha_external_lock (this=0x733f9404cae0, thd=0x733f94000d60, lock_type=2)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/handler.cc:8014
      #8  0x0000566261d792e2 in handler::ha_external_unlock (this=0x733f9404cae0, thd=0x733f94000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/handler.h:3773
      #9  0x000056626256de83 in unlock_external (thd=0x733f94000d60, table=0x733f9401d620, count=1)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/lock.cc:791
      #10 0x000056626256df62 in mysql_unlock_tables (thd=0x733f94000d60, sql_lock=0x733f9401d5f0, free_lock=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/lock.cc:482
      #11 0x000056626256e11c in mysql_unlock_tables (thd=0x733f94000d60, sql_lock=0x733f9401d5f0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/lock.cc:465
      #12 0x0000566261e3bded in close_thread_tables (thd=0x733f94000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_base.cc:993
      #13 0x00005662621ee536 in sp_lex_keeper::reset_lex_and_exec_core (this=0x733f940a0ee0, thd=0x733f94000d60, nextp=0x7b40c80e4fa8, open_tables=true, instr=0x733f940a0ea0, rerun_the_same_instr=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:438
      #14 0x00005662621eebbc in sp_lex_keeper::validate_lex_and_exec_core (this=0x733f940a0ee0, thd=0x733f94000d60, nextp=0x7b40c80e4fa8, open_tables=true, instr=0x733f940a0ea0)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:608
      #15 0x00005662621f2a3f in sp_instr_set_trigger_field::execute (this=0x733f940a0ea0, thd=0x733f94000d60, nextp=0x7b40c80e4fa8)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_instr.cc:1717
      #16 0x0000566261dda42c in sp_head::execute (this=0x733f9409f7b0, thd=0x733f94000d60, merge_da_on_success=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:1346
      #17 0x0000566261ddc30f in sp_head::execute_trigger (this=0x733f9409f7b0, thd=0x733f94000d60, db_name=0x733f940273c8, table_name=0x733f940273d8, grant_info=0x733f9404dd08)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sp_head.cc:1859
      #18 0x00005662620731ac in Table_triggers_list::process_triggers (this=0x733f9404d770, thd=0x733f94000d60, event=TRG_EVENT_UPDATE, time_type=TRG_ACTION_BEFORE, old_row_is_record1=true, skip_row_indicator=0x7b40c80e5cfd, fields_in_update_stmt=0x733f94005e40)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_trigger.cc:2879
      #19 0x0000566261e4ec98 in fill_record_n_invoke_before_triggers (thd=0x733f94000d60, table=0x733f94097ba0, fields=@0x733f94005e40: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x733f9401b100, last = 0x733f9401b100, elements = 1}, <No data fields>}, values=@0x733f940062e8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x733f9401b110, last = 0x733f9401b110, elements = 1}, <No data fields>}, ignore_errors=false, event=TRG_EVENT_UPDATE, skip_row_indicator=0x7b40c80e5cfd)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_base.cc:9674
      #20 0x000056626208e453 in Sql_cmd_update::update_single_table (this=0x733f9401b120, thd=0x733f94000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_update.cc:1010
      #21 0x0000566262096b67 in Sql_cmd_update::execute_inner (this=0x733f9401b120, thd=0x733f94000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_update.cc:3320
      #22 0x0000566261fe02f6 in Sql_cmd_dml::execute (this=0x733f9401b120, thd=0x733f94000d60)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_select.cc:35066
      #23 0x0000566261f17ea6 in mysql_execute_command (thd=0x733f94000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:4484
      #24 0x0000566261f0dfd4 in mysql_parse (thd=0x733f94000d60, rawbuf=0x733f9401a490 "UPDATE t1 SET a = a + 1", length=23, parser_state=0x7b40c80e7a80)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:8000
      #25 0x0000566261f0b2fd in dispatch_command (command=COM_QUERY, thd=0x733f94000d60, packet=0x733f9400b6c1 "UPDATE t1 SET a = a + 1", packet_length=23, blocking=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:1903
      #26 0x0000566261f0eb83 in do_command (thd=0x733f94000d60, blocking=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_parse.cc:1437
      #27 0x0000566262114619 in do_handle_one_connection (connect=0x56629cca6880, put_in_cache=true)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_connect.cc:1514
      #28 0x00005662621143be in handle_one_connection (arg=0x56629cc45220)at /test/mtest/MDEV-39518/bb-13.1-bar-MDEV-39518_dbg/sql/sql_connect.cc:1426
      #29 0x00007b40cb69cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #30 0x00007b40cb729d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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