Configuring database query timeout

If database queries are taking too long to perform, and your application is becoming unresponsive, you can configure a timeout for database queries. There is no default timeout in Confluence.To configure a database query timeout, do the following on your test server:

1. Shut down Confluence.

2. Extract databaseSubsystemContext.xml from the confluence-x.x.x.jar that is in confluence/WEB-INF/lib/, and put a copy in confluence/WEB-INF/classes/.

3. Edit confluence/WEB-INF/classes/databaseSubsystemContext.xml to add the defaultTimeout property to the "transactionManager" bean:

The timeout is measured in seconds and will forcibly abort queries that take longer than this. In some cases, these errors are not handled gracefully by Confluence and will result in the user seeing the Confluence error page.

4. Start Confluence.

Once the timeout is working properly in your test environment, migration the configuration change to Confluence.

(warning) You will need to reapply these changes when upgrading Confluence, as the original databaseSubsystemContext.xml file changes from version to version.

Was this helpful?

Thanks for your feedback!

2 Archived comments

  1. User avatar

    mahaao

    Does there exist any same configuration in JIRA application?

    The timeout will forcibly abort queries that take too long in JIRA.

    10 Feb 2011
  2. User avatar

    Torben Rydiander

    It would be very helpful if you showed the syntax of the defaultTimeout property.

    Here is the transactionManager from version 5.7.4:

    <bean id="transactionManager" class="com.atlassian.confluence.tenant.TenantGate" plugin:available="true">         <plugin:interface>org.springframework.transaction.PlatformTransactionManager</plugin:interface>         <constructor-arg index="0" ref="tenantRegistry"/>         <constructor-arg index="1" value="org.springframework.transaction.PlatformTransactionManager"/>         <lookup-method name="createTenantedDelegate" bean="tenantedTransactionManager"/>         <lookup-method name="createVacantDelegate" bean="noopTransactionManager"/>     </bean>

    Where and how do I put in the defaultTimeout property.

    09 Jun 2015
Powered by Confluence and Scroll Viewport