JIRA is running out of database connections frequently on MS SQL Server
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
問題
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)
診断
環境
- Observed with JIRA 7.1 and SQL Server
- Use our monitoring database connection usage to see the database connection fill up
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';
原因
The MS SQL database Isolation Level is not correctly set.
ソリューション
- Shutdown JIRA, backup your database, and open up your MS-SQL Query console
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
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.
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.