NC performance drop: Maps app is killing the cron job (and lags the whole server!)

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.
In mariadb:

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.

So it seems that the occ maps:scan-photos adds a job for every single picture I have stored on my nextcloud.
Can’t the maps app use its own table like “oc_maps”? If it stores all entries in the cron “oc_jobs”, the general cron is killed if it is run every 5 minutes. It does not even finish until the next cron job ist started and this leads to a fully unusable system if you store a lot of pictures on a Raspberry (mine has a 4TB USB drive attached with 250k pictures on it). I have no insights about the maps developers decision to store this into the regular cron job table, but it seems a bit of an unlucky practice to me.

This is the way to do it. Search the generic errors against the forum and github and the internet. It is the same thing we other volunteers do.

1 Like

Ok, got that. Still, what is the solution or the correct way to have the maps app running? It is not really usable for me at the moment, or at least the occ maps:scan command is not, since it will again add all the jobs to the cron table and thus make a system lag, not only the Raspberry ones, but actually any server.
Is the occ maps:scan command not used anymore?

No idea, because I don’t use it.

1 Like