# Database locking when sending emails

**URL:** <https://forum.mautic.org/t/database-locking-when-sending-emails/3022>\
**Category:** Product Support\
**Created:** [December 19, 2015, 7:08pm UTC](https://forum.mautic.org/t/database-locking-when-sending-emails/3022 "2015-12-19T19:08:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehill](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ehill](https://forum.mautic.org/u/ehill)\
**Post date:** [December 19, 2015, 7:08pm UTC](https://forum.mautic.org/t/database-locking-when-sending-emails/3022/1 "2015-12-19T19:08:34Z")

</div>

We have gotten these two error messages in two email sends:  
  
[2015-12-19 15:14:26] mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALDBALException: “An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [23, 311]: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction” at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 91 {“exception”:"[object] (Doctrine\DBAL\DBALException(code: 0): An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [23, 311]:nnSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855)"} []  
  
[2015-12-19 15:20:01] mautic.ERROR: Fatal: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) - in file /var/www/html/prod/app/bundles/EmailBundle/EventListener/ReportSubscriber.php - at line 228 [] []  
  
  
  
and then:  
  
  
  
  
  
[2015-12-19 18:47:02] mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALDBALException: “An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [1, 322]: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction” at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 91 {“exception”:"[object] (Doctrine\DBAL\DBALException(code: 0): An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [1, 322]:nnSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855)"} []

---

<div class="post-metadata">

**Author:** ![ehill](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ehill](https://forum.mautic.org/u/ehill)\
**Post date:** [December 19, 2015, 7:08pm UTC](https://forum.mautic.org/t/database-locking-when-sending-emails/3022/2 "2015-12-19T19:08:34Z")

</div>

We have gotten these two error messages in two email sends:  
[2015-12-19 15:14:26] mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALDBALException: “An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [23, 311]: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction” at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 91 {“exception”:"[object] (Doctrine\DBAL\DBALException(code: 0): An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [23, 311]:nnSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855)"} []  
[2015-12-19 15:20:01] mautic.ERROR: Fatal: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) - in file /var/www/html/prod/app/bundles/EmailBundle/EventListener/ReportSubscriber.php - at line 228 [] []

and then:

[2015-12-19 18:47:02] mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALDBALException: “An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [1, 322]: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction” at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 91 {“exception”:"[object] (Doctrine\DBAL\DBALException(code: 0): An exception occurred while executing ‘UPDATE mautic12\_emails SET read\_count = ? WHERE id = ?’ with params [1, 322]:nnSQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/prod/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:855)"} []

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:56pm UTC](https://forum.mautic.org/t/database-locking-when-sending-emails/3022/3 "2020-02-02T22:56:20Z")

</div>


