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

Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER

Details

    Description

      CREATE TABLE t (a INT) ENGINE=MyISAM;
      INSERT INTO t VALUES (1);
      LOCK TABLE t READ;
      --connect (con1,localhost,root,,)
      SET max_statement_time= 0.001;
      --error ER_STATEMENT_TIMEOUT
      ALTER TABLE t FORCE;
      --error ER_STATEMENT_TIMEOUT
      ALTER TABLE IF EXISTS t FORCE;
       
      # Cleanup
      --disconnect con1
      --connection default
      UNLOCK TABLES;
      DROP TABLE t;
      

      11.4 866a8ea6736d2edc0f6be552d1cdd6810c10d5ab

      mariadbd: /data/bld/11.4-asan/sql/sql_error.h:1087: uint Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR' failed.
      241210  0:21:57 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fd846e53e32 in __GI___assert_fail (assertion=0x55f50d4b2660 "m_status == DA_ERROR", file=0x55f50d4b26a0 "/data/bld/11.4-asan/sql/sql_error.h", line=1087, function=0x55f50d4b2700 "uint Diagnostics_area::sql_errno() const") at ./assert/assert.c:101
      #10 0x000055f50afe9956 in Diagnostics_area::sql_errno (this=0x62c0000f6368) at /data/bld/11.4-asan/sql/sql_error.h:1087
      #11 0x000055f50b5f9d95 in mysql_alter_table (thd=0x62c0000f0218, new_db=0x62c0000f4f98, new_name=0x62c0000f53f8, create_info=0x7fd83af59ce0, table_list=0x629000267358, recreate_info=0x7fd83af59a70, alter_info=0x7fd83af59b30, order_num=0, order=0x0, ignore=false, if_exists=true) at /data/bld/11.4-asan/sql/sql_table.cc:10513
      #12 0x000055f50b7cf433 in Sql_cmd_alter_table::execute (this=0x629000267a70, thd=0x62c0000f0218) at /data/bld/11.4-asan/sql/sql_alter.cc:701
      #13 0x000055f50b2ef9f0 in mysql_execute_command (thd=0x62c0000f0218, is_called_from_prepared_stmt=false) at /data/bld/11.4-asan/sql/sql_parse.cc:5864
      #14 0x000055f50b2fcb2e in mysql_parse (thd=0x62c0000f0218, rawbuf=0x629000267238 "ALTER TABLE IF EXISTS t FORCE", length=29, parser_state=0x7fd83af5ba90) at /data/bld/11.4-asan/sql/sql_parse.cc:7893
      #15 0x000055f50b2d3cbe in dispatch_command (command=COM_QUERY, thd=0x62c0000f0218, packet=0x62900025d219 "ALTER TABLE IF EXISTS t FORCE", packet_length=29, blocking=true) at /data/bld/11.4-asan/sql/sql_parse.cc:1905
      #16 0x000055f50b2d09f6 in do_command (thd=0x62c0000f0218, blocking=true) at /data/bld/11.4-asan/sql/sql_parse.cc:1418
      #17 0x000055f50b7b075b in do_handle_one_connection (connect=0x6080000036b8, put_in_cache=true) at /data/bld/11.4-asan/sql/sql_connect.cc:1429
      #18 0x000055f50b7b02ba in handle_one_connection (arg=0x6080000036b8) at /data/bld/11.4-asan/sql/sql_connect.cc:1341
      #19 0x000055f50c4299ee in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/11.4-asan/storage/perfschema/pfs.cc:2201
      #20 0x00007fd846ea8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #21 0x00007fd846f2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      No obvious problem on a non-debug build.

      The failure is also happening with other variations of killing the query, e.g. upon KILL_SERVER, it is just more reliable with the statement timeout.

      It started happening after this commit in 11.4.1:

      commit 2f5174e556cd247133aa14d7b37372ae49fe83c5
      Author: Vladislav Vaintroub
      Date:   Thu Feb 1 02:14:23 2024 +0100
       
          MDEV-33075 Resolve server shutdown issues on macOS, Solaris, and FreeBSD
      

      Note that this patch was recently backported from 11.4 to 10.5-10.11. The failure isn't happening on 10.5-10.11 with the backport, but I cannot say whether it's because the backport also fixes the issue (after all, it came in 4 commits, not just one), or because it just doesn't affect 10.5.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            wlad Vladislav Vaintroub made changes -
            Fix Version/s 10.5.28 [ 29952 ]
            Fix Version/s 11.4 [ 29301 ]
            Fix Version/s 11.7 [ 29815 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 10.6.21 [ 29953 ]
            Fix Version/s 10.11.11 [ 29954 ]
            Fix Version/s 11.4.5 [ 29956 ]
            Fix Version/s 11.7.2 [ 29914 ]

            closed by mistake

            wlad Vladislav Vaintroub added a comment - closed by mistake
            wlad Vladislav Vaintroub made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Stalled [ 10000 ]
            wlad Vladislav Vaintroub made changes -
            Fix Version/s 11.7.2 [ 29914 ]
            Fix Version/s 10.5.28 [ 29952 ]
            Fix Version/s 10.6.21 [ 29953 ]
            Fix Version/s 10.11.11 [ 29954 ]
            Fix Version/s 11.4.5 [ 29956 ]
            wlad Vladislav Vaintroub made changes -
            Fix Version/s 11.4 [ 29301 ]
            wlad Vladislav Vaintroub made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            wlad Vladislav Vaintroub added a comment - - edited

            To me, bisect on windows gives the below commit from 11.2 as the first bad one, although the reason is not obvious when reading the patch code

            commit 13f1e970a17f62dfd80d337dedb8d27a95f6409d (HEAD)
            Author: Sergei Golubchik <serg@mariadb.org>
            Date:   Wed Jun 29 16:58:33 2022 +0200
             
                MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
            

            wlad Vladislav Vaintroub added a comment - - edited To me, bisect on windows gives the below commit from 11.2 as the first bad one, although the reason is not obvious when reading the patch code commit 13f1e970a17f62dfd80d337dedb8d27a95f6409d (HEAD) Author: Sergei Golubchik <serg@mariadb.org> Date: Wed Jun 29 16:58:33 2022 +0200   MDEV-28944 XA assertions failing in binlog_rollback and binlog_commit
            JIraAutomate JiraAutomate made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]

            People

              wlad Vladislav Vaintroub
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.