Unable to create a Confluence XML site backup when using MySQL
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
You are not able to create an XML site backup, specifically when using MySQL as your database with Confluence.
The following appears in the atlassian-confluence.log
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
WARN [http-nio-8090-exec-58] [v2.c3p0.impl.NewPooledConnection] log [c3p0] Another error has occurred [ com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. ] which will not be reported to listeners!
Cause
MySQL closes the database connection that Confluence is using while creating the XML backup, which is a long-running process.
Workaround
Increase the interactive_timeout and wait_timeout in MySQL.
interactive_timeout: The number of seconds the server waits for activity on an interactive connection before closing it.
wait_timeout: The number of seconds the server waits for activity on a non-interactive connection before closing it.
Find out your current timeout values by running the following in MySQL with a privileged account:
SHOW VARIABLES LIKE '%timeout%';
- Edit the my.cnf file and increase the interactive_timeout and wait_timeout to be higher than the current value. You can do this by adding the respective variable and value under the [mysqld] section.Default Values
[mysqld] wait_timeout = 28800 interactive_timeout = 28800
Restart MySQL to apply the changes