Resolving indoubt transactions

Use this task to resolve indoubt transactions and the messages associated with them.

About this task

Transactions might become stuck in the indoubt state indefinitely because of an exceptional circumstance such as the removal of a node causing messaging engines to be destroyed. When a transaction becomes indoubt, it must be committed or rolled back so that normal processing by the affected messaging engine can continue.

You can use the administrative console to display the messages causing the problem (see Listing messages on a message point). If there are messages involved in an indoubt transaction, the identity of the transaction is shown in a panel associated with the message. You can then resolve the transaction in two ways:
  1. Using the server transaction management panels
  2. Using methods on the messaging engine MBean

You must first attempt to resolve the indoubt transaction by using the application server transaction management MBean interfaces. These are documented in Managing active and prepared transactions by using wsadmin scripting. Use the scripts for all application servers that might have been coordinating transactions, including Messaging actions, for the default messaging provider. If the transaction identity is known by the transaction manager scripts, use those scripts to resolve the transactions. This will consistently resolve all resources (including Messaging) within a global transaction.

If the transaction identity is not known to the transaction manager scripts that run on any application server, or if the application server hosting the transaction manager cannot be recovered, it is possible to use methods on the SIBMessagingEngine MBean to resolve the Messaging part of a transaction independently from the global transaction. The choice to commit or rollback the transaction must be made manually.

The following methods on the messaging engine MBean can be used to get a list of transaction identities (xid) and to commit and roll back transactions:
  • getPreparedTransactions()
  • commitPreparedTransaction(String xid)
  • rollbackPreparedTransaction(String xid)
To invoke the methods, you can use a wsadmin command, for example, you can use a command of the following form to obtain a list of the indoubt transaction identities from a messaging engine MBean:
wsadmin>AdminControl.invoke(AdminControl.queryNames("type=SIBMessagingEngine,*").
splitlines()[0] , "getPreparedTransactions")
[IBM i]Note: [IBM i]The wsadmin scripting client is run from Qshell. [IBM i]For more information, see Configuring Qshell to run WebSphere scripts using wsadmin scripting.
Alternatively, you can use a script such as the following to invoke the methods on the MBean:
import sys

mebeans=AdminControl.queryNames("type=SIBMessagingEngine,*").splitlines()

for mebean in mebeans:
  input=0
  meName=""
  print "--- Start ME: ---------------"
  print mebean
  print "-----------------------------"
  while input>=0:
    xidList=AdminControl.invoke(mebean , "getPreparedTransactions").splitlines()
    print "--- Prepared Transactions ---"
    index=0
    for xid in xidList:
      print "  Index=%s XID=%s" % (index , xid)
      index+=1
    print "------- End of list ---------"
    print "Select index of XID to commit/rollback"
    print "(or enter -1 to skip to next ME):"
    input=int(sys.stdin.readline().strip())

    if input<0:
      print "No index selected."
    else:
      xid=xidList[input]
      print "Enter c to commit or r to rollback XID %s" % xid
      input=sys.stdin.readline().strip()
      if input=="c":
        print "Committing xid=%s" % xid
        AdminControl.invoke(mebean , "commitPreparedTransaction" , xid)
      if input=="r":
        print "Rolling back xid=%s" % xid
        AdminControl.invoke(mebean , "rollbackPreparedTransaction" , xid)
    print
  print "--- End ME --------------------"
  print

print "No more ME definitions found, exiting"

This script lists the transaction identities of the transactions together with an index. You can then select an index and commit or roll back the transaction corresponding to that index.

Procedure

  1. Use the administrative console to find the transaction identity of messages that have indoubt transactions.
  2. Optional: If a transaction identity appears in the transaction management panel, commit or roll back the transactions as required.
  3. Optional: If a transaction identity does not appear in the transaction management panel, use the methods on the messaging engine MBean.
    For example, use a script to display a list of transaction identities for indoubt transactions. For each transaction:
    1. Enter the index of the transaction identity of the transaction.
    2. Optional: Enter c to commit the transaction.
    3. Optional: Enter r to roll back the transaction.
  4. To check that transactions are no longer indoubt, restart the server and use the transaction management panel, or methods on the messaging engine MBean to check.