I have 3 different installations of Nextclouds 25.0.1 running. Two of them are on a lower end server (Raspberry Pi4 and Intel Nuc core i3 with 4GB RAM and 12 GB RAM). Both smaller systems occasionally stop responding with a laggy SSH and server performance. The Raspberry with its 4 GB of RAM starts swapping another GB into its swap file and is completely offline for 15-20 minutes when the cronjobs of nextcloud are running.
After the cron jobs finished, everything turn back to normal until the next cron is working. I checked the database table oc_jobs and found several thousand entries of class “AddPhotoJob” from the Maps application. Once I delete those jobs in the table, the cron is working again and finishes after 5-10 seconds, without using 8 GB of RAM. Thus also no swapping.
MariaDB [nextcloud]> DELETE FROM oc_jobs WHERE class LIKE ‘%Maps%’ and argument LIKE ‘%photoId%’;
Query OK, 44116 rows affected (2.407 sec)
MariaDB [nextcloud]> quit
After that, the servers run normally again and all following cronjobs need a few seconds. I also got rid of the error messages like:
“PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 49752824 bytes) in /var/www/nextcloud/apps/maps/lib/Helper”
It seems that the maps application needs to be fixed to not kill the cron jobs?
For me, it seems to be the cronjob that I had in my system cron:
0 */3 * * * php -f /var/www/nextcloud/occ maps:scan-photos > /dev/null 2>&1
I deleted this one and it seems I do not get those database entries anymore, while the NC cronjob is working well.
As soon as I execute occ maps:scan-photos again, I get the table entries back and the cron job blocks the server again with swapping Gigabytes of RAM.