Increase Bugzilla Attachment Size Using MySQL max_allowed_packet

by Ramesh Natarajan on October 27, 2008

[Bugzilla Logo]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.

[Bugzilla Configuration - Attachments menu items]

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.


Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: