Cron does not terminate and need a lot of ram

Ok I have now set up the whole system on a brand new Debian server and migrated the data. But I still have the problem somehow.
I really don’t know what it is

I runinng into issues with cron too and having a hard time to figure it out.
I added my comment to another thread and thought linking would be helpful

I am really struggling, so I link this thread here too.

Same problem here. :sweat: cron.php takes up to 90% of 4GB RAM und 30% of CPU for aprox. 30 secs.

Following tflidd’s advice:

select * from oc_jobs ORDER BY execution_duration DeSC;
+------+-----------------------------------------------------------------+--------------------------------------------------------------------------+------------+--------------+-------------+--------------------+
| id   | class                                                           | argument                                                                 | last_run   | last_checked | reserved_at | execution_duration |
+------+-----------------------------------------------------------------+--------------------------------------------------------------------------+------------+--------------+-------------+--------------------+
|   24 | OCA\UpdateNotification\Notification\BackgroundJob               | null                                                                     | 1617940802 |   1618023302 |           0 |                 27 |
|    1 | OCA\NextcloudAnnouncements\Cron\Crawler                         | null                                                                     | 1618001701 |   1618023302 |           0 |                  1 |
|   44 | OCA\Passwords\Cron\CheckPasswordsJob                            | null                                                                     | 1617940829 |   1618023302 |           0 |                  1 |
|   48 | OCA\Passwords\Cron\BackupJob                                    | null                                                                     | 1617940830 |   1618023302 |           0 |                  1 |
|   68 | OCA\Deck\Cron\ScheduledNotifications                            | null                                                                     | 1618023302 |   1618023302 |           0 |                  0 |
|   30 | OCA\Talk\BackgroundJob\ExpireSignalingMessage                   | null                                                                     | 1618023002 |   1618023302 |           0 |                  0 |
|   31 | OCA\Talk\BackgroundJob\RemoveEmptyRooms                         | null                                                                     | 1618023002 |   1618023302 |           0 |                  0 |

Except for OCA\UpdateNotification\Notification\BackgroundJob everything fine.

sudo -u www-data php /var/www/vhosts/XXX/public/occ background:queue:status -vvv:
takes long, then “Getötet” - probably “Killed” in English :slight_smile:

Same happens with:
sudo -u www-data php /var/www/vhosts/XXX/public/occ background:queue:status -vvv

Amy ideas? Thanks so much indeed.

Hm… Sounds like [NC 21] OCC Update error: allowed memory size exhausted · Issue #25742 · nextcloud/server · GitHub

1 Like

szaimen, you were right! Following this advice, by adding:

'debug' => 'false', // note: string not bool
'loglevel' => 2,

to config/config.php solved the problem.

Thanks!

2 Likes

I found a problem with the Maps app in my NC installation. Had over 3650 lines of Maps AddPhotoJob lines in my oc_jobs (the cron job table for NC) table.

I uninstalled the Maps app and deleted the jobs from my oc_jobs table with:

DELETE FROM oc_jobs WHERE class LIKE ‘%Maps%’ and argument LIKE ‘%photoId%’;

Now my cron runs through in seconds and uses less than 200 MB of memory.
That helped a lot, especially on a Raspberry Pi, which started swapping a few Gigabytes of RAM everytime the cronjob ran through. :slight_smile:

You can also try this by hand then:

sudo -u www-data php -d memory_limit=512M -f /var/www/nextcloud/cron.php --define apc.enable_cli=1

With limited the php memory usage down to 512 MB. When the Maps AddPhotoJobs were still in, this command crashed with:

“PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 49752824 bytes) in /var/www/nextcloud/apps/maps/lib/Helper”

Which was also a good indication where the whole RAM usage came from :slight_smile:

1 Like