Issue upgrading to 24.0.2

Trying to upgrade via command line, and I’m getting the following:

chris@alpha:~/web/cloud.chrisamoody.com/public_html$ php7.4 occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
Starting code integrity check...
Doctrine\DBAL\Exception\ConnectionLost: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Update failed
Maintenance mode is kept active
Resetting log level

Is it possible to manually run the queries?

I’m also having this issue going from 23.0.6 to 24.0.2. Server is running Debian 10.12 and MariaDB 10.3.34-0+deb10u1 .

Web updater fails with SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. Upon further investigation it looks like a specific query during the upgrade (ALTER TABLE oc_comments ADD reactions VARCHAR(4000) DEFAULT NULL) caused an assertion to fail:

2022-06-28 12:18:01 0x7fec280ad700 InnoDB: Assertion failure in file /build/mariadb-10.3-PdLLTU/mariadb-10.3-10.3.34/storage/innobase/dict/dict0mem.cc line 143
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 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.
220628 12:18:01 [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.3.34-MariaDB-0+deb10u1
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=6
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467428 K bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

Thread pointer: 0x7febc4007678
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 = 0x7fec280acdd8 thread_stack 0x49000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55d3db423e6e]
/usr/sbin/mysqld(handle_fatal_signal+0x54d)[0x55d3daf4d30d]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7fec2d880730]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x10b)[0x7fec2d6e57bb]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7fec2d6d0535]
/usr/sbin/mysqld(+0x4e9fab)[0x55d3dac8cfab]
/usr/sbin/mysqld(+0xab359b)[0x55d3db25659b]
/usr/sbin/mysqld(+0x9394c2)[0x55d3db0dc4c2]
/usr/sbin/mysqld(+0x93e2b3)[0x55d3db0e12b3]
/usr/sbin/mysqld(+0x658533)[0x55d3dadfb533]
/usr/sbin/mysqld(_Z17mysql_alter_tableP3THDPK25st_mysql_const_lex_stringS3_P14HA_CREATE_INFOP10TABLE_LISTP10Alter_infojP8st_orderb+0x3fb0)[0x55d3dae06230]
/usr/sbin/mysqld(_ZN19Sql_cmd_alter_table7executeEP3THD+0x2b2)[0x55d3dae540b2]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x2b1f)[0x55d3dad75d7f]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1c9)[0x55d3dad7adf9]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x111d)[0x55d3dad7cc8d]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x122)[0x55d3dad7e402]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x23a)[0x55d3dae515aa]
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x55d3dae5172d]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7fa3)[0x7fec2d875fa3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7fec2d7a6eff]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7febc4016350): ALTER TABLE oc_comments ADD reactions VARCHAR(4000) DEFAULT NULL

Connection ID (thread ID): 38
Status: NOT_KILLED

I rolled the server back to 23.0.6 via snapshot…a mysqlcheck of all databases returns OK so I have no reason to suspect corruption pre-upgrade.

I had the same issue when I did the upgrade to 24.0.2 (never had this issue with any of the previous versions of Nextcloud)

I searched a little on the official Nextcloud Github page and found the following issue with a solution: [Bug]: Update 22.2.3 --> 22.2.5 or 23.0.2: Database error · Issue #31285 · nextcloud/server · GitHub

I followed the steps in the above URL and was able to upgrade my Nextcloud to the latest version.

I guess a standard “Analyze table”, “Check table” and “Optimize table” might have done the job as well, but I went down the drastic step route right away.

I’m afraid that didn’t work for me.

mysqlcheck -u chris_nextcloud -p --databases chris_nextcloud --analyze
For some reason optimize was telling me
note : Table does not support optimize, doing recreate + analyze instead
status : OK
Analyze told me everything was okay.
When I follow it up with mysqlcheck -u nextcloud -p --databases nextcloud it also came back as being OK.

Trying to do the upgrade via command line still gives me an error

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
Starting code integrity check…
Doctrine\DBAL\Exception\ConnectionLost: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Update failed
Maintenance mode is kept active
Resetting log level

If that didn’t work you may have to go down the mysqldump road. Just follow the instruction of kantholz in the link I posted.

That’s how I have done it and the upgrade was working again afterwards

Yeah, I found that issue as well and mysqlcheck -o seems to have fixed it for me, I retried the upgrade after that and it was fine.

As a side note…

I did not run into this problem when upgrading using psql as my db. So, it appears to be db specific.

None of these options have done anything for me, same thing happened last update too I had to do a new install of everything.