Can't restore a large space in Confluence Data Center due to MySQL database timeout

Still need help?

The Atlassian Community is here for you.

Ask the community

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;

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

  1. Edit the my.cnf file at the database level to set the higher values for the below parameters;

    [mysqld]
    wait_timeout = 28800
    interactive_timeout = 28800
  2. Change the database connection URL located in confluence.cfg.xml  to add autoReconnect  option;
    1. Stop Confluence
    2. Edit <home-directory>confluence.cfg.xml 
    3. Change the database connection URL by adding autoReconnect;

          <property name="hibernate.connection.url">jdbc:mysql://<Database Connection URL>?autoReconnect=true</property>
    4. Start Confluence


Last modified on Jul 16, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.