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

Assertion `!thd->get_stmt_da()->is_sent() || thd->killed' failed in ha_maria::external_lock

    XMLWordPrintable

Details

    Description

      Very similar to MDEV-22726, but different stack, different testcase, different assert, different versions affected. However, the fix is likely exactly the same, especially as transactional=0 makes the testcase work without the server asserting.

      SET @@session.slow_query_log = ON;
      alter table mysql.slow_log engine=Aria;
      SET @@global.slow_query_log = 1;
      SET @@session.long_query_time = 0;
      SET @@global.log_output = 'TABLE,,FILE,,,';
      SELECT SLEEP(5);
      

      Leads to:

      10.5.4 6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89

      mysqld: /test/10.5_dbg/storage/maria/ha_maria.cc:2845: virtual int ha_maria::external_lock(THD*, int): Assertion `!thd->get_stmt_da()->is_sent() || thd->killed' failed.
      

      10.5.4 6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89

      Core was generated by `/test/MD060620-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x1508bc89c700 (LWP 473765))]
      (gdb) bt
      (gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000561122ce700d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000561122490bbc in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x00001508c51cc801 in __GI_abort () at abort.c:79
      #6  0x00001508c51bc39a in __assert_fail_base (fmt=0x1508c53437d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x561123065188 "!thd->get_stmt_da()->is_sent() || thd->killed", file=file@entry=0x561123064ec0 "/test/10.5_dbg/storage/maria/ha_maria.cc", line=line@entry=2845, function=function@entry=0x561123066b00 <ha_maria::external_lock(THD*, int)::__PRETTY_FUNCTION__> "virtual int ha_maria::external_lock(THD*, int)") at assert.c:92
      #7  0x00001508c51bc412 in __GI___assert_fail (assertion=assertion@entry=0x561123065188 "!thd->get_stmt_da()->is_sent() || thd->killed", file=file@entry=0x561123064ec0 "/test/10.5_dbg/storage/maria/ha_maria.cc", line=line@entry=2845, function=function@entry=0x561123066b00 <ha_maria::external_lock(THD*, int)::__PRETTY_FUNCTION__> "virtual int ha_maria::external_lock(THD*, int)") at assert.c:101
      #8  0x00005611226ddeb2 in ha_maria::external_lock (this=0x1508a3833aa0, thd=0x1508a3815088, lock_type=2) at /test/10.5_dbg/storage/maria/ha_maria.cc:2844
      #9  0x00005611224a2c82 in handler::ha_external_lock (this=0x1508a3833aa0, thd=thd@entry=0x1508a3815088, lock_type=lock_type@entry=2) at /test/10.5_dbg/sql/handler.cc:6521
      #10 0x00005611225d856a in handler::ha_external_unlock (thd=0x1508a3815088, this=<optimized out>) at /test/10.5_dbg/sql/handler.h:3400
      #11 unlock_external (thd=thd@entry=0x1508a3815088, table=0x1508a38742b0, count=<optimized out>) at /test/10.5_dbg/sql/lock.cc:727
      #12 0x00005611225d8787 in mysql_unlock_tables (thd=0x1508a3815088, sql_lock=0x1508a3874280, free_lock=<optimized out>) at /test/10.5_dbg/sql/lock.cc:432
      #13 0x00005611225d90bd in mysql_unlock_tables (thd=thd@entry=0x1508a3815088, sql_lock=<optimized out>) at /test/10.5_dbg/sql/lock.cc:417
      #14 0x0000561122160057 in close_thread_tables (thd=thd@entry=0x1508a3815088) at /test/10.5_dbg/sql/sql_base.cc:908
      #15 0x000056112216f029 in close_log_table (thd=thd@entry=0x1508a3815088, backup=backup@entry=0x1508bc89a420) at /test/10.5_dbg/sql/sql_base.cc:9112
      #16 0x00005611225c2aa6 in Log_to_csv_event_handler::log_slow (this=<optimized out>, thd=0x1508a3815088, current_time=<optimized out>, user_host=0x1508bc89ae40 "root[root] @ localhost []", user_host_len=25, query_utime=<optimized out>, lock_utime=0, is_command=false, sql_text=0x1508a38740a0 "SET @@global.log_output = 'TABLE,,FILE,,,'", sql_text_len=42) at /test/10.5_dbg/sql/log.cc:1017
      #17 0x00005611225bbbca in LOGGER::slow_log_print (this=this@entry=0x561123a6bb20 <logger>, thd=thd@entry=0x1508a3815088, query=0x1508a38740a0 "SET @@global.log_output = 'TABLE,,FILE,,,'", query_length=42, current_utime=<optimized out>) at /test/10.5_dbg/sql/log.cc:1366
      #18 0x00005611225c4286 in slow_log_print (thd=thd@entry=0x1508a3815088, query=<optimized out>, query_length=<optimized out>, current_utime=<optimized out>) at /test/10.5_dbg/sql/log.cc:6791
      #19 0x00005611221e2c1d in log_slow_statement (thd=thd@entry=0x1508a3815088) at /test/10.5_dbg/sql/sql_parse.cc:2612
      #20 0x00005611221e2393 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1508a3815088, packet=<optimized out>, packet@entry=0x1508a3867089 "", packet_length=<optimized out>, packet_length@entry=42, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:2484
      #21 0x00005611221de5f6 in do_command (thd=0x1508a3815088) at /test/10.5_dbg/sql/sql_parse.cc:1355
      #22 0x00005611223399f9 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1508a6915808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #23 0x000056112233a115 in handle_one_connection (arg=arg@entry=0x1508a6915808) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #24 0x0000561122799104 in pfs_spawn_thread (arg=0x1508c3c45888) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #25 0x00001508c5eaf6db in start_thread (arg=0x1508bc89c700) at pthread_create.c:463
      #26 0x00001508c52ad88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.1.46 (dbg), 10.2.33 (dbg), 10.3.24 (dbg), 10.4.14 (dbg), 10.5.4 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (opt), 10.2.33 (opt), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.