View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0013391||phpList 3 application||Bounce Management||public||21-02-08 19:51||21-06-18 13:00|
|Priority||normal||Severity||text||Reproducibility||have not tried|
|Summary||0013391: MySQL error 1153 -- 'max_allowed_packet' exceeded when processing bounces with large attachments|
|Description||This fix was posted on the forum by thdyck:|
**** START QUOTE ****
When processing bounces, I was getting a database error of:
Database error 1153 while doing query Got a packet bigger than 'max_allowed_packet' bytes
for every bounce in my queue and the bounce was being retrieved but not stored in the database (that is, lost).
Our list sends out attachments with e-mails and so the bounces are 3-5 MB in size.
We are using MySQL 5.0.45 in a shared hosting environment. The documented solution is to change the max_allowed_packet server parameter to allow for larger inserts (the default limits SQL commands to 1048576 bytes). Because I do not control the server, I cannot change the server settings.
The MySQL documentation says that clients can also set this dynamically by issuing a "set session" command. e.g.
$increase = mysql_query("set session max_allowed_packet=10000000");
if ($increased!=FALSE) echo "Can not increase packet size";
However, I did this right before the insert into the bounce table that causes the problem and it didn't prevent the error. I also read the value back to ensure it had been changed and the session setting value had indeed been changed, but the solution still did not work. Some others have posted messages on MySQL forums saying the same. Changing the server parameters in other ways does appear to work, if you can do that.
So, as another approach, I edited the code inserting bounced messages into the database to limit the message body to 1000000 bytes in size, which avoids the issue entirely. They still process correctly as all the header information is still included.
Sql_Query(sprintf('insert into %s (date,header,data)
+ addslashes(substr($body,0,1000000)))); # limit body of bounced message to 1 million bytes to avoid a MySQL max_allowed_packet limit
This fixes the problem for me. Hope this helps someone else.
Tim Miller Dyck
**** END QUOTE ****