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

MariaDB crash after ALTER TABLE convert to utf8mb4

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.4, 10.5, 10.6, 10.4.19, 10.5.10
    • Fix Version/s: 10.4.22, 10.5.13, 10.6.5
    • Labels:
      None
    • Environment:
      OS: CloudLinux like RHEL - Kernel 4.18.0-147.8.1.el8.lve.1.x86_64

      Description

      We run rather large production servers with over hundreds of databases with varying sizes between a few MB and many GB.

      Over the past few days we noticed that sometimes MariaDB seems to quit responding on our production servers.

      We found out that this behaviour can be triggered if someone updates their WordPress website. When WordPress is updated it also performs some database queries to convert tables to utf8mb4.

      E.g. the following query is done:

      ALTER TABLE wp_usermeta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
      

      This causes MariaDB to complete stop responding for about 15 seconds and than recovers.

      This is very unwanted behaviour because customers keep trying to update their website causing MariaDB to not respond multiple times over a short duration.

      The following is logged during the crash:

      2021-06-16 14:46:11 0x7fcc332b3700  InnoDB: Assertion failure in file /builddir/build/BUILD/mariadb-10.4.19/storage/innobase/data/data0type.cc line 67
      InnoDB: Failing assertion: !(prefix_len % mbmaxlen)
      InnoDB: We intentionally generate a memory trap.
      InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
      InnoDB: If you get repeated assertion failures or crashes, even
      InnoDB: immediately after the mysqld startup, there may be
      InnoDB: corruption in the InnoDB tablespace. Please refer to
      InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
      InnoDB: about forcing recovery.
      210616 14:46:11 [ERROR] mysqld got signal 6 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.
       
      To report this bug, see https://mariadb.com/kb/en/reporting-bugs
       
      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed, 
      something is definitely wrong and this may fail.
       
      Server version: 10.4.19-MariaDB-log-cll-lve
      key_buffer_size=67108864
      read_buffer_size=1048576
      max_used_connections=32
      max_threads=502
      thread_count=24
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1106098 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7fcc0b149388
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x7fcc332b13d8 thread_stack 0x40000
      /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x561d6dcc656e]
      /usr/sbin/mysqld(handle_fatal_signal+0x54d)[0x561d6d7b5d9d]
      sigaction.c:0(__restore_rt)[0x7fcc68745b30]
      :0(__GI_raise)[0x7fcc67a8c84f]
      :0(__GI_abort)[0x7fcc67a76c45]
      /usr/sbin/mysqld(+0x5b52a8)[0x561d6d4a92a8]
      /usr/sbin/mysqld(+0x5c11d7)[0x561d6d4b51d7]
      /usr/sbin/mysqld(+0xb135f3)[0x561d6da075f3]
      /usr/sbin/mysqld(+0xb1b573)[0x561d6da0f573]
      /usr/sbin/mysqld(+0xb1dff1)[0x561d6da11ff1]
      /usr/sbin/mysqld(+0xa81618)[0x561d6d975618]
      /usr/sbin/mysqld(_Z17mysql_alter_tableP3THDPK25st_mysql_const_lex_stringS3_P14HA_CREATE_INFOP10TABLE_LISTP10Alter_infojP8st_orderb+0x3dc7)[0x561d6d646377]
      /usr/sbin/mysqld(_ZN19Sql_cmd_alter_table7executeEP3THD+0x347)[0x561d6d69ac37]
      /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x137e)[0x561d6d5a862e]
      /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x2c5)[0x561d6d5aeeb5]
      /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x1602)[0x561d6d5b1412]
      /usr/sbin/mysqld(_Z10do_commandP3THD+0x13a)[0x561d6d5b28ca]
      /usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x25e)[0x561d6d6967de]
      /usr/sbin/mysqld(handle_one_connection+0x3d)[0x561d6d6968ad]
      pthread_create.c:0(start_thread)[0x7fcc6873b15a]
      /lib64/libc.so.6(clone+0x43)[0x7fcc67b51f73]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fcc02b64c60): ALTER TABLE wp_usermeta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
       
      Connection ID (thread ID): 4914
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,m
      aterialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_
      cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
       
      The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /var/lib/mysql
      Resource Limits:
      Limit                     Soft Limit           Hard Limit           Units     
      Max cpu time              unlimited            unlimited            seconds   
      Max file size             unlimited            unlimited            bytes     
      Max data size             unlimited            unlimited            bytes     
      Max stack size            8388608              unlimited            bytes     
      Max core file size        unlimited            unlimited            bytes     
      Max resident set          unlimited            unlimited            bytes     
      Max processes             514122               514122               processes 
      Max open files            51200                51200                files     
      Max locked memory         65536                65536                bytes     
      Max address space         unlimited            unlimited            bytes     
      Max file locks            unlimited            unlimited            locks     
      Max pending signals       514122               514122               signals   
      Max msgqueue size         819200               819200               bytes     
      Max nice priority         0                    0                    
      Max realtime priority     0                    0                    
      Max realtime timeout      unlimited            unlimited            us        
      Core pattern: |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e
       
      2021-06-16 14:46:18 0 [Warning] You need to use --log-bin to make --binlog-format work.
      2021-06-16 14:46:18 0 [Warning] The parameter innodb_file_format is deprecated and has no effect. It may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
      2021-06-16 14:46:18 0 [Warning] InnoDB: Setting innodb_checksum_algorithm to values other than crc32, full_crc32, strict_crc32 or strict_full_crc32 is UNSAFE and DEPRECATED. These deprecated values will be disallowed in MariaDB 10.6.
      2021-06-16 14:46:18 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
      2021-06-16 14:46:18 0 [Note] InnoDB: Uses event mutexes
      2021-06-16 14:46:18 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
      2021-06-16 14:46:18 0 [Note] InnoDB: Number of pools: 1
      2021-06-16 14:46:18 0 [Note] InnoDB: Using SSE2 crc32 instructions
      2021-06-16 14:46:18 0 [Note] mysqld: O_TMPFILE is not supported on /var/lib/mysql_tmp (disabling future attempts)
      2021-06-16 14:46:18 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
      2021-06-16 14:46:18 0 [Note] InnoDB: Completed initialization of buffer pool
      2021-06-16 14:46:18 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
      2021-06-16 14:46:18 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=30378586209559
      2021-06-16 14:46:19 0 [Note] InnoDB: Starting final batch to recover 220 pages from redo log.
      2021-06-16 14:46:24 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
      2021-06-16 14:46:24 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
      2021-06-16 14:46:24 0 [Note] InnoDB: Creating shared tablespace for temporary tables
      2021-06-16 14:46:24 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
      2021-06-16 14:46:24 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
      2021-06-16 14:46:24 0 [Note] InnoDB: Waiting for purge to start
      2021-06-16 14:46:24 0 [Note] InnoDB: 10.4.19 started; log sequence number 30378586621666; transaction id 47558113933
      2021-06-16 14:46:24 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
      2021-06-16 14:46:24 0 [Note] Plugin 'FEEDBACK' is disabled.
      2021-06-16 14:46:24 0 [Note] Server socket created on IP: '::'.
      2021-06-16 14:46:24 0 [Note] Reading of all Master_info entries succeeded
      2021-06-16 14:46:24 0 [Note] Added new Master_info '' to hash table
      2021-06-16 14:46:24 0 [Note] /usr/sbin/mysqld: ready for connections.
      Version: '10.4.19-MariaDB-log-cll-lve'  socket: '/var/lib/mysql_sock/mysql.sock'  port: 3306  MariaDB Server
      2021-06-16 14:46:24 0 [Note] InnoDB: Buffer pool(s) load completed at 210616 14:46:24
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kevg Eugene Kosov
              Reporter:
              Joriz Joris de Leeuw
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved:

                  Git Integration