nextcloud / nextcloud/server

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

Open
#31,868 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 25-feedback bug feature: files needs review
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.
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?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/files/lib/Service/OwnershipTransferService.php and apps/files/lib/BackgroundJob/TransferOwnership.php, following the quota validation path shown in the report. Compare the web ownership-transfer flow with the occ files:transfer-ownership behavior. Done means an insufficient target quota is surfaced to users during initiation or confirmation instead of failing silently in the cron job.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.