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

Assertion in set_error_status() fails due to errors caused by database log

    XMLWordPrintable

Details

    Description

      The following script:

      CREATE TABLE t1 ( t INT );
       
      DELIMITER $$;
      CREATE PROCEDURE p1()
      BEGIN
        INSERT INTO t1 VALUES (42);
      END$$
      DELIMITER ;$$
       
      SET debug_dbug='+d,mi_lock_database_failure';
      CALL p1();
      CALL p1();
      

      leads to assertion failure:

      CALL p1();
      mysqltest: At line 11: query 'CALL p1()' failed: ER_GET_ERRNO (1030): Got error 22 "Invalid argument" from storage engine MyISAM
      CALL p1();
      mysqltest: At line 12: query 'CALL p1()' failed: <Unknown> (2013): Lost connection to server during query
       
      mariadbd: /src/mariadb/sql/sql_error.cc:479: void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_user_condition_identity&, const Sql_condition*): Assertion `! is_set() || m_can_overwrite_status' failed.
      

      with the following stack trace:

      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:100
      #3  0x000062b88344ae3f in my_write_core (sig=6) at /src/mariadb/mysys/stacktrace.c:424
      #4  0x000062b882a466e2 in handle_fatal_signal (sig=6) at /src/mariadb/sql/signal_handler.cc:298
      #5  <signal handler called>
      #6  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44
      #7  __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
      #8  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:100
      #9  0x0000769aebc4579e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #10 0x0000769aebc288cd in __GI_abort () at ./stdlib/abort.c:73
      #11 0x0000769aebc28830 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:118
      #12 0x000062b88255a9b9 in Diagnostics_area::set_error_status (this=0x769ad40070d8, sql_errno=126, message=0x769ae5415c90 "Index for table './test/t1.MYI' is corrupt; try to repair it", sqlstate=0x62b883615b27 "HY000", ucid=..., error_condition=0x0) at /src/mariadb/sql/sql_error.cc:479
      #13 0x000062b882522f57 in THD::raise_condition (this=0x769ad4000dc8, cond=0x769ae5415a00) at /src/mariadb/sql/sql_class.cc:1176
      #14 0x000062b88240910b in THD::raise_condition (this=0x769ad4000dc8, sql_errno=126, sqlstate=0x62b883593552 "", level=Sql_state_errno_level::WARN_LEVEL_ERROR, msg=0x769ae5415c90 "Index for table './test/t1.MYI' is corrupt; try to repair it") at /src/mariadb/sql/sql_class.h:5427
      #15 0x000062b8823f5449 in my_message_sql (error=126, str=0x769ae5415c90 "Index for table './test/t1.MYI' is corrupt; try to repair it", MyFlags=64) at /src/mariadb/sql/mysqld.cc:3385
      #16 0x000062b88343a2cc in my_error (nr=126, MyFlags=64) at /src/mariadb/mysys/my_error.c:124
      #17 0x000062b8833d408f in mi_report_error (errcode=126, file_name=0x769ad41b1d18 "./test/t1.MYI") at /src/mariadb/storage/myisam/mi_info.c:129
      #18 0x000062b8833d6bdd in mi_lock_database (info=0x769ad41b1e48, lock_type=2) at /src/mariadb/storage/myisam/mi_locking.c:127
      #19 0x000062b8833afe0c in ha_myisam::external_lock (this=0x769ad41af5b8, thd=0x769ad4000dc8, lock_type=2) at /src/mariadb/storage/myisam/ha_myisam.cc:2214
      #20 0x000062b882a613a6 in handler::ha_external_lock (this=0x769ad41af5b8, thd=0x769ad4000dc8, lock_type=2) at /src/mariadb/sql/handler.cc:7756
      #21 0x000062b882447ca6 in handler::ha_external_unlock (this=0x769ad41af5b8, thd=0x769ad4000dc8) at /src/mariadb/sql/handler.h:3619
      #22 0x000062b882c09562 in unlock_external (thd=0x769ad4000dc8, table=0x769ad41b48b8, count=1) at /src/mariadb/sql/lock.cc:791
      #23 0x000062b882c087c6 in mysql_unlock_tables (thd=0x769ad4000dc8, sql_lock=0x769ad41b4888, free_lock=false) at /src/mariadb/sql/lock.cc:482
      #24 0x000062b882c0870a in mysql_unlock_tables (thd=0x769ad4000dc8, sql_lock=0x769ad41b4888) at /src/mariadb/sql/lock.cc:465
      #25 0x000062b8824f0dd0 in close_thread_tables (thd=0x769ad4000dc8) at /src/mariadb/sql/sql_base.cc:998
      #26 0x000062b8824f076b in close_thread_tables_for_query (thd=0x769ad4000dc8) at /src/mariadb/sql/sql_base.cc:821
      #27 0x000062b8825d1a4f in mysql_execute_command (thd=0x769ad4000dc8, is_called_from_prepared_stmt=false) at /src/mariadb/sql/sql_parse.cc:5949
      #28 0x000062b8828d4a01 in sp_instr_stmt::exec_core (this=0x769ad4102440, thd=0x769ad4000dc8, nextp=0x769ae5416d4c) at /src/mariadb/sql/sp_instr.cc:1268
      #29 0x000062b8828d285b in sp_lex_keeper::reset_lex_and_exec_core (this=0x769ad4102480, thd=0x769ad4000dc8, nextp=0x769ae5416d4c, open_tables=false, instr=0x769ad4102440, rerun_the_same_instr=false) at /src/mariadb/sql/sp_instr.cc:418
      #30 0x000062b8828d2f43 in sp_lex_keeper::validate_lex_and_exec_core (this=0x769ad4102480, thd=0x769ad4000dc8, nextp=0x769ae5416d4c, open_tables=false, instr=0x769ad4102440) at /src/mariadb/sql/sp_instr.cc:597
      #31 0x000062b8828d4565 in sp_instr_stmt::execute (this=0x769ad4102440, thd=0x769ad4000dc8, nextp=0x769ae5416d4c) at /src/mariadb/sql/sp_instr.cc:1170
      #32 0x000062b8824984d7 in sp_head::execute (this=0x769ad40435a0, thd=0x769ad4000dc8, merge_da_on_success=true) at /src/mariadb/sql/sp_head.cc:1294
      #33 0x000062b88249b541 in sp_head::execute_procedure (this=0x769ad40435a0, thd=0x769ad4000dc8, args=0x769ad4006368) at /src/mariadb/sql/sp_head.cc:2328
      #34 0x000062b8825c6b68 in do_execute_sp (thd=0x769ad4000dc8, sp=0x769ad40435a0) at /src/mariadb/sql/sql_parse.cc:3056
      #35 0x000062b8825c780f in Sql_cmd_call::execute (this=0x769ad4018238, thd=0x769ad4000dc8) at /src/mariadb/sql/sql_parse.cc:3279
      #36 0x000062b8825d14da in mysql_execute_command (thd=0x769ad4000dc8, is_called_from_prepared_stmt=false) at /src/mariadb/sql/sql_parse.cc:5857
      #37 0x000062b8825d7b26 in mysql_parse (thd=0x769ad4000dc8, rawbuf=0x769ad4018190 "CALL p1()", length=9, parser_state=0x769ae54182c0) at /src/mariadb/sql/sql_parse.cc:7883
      #38 0x000062b8825c32c1 in dispatch_command (command=COM_QUERY, thd=0x769ad4000dc8, packet=0x769ad400c0e9 "CALL p1()", packet_length=9, blocking=true) at /src/mariadb/sql/sql_parse.cc:1878
      #39 0x000062b8825c1ba6 in do_command (thd=0x769ad4000dc8, blocking=true) at /src/mariadb/sql/sql_parse.cc:1417
      #40 0x000062b8827df078 in do_handle_one_connection (connect=0x62b8ad819ed8, put_in_cache=true) at /src/mariadb/sql/sql_connect.cc:1414
      #41 0x000062b8827deded in handle_one_connection (arg=0x62b8ad7f9e68) at /src/mariadb/sql/sql_connect.cc:1326
      #42 0x000062b882dd57a6 in pfs_spawn_thread (arg=0x62b8ad81e2e8) at /src/mariadb/storage/perfschema/pfs.cc:2198
      #43 0x0000769aebca27f1 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:448
      #44 0x0000769aebd33c9c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      The issue is reproduced on main(e02f4d7e31)

      Attachments

        Activity

          People

            Unassigned Unassigned
            qobood Vasilii Lakhin
            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.