Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Info

This page applies to Java Broker versions before 0.20. For the master copy of this documentation see the Producer Transaction Timeout section in the Java documentation

Transaction Timeouts User Guide

Introduction

Qpid 0.11 includes a new feature to allow deployers to configure transaction timeout thresholds, and the associated actions to perform on crossing of the specified threshold.

The transaction timeout mechanism is used to control broker resources when clients producing messages using transactional sessions hang or otherwise become unresponsive, or simply begin a transaction and keep using it without ever calling Session#commit().

Users can choose to configure a Warn an idleWarn or openWarn threshold, after which the identified transaction should be logged as a 'WARN' level alert as well as (more importantly) a Close an idleClose or openClose threshold after which the transaction and the connection it applies to will be closed.

...

The following section provide more details on this feature and its use.

Purpose

This feature has been introduced to address the scenario where an open transaction can include on the broker holds an open transaction on the BDB persistent store. This can have undesirable consequences , preventing the BDB store cleaning thread from rolling forward data efficiently and can result in a rapidly growing store bound only by available disk spaceif the store does not time out or close long-running transactions, such as with Oracle BDB. This can can result in a rapid increase in disk usage size, bounded only by available space, due to growth of the transaction log.

Scope

Note that only MessageProducer clients will be affected by a transaction timeout, since store transaction lifespan on a consumer only spans the execution of the commit call to Session#commit() and there is no scope for a long-lived transaction to arise.

It is also important to note that the transaction timeout mechanism is purely a JMS transaction timeout, and unrelated to any other timeouts in the Qpid client library and will have no impact on any RDBMS your application may utilise.

Effect

Full details of configuration options are provided in the sections that follow. This section gives a brief overview of what the Transaction Timeout feature can do.

Broker Logging and Connection Close

When the 'openWarn' or 'idleWarn' specified threshold is exceeded, the broker will log a 'WARN' level alert with details of the connection and channel on which the threshold has been exceeded, along with the age of the transaction.

When the 'openClose' or 'idelClose' idleClose specified threshold value is exceeded, the broker will throw an exception back to the client on its exception listenerconnection via the ExceptionListener, log the action and then close the connection.

The example broker log output shown below is where the Warn idleWarn threshold specified is lower than the Close idleClose threshold and the broker therefore logs the idle transaction 3 times before the close threshold is triggered and the connection closed out.

...

The second example broker log output shown below illustrates the same mechanism operating on an Open open transaction.

No Format
INFO [qpid.message] MESSAGE [Queue-housekeeping-test][con:2(guest@anonymous(27925944)/test)/ch:2] CHN-1007 : Open Transaction : 12,406 ms
WARN [apache.qpid.server.AMQChannel] OPEN TRANSACTION ALERT [con:2(guest@anonymous(27925944)/test)/ch:2]  12406 ms
INFO [qpid.message] MESSAGE [Queue-housekeeping-test][con:2(guest@anonymous(27925944)/test)/ch:2] CHN-1007 : Open Transaction : 13,406 ms
WARN [apache.qpid.server.AMQChannel] OPEN TRANSACTION ALERT [con:2(guest@anonymous(27925944)/test)/ch:2]  13406 ms
INFO [qpid.message] MESSAGE [Queue-housekeeping-test][con:2(guest@anonymous(27925944)/test)/ch:2] CHN-1007 : Open Transaction : 14,406 ms
WARN [apache.qpid.server.AMQChannel] OPEN TRANSACTION ALERT [con:2(guest@anonymous(27925944)/test)/ch:2]  14406 ms
INFO [qpid.server.protocol.AMQProtocolSession] Closing connection due to: org.apache.qpid.AMQConnectionException:
 Open transaction timed out [error code 506: resource error]
INFO [qpid.message] MESSAGE [Queue-housekeeping-test][con:2(guest@anonymous(27925944)/test)/ch:2] CHN-1003 : Close

Client Side Effect

After a Close threshold has been exceeded, the trigger client will receive this exception on its exception listener, prior to being disconnected:

...

Thus clients must be able to handle this case successfully, reconnecting where required and registering an exception listener on all connections. This is critical, and must be communicated to client applications by any broker owner switching on transaction timeouts.

Configuration

Overview

Transaction timeouts are configurable separately on each defined virtual host, using the virtualhosts.xml file.

...

This should not be an issue for environments using Mule or Spring, where connection factories can be configured appropriately to manage a single MessageProducer object per JMS Session and Connection. Clients that use the JMS API directly should be aware that sessions managing both consumers and producers, or multiple producers, will be affected by a single producer hanging or leaving a transaction idle or open, and closed, and must take appropriate action to handle that scenario.

Virtualhosts.xml Entries

The JMS transaction timeouts are configured on each virtual host defined in the XML configuration files.

...