Can't restore a large space in Confluence Data Center due to MySQL database timeout
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
Summary
Due to its size, the restore space process may take a relatively long time. Sometimes, the database connection can be dropped because of the settings at the database URL level.
Environment
7.19.18
MySQL Database
Diagnosis
In the application logs (atlassian-confluence.log), the restore space process has thrown the below exception;
1
2
3
4
5
6
7
8
9
WARN [Long running task: Importing data] [zaxxer.hikari.pool.ProxyConnection] checkException HikariPool-1 - Connection com.mysql.cj.jdbc.ConnectionImpl@3c2ea6d4 marked as broken because of SQLSTATE(08S01), ErrorCode(0)
-- url: /admin/restore-local-file.action | referer: https://****/admin/backup.action | traceId: fa39f2c03c0eea96 | userName: ****| action: restore-local-file
com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 44,042,836 milliseconds ago. The last packet sent successfully to the server was 44,042,846 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.commit(ConnectionImpl.java:814)
. . .
. . .
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: The last packet successfully received from the server was 44,042,836 milliseconds ago. The last packet sent successfully to the server was 44,042,846 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
This means that the process has lost its connection to the MySQL database and needs to reconnect again to continue to restore space.
Cause
The wait_timeout setting at the database level may have less value than the restoring space process needs. We need to increase it to a higher value to allow Confluence can continue to restore large space without losing the connection.
Solution
Edit the my.cnf file at the database level to set the higher values for the below parameters;
1 2 3
[mysqld] wait_timeout = 28800 interactive_timeout = 28800
Change the database connection URL located in confluence.cfg.xml to add autoReconnect option;
Stop Confluence
Edit <home-directory>confluence.cfg.xml
Change the database connection URL by adding autoReconnect;
1
<property name="hibernate.connection.url">jdbc:mysql://<Database Connection URL>?autoReconnect=true</property>
Start Confluence
Was this helpful?