I am running on 19.0.4 right now, but the problem already started earlier. I assume that it started to appear when upgrading to NC19, but this could also be a false assumption.
Anyhow, after reading some threads in the forum I can conclude that the cron task
OCA\Files\BackgroundJob\ScanFiles
takes forever to finish.
- Stop scans on external storage, or: how to disable / delete a background job
- Cron.php takes too long and can end up running multiple times
- The cron.php tasks run for hours, constant CPU load, queries on oc_filecache
- Cron does not terminate and need a lot of ram
The oc_jobs
database shows this information
4 OCA\Files\BackgroundJob\ScanFiles null 1603193402 1603193402 1603193402 46367
All other entries inside the table are below a minute or around 1 to 4 minute(s), but with the ScanFiles
entry we talking about hours / half a day.
I am even not sure why ScanFiles
is even needed. I removed the “External Storage” Plugin and all other data is pushed via WebDav or NC Clients / Web to the server, there are no external changes on the files being done.
Another problem is, that I do have multiple instances running at the same time, which, after some time / days, makes my server very sluggish and eats up CPU und RAM, and also starts occupieing the mysqld processes. This is after 24 hours uptime, 2 jobs have finished already with some hours in processing time.
The cron itself, is started every 5 minutes based on the official documentation
https://docs.nextcloud.com/server/19/admin_manual/configuration_server/background_jobs_configuration.html#cron and the information in nextcloud itself (https://nc.instance/settings/admin) saying cron should run every 5 minutes.
My questions are, why does cron even start multiple times if one is not finished?
And why does “ScanFiles” even run without external storage scans being activated, I could not find any information on this.
And perhaps also interesting, this instance runs on Debian 10, with 8GB RAM and Intel® Core™ i5-3320M CPU @ 2.60GHz
But yes, I have around 2TB of data being stored on the NC instance by around 10 users.