Mautic Community Forums

MySQL server has gone away

Hi,



My colleagues at commercial created a new campaign with tracking, but we are having a strange issue. If we open the link with a browser that is signed in on Mautic web interface, the link opens/redirects normally. However, if we open it when logged out of Mautic, we get the following error:



[2017-12-06 13:44:52] mautic.WARNING: PHP Warning - PDOStatement::execute(): MySQL server has gone away - in file /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php - at line 105 [] []

[2017-12-06 13:44:52] mautic.WARNING: PHP Warning - PDOStatement::execute(): Error reading result set’s header - in file /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php - at line 105 [] []

[2017-12-06 13:44:52] mautic.CRITICAL: Uncaught PHP Exception DoctrineDBALExceptionDriverException: “An exception occurred while executing…



General error: 2006 MySQL server has gone away at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115, Doctrine\DBAL\Driver\PDOException(code: HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107, PDOException(code: HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105)”} []



Output truncated due to a very long query. The browser just outputs error 500 - Internal server error



However, when opening same link when logged in, no errors are produced in the logs and link opens normally. We rebooted the server, did the following changes as per various posts found online to my.cnf:



max_allowed_packet=100M # Went up to 400M

innodb_buffer_pool_size=512M

query_cache_type=1 # 1 and 0

wait_timeout=28800



Commercial removed and re-created campaign with no success.



Setup running on Centos 7 fully updated as at 16th November, PHP 7.0.25 and fully updated Mautic.



Spent the whole morning trying to figure out what is causing the issue, but can’t find why mysql/php is logging that error. Appreciate any help/suggestions you can provide.

The same thing here… I installed fresh systems, fresh mautics and fresh databases for the whole day yesterday and today, everytime I get database errors, mariadb shutdowns without understandable errors and mautic’s log says that the connection with db was lost after receiving a php error.
In addition, there’s no way to find anything in the documentation or in the forums because here I can only find questions, and google redirects me always to the old unexistant forum…
Any help?

Same problem

I had same problem with 5.5.56-MariaDB. Updated database to 10.1.29-MariaDB and its working again.

Also getting the same errors which seems to have started happening recently - had previously sent several thousand emails and then this error springs up, even when sending a single email.

Unsure what might have changed in the interim but will do a bit more digging!

Ive got a similar problem now, never had it before and now it happens… I have set the following in mysql

max_allowed_packet = 100M
innodb_log_file_size = 128M
wait_timeout = 28800

I am trying to send emails to about 300k people and seems the size of the set is the problem

The error occurs as such

 [Doctrine\DBAL\Exception\DriverException]

An exception occurred while executing ‘SELECT ch.lead_id, IFNULL(fr.frequency_number,?) as frequency_number, IFNULL(fr.frequency_time,?) as frequency_time FROM pb_email_stats ch LEFT JOIN pb_lead_freque
ncyrules fr ON ch.lead_id = fr.lead_id WHERE (fr.channel = ? or fr.channel is null) AND (ch.date_sent >= case fr.frequency_time
when ‘MONTH’ then DATE_SUB(NOW(),INTERVAL 1 MONTH)
when ‘DAY’ then DATE_SUB(NOW(),INTERVAL 1 DAY)
when ‘WEEK’ then DATE_SUB(NOW(),INTERVAL 1 WEEK)
else DATE_SUB(NOW(),INTERVAL 1 WEEK)
end) AND (ch.lead_id IN (481342, 481354, 481356, 481365, 481386, 481390, 481412, 481429, 481448, 481457, 481459, 481461, 481467, 481468, 481471, 481478, 481480, 481482, 481486, 48149
1, 481495, 481499, 481500, 481501, 481502, 481512, 481513, 481530, 481535, 481536, 481547, 481551, 481553, 481556, 481560, 481561, 481583, 481585, 481593, 481601, 481613, 481615, 481631, 481634, 481640,
481646, 481662, 481664, 481665, 481678, 481680, 481695, 481696, 481701, 481705, 481709, 481714, 481723, 481735, 481737, 481748, 481753, 481773, 481776, 481788, 481790, 481792, 481806, 481809, 481817, 4
81818, 481823, 481837, 481843, 481844, 481857, 481864, 481865, 481872, 481876, 481890, 481898, 481908, 481922, 481924, 481935, 481937, 481941, 481944, 481950, 481951, 481961, 481968, 481982, 481983, 481
988, 481993, 481997, 482006, 482010, 482013, 482023, 482036, 482041, 482044, 482045, 482051, 482102, 482104, 482117, 482120, 482125, 482126, 482127, 482132, 482143, 482147, 482153, 482154, 482165, 48216
7, 482184, 482192, 482204, 482209, 482211, 482217, 482220, 482222, 482230, 482240, 482246, 482251, 482255, 482257, 482259, 482262, 482268, 482275, 482279, 482288, 482302, 482313, 482323, 482324, 482327,
482334, 482344, 482350, 482357, 482365, 482407, 482414, 482415, 482423, 482426, 482436, 482439, 482454, 482464, 482475, 482484, 482488, 482496, 482500, 482506, 482509, 482511, 482515, 482516, 482518, 4
82531, 482532, 482533, 482534, 482540, 482545, 482546, 482568, 482569, 482571, 482572, 482577, 482579, 482583, 482584, 482589, 482591, 482599, 482600, 482604, 482617, 482623, 482626, 482627, 482639, 482
640, 482647, 482653, 482657, 482665, 482679, 482686, 482689, 482691, 482700, 482708, 482710, 482711, 482723, 482741, 482745, 482752, 482753, 482754, 482757, 482762, 482763, 482765, 482767, 482773, 48278
0, 482791, 482798, 482803, 482806, 482816, 482825, 482833, 482844, 482850, 482852, 482869, 482877, 482886, 482890, 482896, 482901, 482908, 482910, 482920, 482927, 482930, 482937, 482938, 482944, 482949,
482959, 482964, 482978, 482986, 482989, 482990, 482991, 482993, 482994, 482996, 483004, 483008, 483015, 483024, 483033, 483043, 483052, 483053, 483059, 483062, 483068, 483069, 483071, 483078, 483089, 4
83097, 483100, 483114, 483118, 483124, 483125, 483129, 483145, 483158, 483165, 483168, 483174, 483181, 483190, 483216, 483233, 483240, 483242, 483249, 483257, 483260, 483264, 483266, 483273, 483279, 483
289, 483293, 483306)) GROUP BY ch.lead_id, fr.frequency_time, fr.frequency_number HAVING (count(ch.lead_id) >= IFNULL(fr.frequency_number,?) AND ch.lead_id IN (481342, 481354, 481356, 481365, 481386, 48
1390, 481412, 481429, 481448, 481457, 481459, 481461, 481467, 481468, 481471, 481478, 481480, 481482, 481486, 481491, 481495, 481499, 481500, 481501, 481502, 481512, 481513, 481530, 481535, 481536, 4815
47, 481551, 481553, 481556, 481560, 481561, 481583, 481585, 481593, 481601, 481613, 481615, 481631, 481634, 481640, 481646, 481662, 481664, 481665, 481678, 481680, 481695, 481696, 481701, 481705, 481709
, 481714, 481723, 481735, 481737, 481748, 481753, 481773, 481776, 481788, 481790, 481792, 481806, 481809, 481817, 481818, 481823, 481837, 481843, 481844, 481857, 481864, 481865, 481872, 481876, 481890,
481898, 481908, 481922, 481924, 481935, 481937, 481941, 481944, 481950, 481951, 481961, 481968, 481982, 481983, 481988, 481993, 481997, 482006, 482010, 482013, 482023, 482036, 482041, 482044, 482045, 48
2051, 482102, 482104, 482117, 482120, 482125, 482126, 482127, 482132, 482143, 482147, 482153, 482154, 482165, 482167, 482184, 482192, 482204, 482209, 482211, 482217, 482220, 482222, 482230, 482240, 4822
46, 482251, 482255, 482257, 482259, 482262, 482268, 482275, 482279, 482288, 482302, 482313, 482323, 482324, 482327, 482334, 482344, 482350, 482357, 482365, 482407, 482414, 482415, 482423, 482426, 482436
, 482439, 482454, 482464, 482475, 482484, 482488, 482496, 482500, 482506, 482509, 482511, 482515, 482516, 482518, 482531, 482532, 482533, 482534, 482540, 482545, 482546, 482568, 482569, 482571, 482572,
482577, 482579, 482583, 482584, 482589, 482591, 482599, 482600, 482604, 482617, 482623, 482626, 482627, 482639, 482640, 482647, 482653, 482657, 482665, 482679, 482686, 482689, 482691, 482700, 482708, 48
2710, 482711, 482723, 482741, 482745, 482752, 482753, 482754, 482757, 482762, 482763, 482765, 482767, 482773, 482780, 482791, 482798, 482803, 482806, 482816, 482825, 482833, 482844, 482850, 482852, 4828
69, 482877, 482886, 482890, 482896, 482901, 482908, 482910, 482920, 482927, 482930, 482937, 482938, 482944, 482949, 482959, 482964, 482978, 482986, 482989, 482990, 482991, 482993, 482994, 482996, 483004
, 483008, 483015, 483024, 483033, 483043, 483052, 483053, 483059, 483062, 483068, 483069, 483071, 483078, 483089, 483097, 483100, 483114, 483118, 483124, 483125, 483129, 483145, 483158, 483165, 483168,
483174, 483181, 483190, 483216, 483233, 483240, 483242, 483249, 483257, 483260, 483264, 483266, 483273, 483279, 483289, 483293, 483306))’ with params [“3”, “WEEK”, “email”, “3”]:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away