Out of Memory errors after sending broadcast emails

Your software
My Mautic version is: 3.3.1
My PHP version is: 7.3.26
My Database type and version is: MySQL 5.7

Your problem
My problem is: Our server crashes often after sending large segment emails. Usually segments just over 100k. We get out of memory errors in the logs and seem to be from redirecting the link clicks in the emails. Our server has 4GB of RAM and 4GB of virtual memory. We have the local and master PHP memory limit set to 2048M. Values lower than this cause memory errors when importing large segments. When the server becomes unresponsive we will find many out-of-memory errors in the logs.

These errors are showing in the log:
PHP Fatal error: Out of memory (allocated 25165824) (tried to allocate 131072 bytes) in /opt/bitnami/apps/mautic/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 567

PHP Fatal error: Out of memory (allocated 35651584) (tried to allocate 69632 bytes) in /opt/bitnami/apps/mautic/htdocs/var/cache/prod/appProdProjectContainerUrlMatcher.php on line 5043

Out of memory (allocated 33554432) (tried to allocate 4096 bytes) in /opt/bitnami/apps/mautic/htdocs/var/cache/prod/appProdProjectContainerUrlMatcher.php on line 6058

PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /opt/bitnami/apps/mautic/htdocs/vendor/piwik/device-detector/Parser/ParserAbstract.php on line 182

These continue until the server becomes completely unresponsive.

Steps I have tried to fix the problem:

We are unsure if we need to increase memory to PHP or if the increase to 2048MB is causing the server to exhaust its memory. Would having 8GB of RAM and 8GB of swap resolve this issue or is it something else like a possible memory leak. It only seems to happen after sending large broadcast emails.

Should we add pcre.jit=0 in our php.ini?

You need more memory in my opinion.
mautic:broadcasts:send --batch=50 --limit=50
Increase memory in php.ini and Use limiter options as above. Adjust as necessary until the memory errors stop


Thanks for the suggestions. We will give it a try.

1 Like