Cronjob running for ages slowing down instance

Hey Folks,

my instance
NC 29.0.4 on Ubuntu 22 LTS with php8.2 has problems with its cronjob.
Since the cronjob killed my server every two weeks by a systemoverload I limited its memory access to 1024 MB - solved my problem that the server running out of memory during a cronjob and killed itself.

Now the job is running for ages, starting new job which running for ages as well. I still can use my cloud but its definitely slower.

My questions:
How can I run the cronjob faster?
What can I do to detect errors in the job itself?

Here a pic of htop:

current cronjob config in crontab -u www-data -e
*/5 * * * * php -d memory_limit=1024M -f /var/www/nextcloud/cron.php --define apc.enable_cli=1

something of the logfile:
{“reqId”:“ueIrxaefIZfkOP4QeYwU”,“level”:2,“time”:“2024-08-15T23:07:15+02:00”,“remoteAddr”:“”,“user”:“–”,“app”:“cron”,“method”:“”,“url”:“–”,“message”:“Used memory grew by more than 50 MB when executing job OCA\Files_Antivirus\BackgroundJob\BackgroundScanner (id: 2046, arguments: null): 116.3 MB (before: 41.5 MB)”,“userAgent”:“–”,“version”:“29.0.4.1”,“data”:{“app”:“cron”},“id”:“66c2f0dbca15c”}

Thanks for your support :slight_smile:

Are all of your log entries related to the Anti-virus app? If so, that seems where to focus your troubleshooting efforts: Antivirus scanner — Nextcloud latest Administration Manual latest documentation

You could start by disabling it long enough to see if the problem goes away. If it does, you know where to focus your efforts. If not, you know to look elsewhere.

3 Likes

hey thanks for the quick answer.

yes these entries are all related to the anti virus app. I´ll give it a try disabling and modifying it.

so it looks like that “antivirus” was the problem. do you have any suggestions to investigate why it could be the bad app?

got a different log entry:

Used memory grew by more than 50 MB when executing job OC\Core\BackgroundJobs\GenerateMetadataJob (id: 207380, arguments: null): 164.5 MB (before: 84.8 MB)

can someone explain me what “GenerateMetadataJob” is ?