# Memory exhausted error despite memory setting of -1

**URL:** <https://forum.mautic.org/t/memory-exhausted-error-despite-memory-setting-of-1/21468>\
**Category:** Mautic 4 Install/Upgrade Support\
**Created:** [November 1, 2021, 12:11am UTC](https://forum.mautic.org/t/memory-exhausted-error-despite-memory-setting-of-1/21468 "2021-11-01T00:11:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkaaaay](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mkaaaay/32/4707_2.png) [@mkaaaay](https://forum.mautic.org/u/mkaaaay)\
**Post date:** [November 1, 2021, 12:11am UTC](https://forum.mautic.org/t/memory-exhausted-error-despite-memory-setting-of-1/21468/1 "2021-11-01T00:11:35Z")

</div>

**Your software**

_My PHP version is_ : 7.4.24

_My MariaDB version is_ : 10.3

_These errors are showing in the Mautic log_ 🙂

[2021-11-01 09:48:03] mautic.NOTICE: Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2 (uncaught exception) at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 98 while running console command `mautic:segments:update`

[2021-11-01 09:48:03] mautic.WARNING: Command `mautic:segments:update` exited with status code 1

[2021-11-01 09:49:02] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2

[2021-11-01 00:29:05] console.CRITICAL: Error thrown while running command “mautic:segments:update”. Message: “An exception occurred while executing ‘INSERT INTO mau\_campaign\_leads (date\_added, manually\_removed, manually\_added, date\_last\_exited, rotation, campaign\_id, lead\_id) VALUES (?, ?, ?, ?, ?, ?, ?)’ with params [“2021-10-31 13:29:05”, 0, 0, null, 1, 3, “15388”]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’” {“exception”:"[object] (Doctrine\DBAL\Exception\UniqueConstraintViolationException(code: 0): An exception occurred while executing ‘INSERT INTO mau\_campaign\_leads (date\_added, manually\_removed, manually\_added, date\_last\_exited, rotation, campaign\_id, lead\_id) VALUES (?, ?, ?, ?, ?, ?, ?)’ with params [“2021-10-31 13:29:05”, 0, 0, null, 1, 3, “15388”]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’ at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:74, Doctrine\DBAL\Driver\PDO\Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’ at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’ at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)",“command”:“mautic:segments:update”,“message”:“An exception occurred while executing ‘INSERT INTO mau\_campaign\_leads (date\_added, manually\_removed, manually\_added, date\_last\_exited, rotation, campaign\_id, lead\_id) VALUES (?, ?, ?, ?, ?, ?, ?)’ with params [“2021-10-31 13:29:05”, 0, 0, null, 1, 3, “15388”]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’”}

[2021-11-01 09:48:03] console.CRITICAL: Error thrown while running command “mautic:segments:update”. Message: “An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2” {“exception”:"[object] (Doctrine\DBAL\Exception\SyntaxErrorException(code: 0): An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`)\nSELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log\nWHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2 at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:98, Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError(code: 0): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2 at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php:19)",“command”:“mautic:segments:update”,“message”:“An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`)\nSELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log\nWHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2”}

[2021-11-01 09:48:03] mautic.NOTICE: Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2 (uncaught exception) at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 98 while running console command `mautic:segments:update`

[2021-11-01 09:48:03] mautic.WARNING: Command `mautic:segments:update` exited with status code 1

[2021-11-01 09:49:02] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2

[2021-11-01 00:29:05] console.CRITICAL: Error thrown while running command “mautic:segments:update”. Message: “An exception occurred while executing ‘INSERT INTO mau\_campaign\_leads (date\_added, manually\_removed, manually\_added, date\_last\_exited, rotation, campaign\_id, lead\_id) VALUES (?, ?, ?, ?, ?, ?, ?)’ with params [“2021-10-31 13:29:05”, 0, 0, null, 1, 3, “15388”]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’” {“exception”:"[object] (Doctrine\DBAL\Exception\UniqueConstraintViolationException(code: 0): An exception occurred while executing ‘INSERT INTO mau\_campaign\_leads (date\_added, manually\_removed, manually\_added, date\_last\_exited, rotation, campaign\_id, lead\_id) VALUES (?, ?, ?, ?, ?, ?, ?)’ with params [“2021-10-31 13:29:05”, 0, 0, null, 1, 3, “15388”]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’ at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:74, Doctrine\DBAL\Driver\PDO\Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’ at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’ at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)",“command”:“mautic:segments:update”,“message”:“An exception occurred while executing ‘INSERT INTO mau\_campaign\_leads (date\_added, manually\_removed, manually\_added, date\_last\_exited, rotation, campaign\_id, lead\_id) VALUES (?, ?, ?, ?, ?, ?, ?)’ with params [“2021-10-31 13:29:05”, 0, 0, null, 1, 3, “15388”]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘3-15388’ for key ‘PRIMARY’”}

[2021-11-01 09:48:03] console.CRITICAL: Error thrown while running command “mautic:segments:update”. Message: “An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2” {“exception”:"[object] (Doctrine\DBAL\Exception\SyntaxErrorException(code: 0): An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`)\nSELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log\nWHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2 at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:98, Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError(code: 0): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2 at /path/to/mlr/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php:19)",“command”:“mautic:segments:update”,“message”:“An exception occurred while executing ‘REPLACE INTO mau\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`)\nSELECT id, :dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log\nWHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from mau\_campaign\_lead\_event\_log…’ at line 2”}

**Your problem**

_My problem is_ :

Apart from the errors above, when the send campaign cron runs, I get a memory exhausted error.

local Php ini already has the following:

display\_errors = Off

max\_execution\_time = 14400

max\_input\_time = 14400

max\_input\_vars = 3000

memory\_limit = -1

post\_max\_size = 64M

session.gc\_maxlifetime = 86400

session.save\_path = “/var/cpanel/php/sessions/ea-php74”

upload\_max\_filesize = 64M

zlib.output\_compression = On

session.gc\_probability = 1

session.gc\_divisor = 1000

allow\_url\_fopen = Off

enable\_dl = Off

file\_uploads = On

_Steps I have tried to fix the problem_ :

I tried adding a php directive to force -1 memory allocation in the Classloader file (due to error below), but it seems to then just time out or something.

In ClassLoader.php line 572:

Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 65536 bytes)

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 3, 2022, 6:36am UTC](https://forum.mautic.org/t/memory-exhausted-error-despite-memory-setting-of-1/21468/2 "2022-07-03T06:36:08Z")

</div>

Hello!  
How often are you running your cronjobs? Is there a chance that a cronjob can’t finish and the same one is started again?  
Joey
