nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.86k stars 4.01k forks source link

[Bug]: Transfer ownership fails silently on insufficient target user storage quota #31868

Open Dr-Escher opened 2 years ago

Dr-Escher commented 2 years ago

⚠️ This issue respects the following points: ⚠️

Bug description

Transfering ownership from one user to another fails silently, if the receiving user accepts the transfer while the data to be moved exceeds the target users personal storage quota. No additional error message is provided.

The cronjob fails with the following unspecific error: {"reqId":"ckD2T5De9pxLEsnIST5Z","level":3,"time":"2022-04-07T06:25:01+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job (class: OCA\\Files\\BackgroundJob\\TransferOwnership, arguments: Array\n(\n [id] => 10\n)\n)","userAgent":"--","version":"23.0.3.2","exception":{"Exception":"Exception","Message":"Execution terminated.","Code":0,"Trace":[{"file":"/srv/web/apps/files/lib/Service/OwnershipTransferService.php","line":159,"function":"analyse","class":"OCA\\Files\\Service\\OwnershipTransferService","type":"->"},{"file":"/srv/web/apps/files/lib/BackgroundJob/TransferOwnership.php","line":115,"function":"transfer","class":"OCA\\Files\\Service\\OwnershipTransferService","type":"->"},{"file":"/srv/web/lib/public/BackgroundJob/Job.php","line":79,"function":"run","class":"OCA\\Files\\BackgroundJob\\TransferOwnership","type":"->"},{"file":"/srv/web/lib/public/BackgroundJob/QueuedJob.php","line":47,"function":"execute","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/srv/web/cron.php","line":150,"function":"execute","class":"OCP\\BackgroundJob\\QueuedJob","type":"->"}],"File":"/srv/web/apps/files/lib/Service/OwnershipTransferService.php","Line":243,"CustomMessage":"Error while running background job (class: OCA\\Files\\BackgroundJob\\TransferOwnership, arguments: Array\n(\n [id] => 10\n)\n)"}}

Using occ files:transfer-ownership results in a proper error message: Validating quota: Target user does not have enough free space available.

Steps to reproduce

  1. Initiate ownership transfer of files exceeding the receiving user's quota
  2. Accept the transfer request in scope of the receiving user, which immediately gets acknowledged
  3. Wait for the cronjob to log the error above

Expected behavior

Either validate and notify about the exceeding storage quota on initiation or confirmation of the ownership transfer in the web interface, visible for the users.

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated from a minor version (ex. 22.2.3 to 22.2.4)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "REDACTED",
            "REDACTED"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "23.0.3.2",
        "overwrite.cli.url": "https:\/\/REDACTED",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "loglevel": 2,
        "log_rotate_size": 10485760,
        "skeletondirectory": "",
        "trashbin_retention_obligation": "auto, 2",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": 30,
        "allow_user_to_change_display_name": true,
        "simpleSignUpLink.shown": false,
        "enable_previews": false,
        "maintenance": false,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtpauthtype": "LOGIN",
        "default_phone_region": "DE",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [
            "admin"
        ],
        "twofactor_enforced_excluded_groups": [],
        "mail_smtpsecure": "tls",
        "app_install_overwrite": [
            "twofactor_email"
        ]
    }
}

List of activated Apps

Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - cloud_federation_api: 1.6.0
  - dav: 1.21.0
  - external: 3.10.2
  - federatedfilesharing: 1.13.0
  - files: 1.18.0
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - firstrunwizard: 2.12.0
  - impersonate: 1.10.0
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - password_policy: 1.13.0
  - photos: 1.5.0
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - recommendations: 1.2.0
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - text: 3.4.1
  - theming: 1.14.0
  - twofactor_backupcodes: 1.12.0
  - twofactor_email: 2.2.0
  - twofactor_totp: 6.2.0
  - updatenotification: 1.13.0
  - viewer: 1.7.0
  - workflowengine: 2.5.0
Disabled:
  - admin_audit
  - circles: 23.0.0
  - comments: 1.9.0
  - contactsinteraction: 1.0.0
  - dashboard: 7.0.0
  - encryption
  - federation: 1.9.0
  - files_external: 1.10.0
  - nextcloud_announcements: 1.8.0
  - support: 1.2.1
  - survey_client: 1.7.0
  - systemtags: 1.9.0
  - user_ldap
  - user_status: 1.0.0
  - weather_status: 1.0.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

see above, no additional relevant logs before or after the described occurrence

Additional info

none

cerealkella commented 2 years ago

If, like me, you found this issue when searching this error because an ownership transfer that should have worked because user quotas were sufficiently large but they failed anyway both via the UI and the command line, the problem may be that the php script examines free space on the hard disk as well as the user quota. I kept receiving this error trying to move ~45GB from one user to another but there was only ~40GB free space on the storage partition. Extending the disk partition solved the problem for me and allowed me to successfully run the script.

mrhhats commented 2 years ago

Just to add that @cerealkella was right and that was my issue too. NextCloud 24.0.3 - silent fail on a 90gb folder transfer and it was due to the host OS not having enough free space

szaimen commented 1 year ago

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

michel-thomas commented 1 year ago

Hi @szaimen I have both problem on 24.0.7 instance:

michel-thomas commented 1 year ago

Hi @szaimen I juste tested on updated Nextcloud (25.0.4):

I can't reproduce the second case right now. I will do if possible.

szaimen commented 1 year ago

Hi, please update to 25.0.7 or better 26.0.2 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 26-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

michel-thomas commented 1 year ago

Hi @szaimen

I won't upgrade to 26 until 26.0.3 or 26.0.4, I am not confident enough to do so.

But I will with 25.0.8 soon. I keep you in touch.

michel-thomas commented 1 year ago

Hello @szaimen

Just tested with 25.0.8 and I can confirm that:

Nothing in Nextcloud logs.