Confluence with JNDI Connector Crashes Under Heavy Load Due to Database Connection Issues
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
Confluence frequently crashes under heavy load when using a JNDI connector and the Tomcat 8 connection pool
The following appears in the atlassian-confluence
.log
2015-11-24 15:38:32,626 ERROR [ContainerBackgroundProcessor[StandardEngine[Standalone]]] [sf.hibernate.util.JDBCExceptionReporter] logExceptions Cannot get a connection, general error
2015-11-24 15:39:20,591 WARN [localhost-startStop-1] [tomcat.dbcp.dbcp2.BasicDataSourceFactory] log Name = confluence Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "15" for "maxActive" property, which is being ignored.
Diagnosis
Environment
- Confluence 5.8 or above
- Tomcat 8 or above
JNDI connection is being used in
server.xml
withmaxActive
<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource" ... maxActive="30" ... />
Cause
In Tomcat 8 the syntax for the connection pool has changed from using MaxActive
to MaxTotal
and the default value is 8. This can cause database connection issues.
Resolution
In conf/server.xml
change maxActive
to maxTotal
<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"
...
maxTotal="30"
...
/>
See Configuring a MySQL Datasource in Apache Tomcat for an example.