Transaction timeout precedence in JBoss EAP

Solution Verified - Updated

Environment

Issue

  • What timeouts can affect a transaction?
  • What can cause a timeout?
  • Is there a transaction timeout defined in the transaction manager

Resolution

There is no precedence or hierarchy in timeouts relating to a transaction. The smallest value in scope will cause a timeout. Typically the smallest value would be query-timeout.

Timeouts can be caused by network latency, external systems response time, failure of external systems and broken communication channels.

Driver Level

  • Content from docs.oracle.com is not included.Statement Timeout set on the java.sql.Statement
    • Called by setting the following, but result of call is dependent upon driver implementation
      • If the datasource parameter set-tx-query-timeout is true then query timeout will be based on the time remaining until transaction timeout.

Resource Manager (RM)

Transaction Service (TS)

  • com.arjuna uses the following to setRollbackOnly on the javax.transaction.xa.XAResource
    • com.arjuna.ats.jts.defaultTimeout
    • com.arjuna.ats.arjuna.coordinator.txReaperTimeout
      • used by the com.arjuna TS in order to set a transaction to RollbackOnly
      • modified in jbossts-properties.xml
  • See Transaction abort and timeout messages for recommendations regarding transaction timeout configuration (per-transaction and global).

Network & Database Server Level

  • External (e.g. firewall or database server) timeout policy may interrupt/abort activity on connections which may lead to transaction failure
  • A database server initiated timeout of transactions may also impact transaction behavior
  • Noted for reference, out of scope for discussion

Diagnostic Steps

The Byteman rule below can be used to trace cases where statement timeout is set:

RULE java.sql.Statement.
INTERFACE java.sql.Statement
METHOD setQueryTimeout
IF TRUE
DO traceStack("[BMAN] Statement.setQueryTimeout(" + $1 + ")\n");
ENDRULE
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.