Update to 24.0.0 Failed: Exception: Database error when running migration 24000Date20220202150027 for app core An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Nextcloud: Update to 24.0.0
OS: Debian Linux 9
Apache: 2.4.25
PHP: PHP 7.4.29

config.php
‘dbtype’ => ‘mysql’,
‘version’ => ‘24.0.0’,
‘overwrite.cli.url’ => ‘http://domain.com’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘nextcloud’,
‘dbpassword’ => ‘random’,
‘datadirectory’ => ‘/nextcloud/data’,
‘skeletondirectory’ => ‘/nextcloud/core/skeleton’,
‘appcodechecker’ => true,
‘updatechecker’ => true,

Preparing update
Set log level to debug
Turned on maintenance mode
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation → nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Exception: Database error when running migration 24000Date20220202150027 for app core An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

systemctl status mysql says the server is active without issue.

I’ve apt update to make sure everything was up to date, and have rebooted the server, same results.

Your database server is not reachable any more. Did it crash? Then check the logs why it crashed.

“systemctl status mysql says the server is active without issue.”

I can access the mysql db without issue.

OK, been trying to figure this out all day, got an error finally in the log:

The update seams to crash mysql on this line: ALTER TABLE oc_mounts ADD mount_provider_class VARCHAR(128) DEFAULT NULL

Version: ‘10.7.3-MariaDB-1:10.7.3+maria~stretch’ socket: ‘/run/mysqld/mysqld.sock’ port: 0 mariadb.org binary distribution
2022-05-09 10:18:04 0 [Note] InnoDB: Buffer pool(s) load completed at 220509 10:18:04
2022-05-09 10:18:35 0x7f6f20170700 InnoDB: Assertion failure in file /home/buildbot/buildbot/build/mariadb-10.7.3/storage/innobase/dict/dict0mem.cc line 142
InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2)
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 mariadbd 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.
220509 10:18:35 [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.7.3-MariaDB-1:10.7.3+maria~stretch
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467994 K bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f6e780009b8
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 = 0x7f6f2016fcb8 thread_stack 0x49000
??:0(my_print_stacktrace)[0x562f2f0cd68e]
??:0(handle_fatal_signal)[0x562f2eb513ff]
??:0(__restore_rt)[0x7f6f37fa60e0]
??:0(gsignal)[0x7f6f3739efff]
??:0(abort)[0x7f6f373a042a]
/usr/sbin/mariadbd(+0x63cf1a)[0x562f2e7eff1a]
??:0(std::thread::thread<void (&)()>(void (&)()))[0x562f2efd1670]
/usr/sbin/mariadbd(+0x63320a)[0x562f2e7e620a]
??:0(wsrep_notify_status(wsrep::server_state::state, wsrep::view const*))[0x562f2ee3e8ba]
??:0(mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool, bool))[0x562f2e9ca879]
??:0(Sql_cmd_alter_table::execute(THD*))[0x562f2ea32a8e]
??:0(mysql_execute_command(THD*, bool))[0x562f2e920c22]
??:0(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x562f2e926b2e]
??:0(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x562f2e91d222]
??:0(do_command(THD*, bool))[0x562f2e91bd58]
??:0(do_handle_one_connection(CONNECT*, bool))[0x562f2ea2d84f]
??:0(handle_one_connection)[0x562f2ea2de24]
??:0(MyCTX_nopad::finish(unsigned char*, unsigned int*))[0x562f2ed65a5f]
??:0(start_thread)[0x7f6f37f9c4a4]
??:0(clone)[0x7f6f37454d0f]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f6e780129f0): ALTER TABLE oc_mounts ADD mount_provider_class VARCHAR(128) DEFAULT NULL

Connection ID (thread ID): 7
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,materialization=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,not_null_range_scan=off

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 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 64007 64007 processes
Max open files 32768 32768 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 64007 64007 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: core

2022-05-09 10:18:41 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2022-05-09 10:18:41 0 [Note] InnoDB: Number of transaction pools: 1
2022-05-09 10:18:41 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-05-09 10:18:41 0 [Note] InnoDB: Using Linux native AIO
2022-05-09 10:18:41 0 [Note] InnoDB: Initializing buffer pool, total size = 1073741824, chunk size = 134217728
2022-05-09 10:18:41 0 [Note] InnoDB: Completed initialization of buffer pool
2022-05-09 10:18:41 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=19570284109646,19570284109646
2022-05-09 10:18:41 0 [Note] InnoDB: 128 rollback segments are active.
2022-05-09 10:18:41 0 [Note] InnoDB: Removed temporary tablespace data file: “./ibtmp1”
2022-05-09 10:18:41 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-05-09 10:18:41 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
2022-05-09 10:18:41 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
2022-05-09 10:18:41 0 [Note] InnoDB: 10.7.3 started; log sequence number 19570284109658; transaction id 11042971600
2022-05-09 10:18:41 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-05-09 10:18:41 0 [Note] Plugin ‘FEEDBACK’ is disabled.
2022-05-09 10:18:41 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-05-09 10:18:41 0 [Note] DDL_LOG: Crash recovery executed 1 entries
2022-05-09 10:18:41 0 [Note] /usr/sbin/mariadbd: ready for connections.
Version: ‘10.7.3-MariaDB-1:10.7.3+maria~stretch’ socket: ‘/run/mysqld/mysqld.sock’ port: 0 mariadb.org binary distribution
2022-05-09 10:18:42 0 [Note] InnoDB: Buffer pool(s) load completed at 220509 10:18:42

OK, I found this reported issue via google: [Bug]: Update 22.2.3 → 22.2.5 or 23.0.2: Database error #31285

Half way down someone reported success deleting the DB and re-importing it.
It worked! Update completed without issue!

Appears the “Bug” is still relevant.

2 Likes