YunoHost-Apps / nextcloud_ynh

Nextcloud package for YunoHost
https://nextcloud.com/
GNU Affero General Public License v3.0
144 stars 62 forks source link

Time out during upgrade due to huge data folder lead to incoherent package #666

Open Krakinou opened 4 months ago

Krakinou commented 4 months ago

Describe the bug

When upgrading a nextcloud instance, the line find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640 can take a very long time if the data folder is big. This leads to time-out when an upgrade is performed from the web admin interface and left the package broken as the upgrade process just stop mid-way. This does not happen from command line. Please refer to this thread.

Context

Steps to reproduce

  1. Have a big data folder
  2. Try to upgrade the app through the webadmin
  3. Wait
  4. Once time out occurs, check the version of the instance & the package with yunohost app info nextcloud => the package is still at the old version
  5. Connect to the nextcloud instance and check the nextcloud version => it's the version from the new package.

Logs

Here is the end of the log of the upgrade from the webadmin (it's just stop there):

2024-02-07 22:54:53,353: INFO - [##############++....] > Reapplying file permissions...
2024-02-07 22:54:53,354: DEBUG - + chown -R nextcloud:www-data /var/www/nextcloud
2024-02-07 22:54:55,930: DEBUG - + chown -R nextcloud: /home/yunohost.app/nextcloud
2024-02-07 22:54:55,935: DEBUG - + find /var/www/nextcloud/ -type f -print0
2024-02-07 22:54:55,936: DEBUG - + xargs -r0 chmod 0644
2024-02-07 22:54:56,557: DEBUG - + find /var/www/nextcloud/ -type d -print0
2024-02-07 22:54:56,559: DEBUG - + xargs -r0 chmod 0755
2024-02-07 22:54:56,909: DEBUG - + find /home/yunohost.app/nextcloud/data/ -type f -print0
2024-02-07 22:54:56,910: DEBUG - + xargs -r0 chmod 0640
Krakinou commented 4 months ago

I love the 666 issue number :)

OniriCorpe commented 4 months ago

The web interface times out, but the upgrade should continue to run in the background without issue

Krakinou commented 4 months ago

Well, I also thought so. But from what I had on my system it does not : All files in /etc/yunohost/apps/nextcloud were from previous version. When upgrading from command line, all files were updated to last version.

OniriCorpe commented 4 months ago

i manually tested by closing my tab during the yesterday's nextcloud upgrade and it completed smoothly in background without the webpage openned

so i'm confused

Krakinou commented 4 months ago

I'm trying to reproduce the issue on a VM, will keep you posted.