Cron Job Memory Exahusted

I was trying to run today my first email campaign. Everything was working fine until I tried to modify the corn job (which was running only once every 30min) and my schedulers to try to make it go faster. But something happened that de delivery has stopped since then.

The corn job report shows the following error

Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 536870920 bytes) in /home/user/public_html/[mydomain.com/suitecrm/modules/Schedulers/Scheduler.php](http://mydomain.com/suitecrm/modules/Schedulers/Scheduler.php) on line 397

SuiteCRM php_errorlog shows the same message

[03-Nov-2020 12:38:02 CST6CDT] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 536870920 bytes) in /home/user/public_html/mydomain.com/suitecrm/modules/Schedulers/Scheduler.php on line 397

In suitecrm.log I find these errors, not sure if they are related:

[code]Tue Nov 3 06:56:28 2020 [15284][1][FATAL] log call at: custom/modules/Administration/index.tpl:54 - MY_FRAME is not set
Tue Nov 3 07:00:03 2020 [31919][1][FATAL] *** FOLDERS: addBean() is trying to save to a non-saved or non-existent folder

All my other schedules are stopped, too.

It is installed in a shared server in Siteground, with the following cron job

 cd /home/user/public_html ; /usr/local/php73/bin/php-cli /home/user/public_html/mydomain.com/suitecrm/cron.php

Any help would be greatly appreciated!

I forgot to mention that I am running
SuiteCRM Version 7.11.17
PHP 7.3

I would start by looking at overgrown tables in the database, which could be causing long operations that exhaust your memory.

Either that, or endless loops - an after_save hook that saves the bean again, for example.

For the tables, try running the first query in this post and examine results:

This is the size of my biggest tables, are they very big?

job_queue … 5,398 rows … 8.5 MiB
emails_email_addr_rel … 4,333 rows … 736 KiB
emails … 1,900 rows … 2.4 MiB
emails_text … 1,900 rows … 16.7 MiB
email_addr_bean_rel … 2,035 rows … 592 KiB
email_addresses … 2,116 rows … 480 KiB
campaign_log … 1,111 rows … 1.2 MiB
email_addresses_audit … 1,705 rows … 320 KiB
accounts_cstm … 1,019 rows … 112 KiB

Regarding the after_save hook point, I believe this is related to Workflows? I do not have any workflow working on my platform, so I do not think that is an issue.

I don’t think they’re too big, no.

This part got me thinking:

It’s trying to allocate a huge chunk, all in one go, in a place of the code where it’s simply doing date calculations. I would say that something about the way you tried to configure the job schedule is unexpected to that code, and it’s messing up big time.

Can you simply revert the configuration you made? Or try to get it right. (although obviously the code should be resilient to any user input, and should present instructive error messages…)

After hours and hours of test&fail and long conversations with hosting customer service, it results that the Cron Job in my current shared plan can not be set to run in less than 30 min period.

Once I have put back to run every 30min, the error message has disappeared. It does not make any sense to me, but now my schedulers are working again. I leave this in case it may happen to other people in the future.

Thanks for your help pgr. Your support is very important for us.

There are better hostings, you know? That’s very limiting and I think it reduces the usefulness of several SuiteCRM features.

You should aim for a hosting that allows SSH access and doesn’t limit cron. If you look carefully you find some (not many) with these characteristics among the cheap ones (but don’t ask me for specific recommendations, I haven’t scanned that market in a looong time).

Mine used to be one of these “better options”, but once they grow big in customers, they start to cut and reduce the services they offer. I guess it is time to move again …

You said it. That is exactly how this market works! They either do that or raise the prices until they’re not so competitive compared to the newcomers.