Bugzilla, an open source bug tracking system uses MySQL for the database. When you try to attach a document to the bug that is greater than 1MB in size, you will get the error message shown below. This article explains how to fix this problem by changing the MySQL max_allowed_packet database parameter and bugzilla maxattachmentsize parameter.
When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection.
MySQL client’s default max_allowed_packet value is 16MB. MySQL server’s default max_allowed_packet is 1MB. For bugzilla attachment, we need to increase the max_allowed_packet size of the MySQL server.
Bugzilla error message: The file you are trying to attach is 1396 kilobytes (KB) in size. Non-patch attachments cannot be more than 1000 KB. We recommend that you store your attachment elsewhere on the web, and then insert the URL to it in a comment, or in the URL field for this bug. Alternately, if your attachment is an image, you could convert it to a compressible format like JPG or PNG and try again.
1. Change the maxattachmentsize parameter in Bugzilla
Login to bugzilla and click on “Parameters” link next to the “Edit” section in the footer area. This will display bugzilla configuration menu as shown below. Click on “Attachments” menu-item to display all bugzilla attachment related configuration parameters. Change the values of maxattachmentsize to 3000 for a 3MB limit.
Fig – Bugzilla configuration Menu
maxattachmentsize is the maximum size (in kilobytes) of non-patch attachments. Bugzilla will not accept attachments greater than this number of kilobytes in size. To accept attachments of any size (subject to the limitations of your server software), set this value to zero.
2. Change the max_allowed_packet parameter in MySQL database
Add max_allowed_packet=3M to the MySQL configuration file:/etc/my.cnf as shown below.
[db-server]# cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql max_allowed_packet=3M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] socket=/var/lib/mysql/mysql.sock
Restart the MySQL database for the new max_allowed_packet parameter to take effect.
[db-server]# /etc/rc.d/init.d/mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ]
After the above two changes, you can upload attachments upto 3MB on bugzilla. Also, sometimes when you are restoring a MySQL backup, you may get the following error message.
Got a packet bigger than 'max_allowed_packet' bytes
To resolve this issue, increase the max_allowed_packet as explained above to 32MB or more.
Get the Linux Sysadmin Course Now!