Jira Server or Data Center is slow with dangerous use of multiple connections error in log
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
JIRA applications become slow during times of heavy usage.
Diagnosis
If you are using JIRA 5.0.3 or later, you can monitor the Connection Pool from within JIRA applications. Go to menu Cog Icon > System > Database Monitoring and you will be presented with a graph of the connection pool statistics over the previous 6 hour period.
If you see the number of Active Connections is consistently at or near the maximum number of connections in the pool (the graph is scaled to the maximum available connections, 20 in the above example) then it indicates that JIRA is suffering from pool exhaustion.
The following lines may appear in atlassian-jira.log
:
2016-03-11 08:40:40,409 Caesium-1-2 WARN anonymous [c.a.jira.ofbiz.ConnectionPoolHealthSqlInterceptor] Dangerous use of multiple connections: taken => count=3; marks=[2-3]; pool=2/20
2016-03-11 08:40:40,409 Caesium-1-2 WARN anonymous [c.a.jira.ofbiz.ConnectionPoolHealthSqlInterceptor] Dangerous use of multiple connections: replaced => count=2; marks=[1-3]; pool=1/20
2016-03-11 08:40:40,409 Caesium-1-2 WARN anonymous [c.a.jira.ofbiz.ConnectionPoolHealthSqlInterceptor] Dangerous use of multiple connections: replaced => count=1; marks=[0-3]; pool=0/20
2016-03-11 08:40:40,409 Caesium-1-2 WARN anonymous [c.a.jira.ofbiz.ConnectionPoolHealthSqlInterceptor] Dangerous use of multiple connections: replaced => count=0; marks=[-1-3]; pool=-1/20
If you are using a version of JIRA prior to 5.0.3, the best way to see this type of behaviour is by Generating a Thread Dump. Below is a sample snippet of a thread dump showing this problem:
"Thread-4" prio=6 tid=0x16d85988 nid=0xe20 in Object.wait() [0x17d9f000..0x17d9fce8]
at java.lang.Object.wait(Native Method)
- waiting on <0x04139d18> (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:748)
- locked <0x04139d18> (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at org.ofbiz.core.entity.transaction.JNDIFactory.getJndiConnection(JNDIFactory.java:168)
at org.ofbiz.core.entity.transaction.JNDIFactory.getConnection(JNDIFactory.java:140)
at org.ofbiz.core.entity.TransactionFactory.getConnection(TransactionFactory.java:99)
at org.ofbiz.core.entity.ConnectionFactory.getConnection(ConnectionFactory.java:53)
at com.atlassian.jira.upgrade.ConnectionKeeper.openConnections(ConnectionKeeper.java:106)
at com.atlassian.jira.upgrade.ConnectionKeeper.run(ConnectionKeeper.java:87)
The lines that indicate this problem are the following:
- locked <0x04139d18> (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
Cause
The default value set for the connection pool in JIRA applications is 20, and it is sufficient for the normal usage. The number of user plugins installed influences the number of database connections in use and it requires that the pool size to be increased.
Resolution
JIRA 5.1+
Increase the maximum number of connections in the connection pool using JIRA configuration tool or by editing the dbconfig.xml
. The parameter to be increased is 'Maximum Size
'. We recommend using the recommended dbconfig.xml
as defined in the appropriate database documentation as specified in Connecting JIRA to a Database.
JIRA 5.1 - 4.4
Modify the dbconfig.xml
and increase the pool-max-size,
parameters. Refer Connecting JIRA to a Database for details about editing pool-min-size
and pool-max-idle
dbconfig.xml
.
JIRA 4.4 and below
Modify the conf/server.xml
and increase the maxActive
, minIdle
and maxIdle
parameters. Refer Connecting JIRA to a Database for details about editing conf/server.xml
. A sample configuration is given below:
<Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.hsqldb.jdbcDriver"
url="jdbc:hsqldb:${catalina.home}/database/jiradb"
minEvictableIdleTimeMillis="4000"
timeBetweenEvictionRunsMillis="5000"
maxActive="20"
minIdle="4"
maxIdle="8"
/>
For information on what these values mean please view the Apache DBCP documentation.