JIRA is running out of database connections frequently on MS SQL Server

Still need help?

The Atlassian Community is here for you.

Ask the community

 

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

The JIRA instance is unstable and often runs out of database connections after running for a while, regardless of how much database connections is available to JIRA. Various operations result in errors in the UI. Increasing the number of connection threads does not resolve the issue.

The following appears in the atlassian-jira.log

2016-03-30 09:44:15,288 http-nio-443-exec-124 ERROR anonymous 583x9082x116 admin 100.100.0.10 /projects/PKEY/issues/PKEY-16 [o.o.core.entity.ConnectionFactory] ******* ERROR: No database connection found for helperName "defaultDS"
2016-03-30 09:44:15,925 http-nio-443-exec-113 ERROR admin 583x9074x114 admin 100.100.0.10 /rest/projects/1.0/project/PKEY/lastVisited [NoModule] There was an error getting a DBCP datasource.
java.lang.RuntimeException: Unable to obtain a connection from the underlying connection pool
	at org.ofbiz.core.entity.jdbc.interceptors.connection.ConnectionTracker.trackConnection(ConnectionTracker.java:60)
...
FILL IN LOGCaused by: java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object
	at org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:142)
	at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)
	at org.ofbiz.core.entity.transaction.DBCPConnectionFactory$1.call(DBCPConnectionFactory.java:266)
	at org.ofbiz.core.entity.transaction.DBCPConnectionFactory$1.call(DBCPConnectionFactory.java:263)
	at org.ofbiz.core.entity.jdbc.interceptors.connection.ConnectionTracker.trackConnection(ConnectionTracker.java:54)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:449)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
	at org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:134)

Diagnosis

Environment

Diagnostic Steps

  • You can see if your database is not configured correctly if this query returns a 0 substituting JIRA-DATABASE for your database name.

    SELECT is_read_committed_snapshot_on FROM sys.databases WHERE name= 'JIRA-DATABASE';

Cause

The MS SQL database Isolation Level is not correctly set.

 

Resolution

  1. Shutdown JIRA, backup your database, and open up your MS-SQL Query console
  2. Perform the below query on your database, please substitute JIRA-DATABASE for your database name. If your database is large this process may take some time.

    ALTER DATABASE [JIRA-DATABASE] SET READ_COMMITTED_SNAPSHOT ON
  3. Test to see that the above query returns a 1 to confirm the settings change:   

    SELECT is_read_committed_snapshot_on FROM sys.databases WHERE name= 'JIRA-DATABASE'

    This may take a while if your JIRA database is large.

(info) Note that you would have configured the database correctly if you followed the documentation on connecting JIRA to SQL Server when setting up JIRA database from the beginning, as this covers configuring the database isolation level.

 

Last modified on Nov 2, 2018

Was this helpful?

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