Exceeds max allowed packet for MySQL
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
One or more of the following is observed:
Cannot install or upgrade a plugin
Cannot upgrade the Universal Plugin Manager
Cannot save large pages
Cannot upload attachments (when attachments are stored in the database)
The following errors may appear in the atlassian-confluence.log:
1
ERROR [pool-6-thread-3] [sf.hibernate.util.JDBCExceptionReporter] logExceptions Packet for query is too large (1889999 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.
1
2
3
4
5
6
7
Cause:
java.lang.RuntimeException: There was a problem evicting or flushing a PluginData object
at com.atlassian.confluence.plugin.persistence.hibernate.HibernatePluginDataDao.saveOrUpdate(HibernatePluginDataDao.java:65)
caused by: net.sf.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:90)
caused by: java.sql.BatchUpdateException: Packet for query is too large (1238730 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1213)
Cause
The MySQL packet size setting by default is not big enough to allow most add-on's to install in the Confluence database. Plugin data, attachments, and large page bodies can often exceed the default limit of 1 Mb. For more information see here:
http://dev.mysql.com/doc/refman/5.6/en/packet-too-large.html
Resolution
Set the MySQL packet size to a larger value (256MB) and restart MySQL Server. 256MB should be large enough to cover most cases.
1
shell> mysqld --max_allowed_packet=256M
Alternatively, you can do this on your MySQL server's settings by editing MySQL's my.cnf
file (often named my.ini
on Windows operating systems). Locate the [mysqld]
section in the file, and add/modify the following parameters:
1
2
3
4
[mysqld]
...
max_allowed_packet = 256M
...
(i) Remember to restart MySQL services in order for the changes above to take effect. For more information, please refer to MySQL manual: http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html.
Note:
If you are unable to stop your database, you can alternatively set the value of the max allowed packet parameter dynamically. To do so:
Log in as a root user.
You'll need to set the value as an integer, rather than '256M'. 256M is equivalent to 256*1024*1024, or 268435456.
mysql> SET GLOBAL max_allowed_packet=268435456;
To check that this has been applied:
Relogin to your mysql client.
mysql> SELECT @@max_allowed_packet;
Restart your Confluence instance.
You will still need to update your /etc/my.cnf file as described in the method above to make the change persistent.
Was this helpful?