Confluence XML Backup fails in Azure SQL Database with "The connection is closed" error
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
When taking XML backups in Confluence, the following errors appears after some time and XML backup fails.
WARN [Caesium-1-1] [v2.c3p0.impl.NewPooledConnection] log [c3p0] Another error has occurred [ com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. ] which will not be reported to listeners!
com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Diagnosis
Environment
This can happen when Confluence is using Azure SQL Database.
Diagnostic Steps
XML backup will kick off successfully and will continue for a while until it fails with this error. This issue is usually repeatable and the backup will fail after a specific period of time.
Cause
Its likely that Azure SQL drops the database connection after a certain time frame. For exact reason, it will be best to contact Azure SQL support.
Workaround
This issue can be avoided by changing the mode of SQL connectivity from proxy mode to redirect mode.
According to the guide of Azure SQL, these modes mean the following.
Redirect mode
A policy of Redirect means that connections after the TCP session is established to the Azure SQL database, the client session is then redirected to the proxy middleware with a change to the destination virtual IP from that of the Azure SQL Database gateway to that of the proxy middleware. Thereafter, all subsequent packets flow directly via the proxy middleware, bypassing the Azure SQL Database gateway.
Proxy Mode
A policy of Proxy means that the TCP session is established via the Azure SQL Database gateway and all subsequent packets flow via the gateway.
More information about this can be found in the following articles.
- Azure SQL Database Connectivity Architecture
- Use Virtual Network service endpoints and rules for Azure SQL Database and SQL Data Warehouse
- Connect to Azure SQL Database V12 via Redirection