Failing to update synapse, is the database corrupted?

My YunoHost server

Hardware: Computer
YunoHost version: 4.4.2.14
I have access to my server : Through SSH, through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Trying to fix synapse that isn’t working anymore on my server (service is reported as dead from the diagnosis, and I can’t send messages…), I noticed there was an update available for synapse (passing from 1.59.0~ynh1 to 1.67.0~ynh1), I thought I’d give a try to the update, in case magic makes the issue resolve itself, but the update cannot proceed because the backing up of the app is failing.

Info: Now upgrading synapse...
Info: [....................] > Loading installation settings...
Info: [+...................] > Ensuring downward compatibility...
Info: [#++++++++...........] > Backing up the app before upgrading (may take a while)...
Warning: 110797 pg_dump: Dumping the contents of table "events" failed: PQgetResult() failed.
Warning: 110799 pg_dump: Error message from server: ERROR:  invalid page in block 28727 of relation base/19572/19884
Warning: 110800 pg_dump: The command was: COPY public.events (topological_ordering, event_id, type, room_id, content, unrecognized_keys, processed, outlier, depth, origin_server_ts, received_ts, sender, contains_url, instance_name, stream_ordering, state_key, rejection_reason) TO stdout;
Warning: 119516 Could not back up synapse
Warning: 120781 Nothing to save
Error: Could not upgrade synapse: An error occurred inside the app upgrade script
Info: The operation 'Upgrade the 'synapse' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20220929-213326-app_upgrade-synapse' to get help
Warning: Here's an extract of the logs before the crash. It might help debugging the error:
Info: DEBUG - 12556 ++ local _globalapp=synapse
Info: DEBUG - 12589 ++ app=synapse
Info: DEBUG - 12589 ++ [[ do_not_backup_data =~ (unprotected|protected|skipped)_ ]]
Info: DEBUG - 12589 ++ ynh_app_setting get synapse do_not_backup_data
Info: DEBUG - 12639 ++ realpath /etc/nginx/conf.d/domain.tld.d/synapse_server_name.conf
Info: DEBUG - 12642 ++ echo /etc/nginx/conf.d/domain.tld.d/synapse_server_name.conf
Info: DEBUG - 12642 ++ sed --regexp-extended 's/"/\"\"/g'
Info: DEBUG - 12644 ++ echo apps/synapse/backup/etc/nginx/conf.d/domain.tld.d/synapse_server_name.conf
Info: DEBUG - 12645 ++ sed --regexp-extended 's/"/\"\"/g'
Info: DEBUG - 12647 ++ dirname /home/yunohost.backup/tmp/synapse-pre-upgrade2/apps/synapse/backup/etc/nginx/conf.d/domain.tld.d/synapse_server_name.conf
Info: DEBUG - 12657 Backing up the PostgreSQL database...
Info: WARNING - 110797 pg_dump: Dumping the contents of table "events" failed: PQgetResult() failed.
Info: WARNING - 110799 pg_dump: Error message from server: ERROR:  invalid page in block 28727 of relation base/19572/19884
Info: WARNING - 110800 pg_dump: The command was: COPY public.events (topological_ordering, event_id, type, room_id, content, unrecognized_keys, processed, outlier, depth, origin_server_ts, received_ts, sender, contains_url, instance_name, stream_ordering, state_key, rejection_reason) TO stdout;
Info: DEBUG - 113934 Could not run script: /var/cache/yunohost/app_tmp_work_dirs/app_yameco3w/scripts/backup
Info: WARNING - 119516 Could not back up synapse
Info: DEBUG - 119519 The operation 'Create a backup archive' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20220929-213341-backup_create' to get help
Info: DEBUG - 120781 action [9651.1] executed in 120.687s
Info: WARNING - 120781 Nothing to save
Info: DEBUG - + ynh_exit_properly
Error: The operation 'Upgrade the 'synapse' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20220929-213326-app_upgrade-synapse' to get help

I have the feeling that this is due to a database corruption or something similar.
I guess my best bet is to restore synapse from the last functional backup (as a matter of fact, even backups have been failing for a few days).

Before doing something stupid, I just wanted to have external advise if someone think there might be a better/simpler option.
And if backup restore seem to be the best bet, I guess I should first remove the existing broken synapse, and then proceed to restoring. Am I right?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.