Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-39677

JIRA leaks database connections while indexing

XMLWordPrintable

      Summary

      A bug in JIRA, exposed by a certain version of the JIRA Toolkit plugin, will cause JIRA to leak database connections from the Database Connection Pool (DBCP) whilst indexing. This will result in an exhaustion of available connections in the DBCP and JIRA will not function as expected. It's the same behaviour as described in our JIRA Stops Functioning due to Timeout waiting for idle object KB article.

      Steps to Reproduce

      1. Install JIRA toolkit 0.35.10 or higher.
      2. Create a "Last public comment date" custom field.
      3. Go to issue search and include this field as a column on the search.
      4. Run a search returning 50 or so issues (more than configured max connections in dbconfig.xml).

      Expected Results

      JIRA indexes as per normal without any failures.

      Actual Results

      The number of active connections in DBCP spikes and they are not released back into the connection pool. As a result of this the following exceptions will be thrown, affecting JIRA's functionality:

      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:59)
          at org.ofbiz.core.entity.transaction.DBCPConnectionFactory.trackConnection(DBCPConnectionFactory.java:242)
          at org.ofbiz.core.entity.transaction.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:73)
          at org.ofbiz.core.entity.ConnectionFactory.tryGenericConnectionSources(ConnectionFactory.java:69)
          at org.ofbiz.core.entity.transaction.JNDIFactory.getConnection(JNDIFactory.java:146)
          at org.ofbiz.core.entity.TransactionFactory.getConnection(TransactionFactory.java:101)
          at org.ofbiz.core.entity.ConnectionFactory.getConnection(ConnectionFactory.java:59)
          at org.ofbiz.core.entity.jdbc.SQLProcessor.getConnection(SQLProcessor.java:367)
          at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:584)
          at org.ofbiz.core.entity.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:97)
          at org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:609)
          at org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:647)
          ...
      Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
          at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
          at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
          at org.ofbiz.core.entity.transaction.DBCPConnectionFactory$1.call(DBCPConnectionFactory.java:246)
          at org.ofbiz.core.entity.transaction.DBCPConnectionFactory$1.call(DBCPConnectionFactory.java:243)
          at org.ofbiz.core.entity.jdbc.interceptors.connection.ConnectionTracker.trackConnection(ConnectionTracker.java:53)
          ... 236 more
      Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
          at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1134)
          at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
          at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
          ... 240 more
      

      Workaround

      Downgrade JIRA Toolkit plugin to version 0.35.9 (compatible with JIRA Server 6.2 - 6.3.15) or disable the plugin.

      To disable:

      1. Browse to the Add-on Manager.
      2. Search for the JIRA Toolkit plugin and click on the disable button.
      3. Reindex JIRA.

      To downgrade:

      1. Browse to the Add-on Manager.
      2. Uninstall the current version.
      3. Download 0.35.9 from the Atlassian Marketplace.
      4. Manually upload the JAR as per Installing add-ons.
      5. Reindex JIRA.

              ohernandez@atlassian.com Oswaldo Hernandez (Inactive)
              101ec24b4e2e Martin Sander
              Votes:
              10 Vote for this issue
              Watchers:
              38 Start watching this issue

                Created:
                Updated:
                Resolved: