How to change default JTA transaction timeout in JBoss EAP?

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • coordinator-environment specified in
    • jboss-as-txn_1_0.xsd
    • jboss-as-txn_1_1.xsd
    • jboss-as-txn_1_2.xsd
    • jboss-as-txn_1_3.xsd
    • jboss-as-txn_1_4.xsd
    • jboss-as-txn_1_5.xsd
    • jboss-as-txn_2_0.xsd
  • Red Hat JBoss Enterprise Application Platform (EAP) 8

Issue

  • Change the JTA transaction timeout
  • Specify the default-timeout for the transaction reaper / coordinator-environment
  • Disable transaction timeout for a pool where the datasource does not support transaction timeout

Resolution

The default transaction timeout has been defined under "default-timeout" attribute at "transactions" subsystem in the application server configuration.1

  • The default is 300 seconds / 5 minutes.

The default transaction timeout is meant to provide a safeguard against unexpectedly long running transactions which may negatively impact system performance as a whole. For this reason, increasing the default is not recommended in a production system as this weakens the ability of JBoss to protect the system from unexpected behavior. In most cases, the proper resolution for a long running transaction is to address performance problems that lead to the failure of the transaction to complete in a timely fashion. If issues with a specific workflow cannot be addressed, a per-transaction timeout should be used. If per-transaction timeout cannot be used as a workaround, the following may be used with caution.

  • You may modify the value to increase the default transaction timeout
  • You may set the value to 0 to disable the transaction reaper / transaction timeout
    • Disabling transaction timeout is not recommended in a production system as this opens a dangerous vulnerability that may have a system wide impact (e.g. negatively impacting database servers, the network, etc.).
  • The application server VM must be restarted for the default-timeout change to be applied
<subsystem xmlns="urn:jboss:domain:transactions:1.4">
    ...(snip)...
    <coordinator-environment default-timeout="300"/>  <!-- HERE -->
</subsystem>
For JBoss EAP 8
<subsystem xmlns="urn:jboss:domain:transactions:6.0">
....
....
     <coordinator-environment statistics-enabled="${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}}" default-timeout="300"/>  <!-- HERE -->
....
</subsystem>

You can use CLI2 or management console to achieve the same:

  • On CLI: Execute the following CLI in jboss-cli.sh to modify the value. The following example is changing the value to 600 seconds. Note that you need to prepend /profile=<your-profile-name> to the CLI in domain mode:
/subsystem=transactions:write-attribute(name=default-timeout,value=600)
  • On the management console: Please select "Profile" tab and select "Container". Then click on "Transactions" to edit the default timeout.
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.