Detect deadlocks

Find deadlock conditions by using these instructions.

A deadlock condition can occur when a job holds a lock on an object, object A, and is waiting to obtain a lock on another object, object B. At the same time, another job or transaction currently holds a lock on object B and is waiting to obtain a lock on object A.

Do the following steps to find out if a deadlock condition has occurred and fix it if it has:

  1. Locate the suspended job in the list of active jobs.
  2. Look at the objects the job is waiting to lock.
  3. For all the objects the job is waiting to lock, look at the list of lock holders (transactions or jobs) and try to find a conflicting lock corresponding to the level requested by the suspended job.
  4. If a transaction is holding a conflicting lock, display the jobs associated with this transaction and see if one of them is waiting to lock.
  5. Determine if this waiting job is trying to lock one of the objects locked by the initial suspended job. When you find the job that is trying to lock on of the objects locked by the initial suspended job, you can identify the objects in question as the trouble spots.
  6. Investigate the transaction in order to determine the appropriate course of action.
    1. Look at the transaction properties to find out what application initiated it and then look at the application code.
    2. Or trace the transaction's actions up to this point by finding the Commit cycle ID in the transaction properties and then searching in a journal for entries containing this ID. To do this, you can use the Retrieve Journal Entry (RTVJRNE) command and specify the CMTCYCID parameter.
    3. After obtaining relevant information, you can choose to force a rollback or commit operation.
Related tasks
Minimize locks
Determine the status of a job
Display locked objects for a transaction
Display jobs associated with a transaction
Display commitment control information
When to force commits and rollbacks and when to cancel resynchronization
Related reference
Retrieve Journal Entry (RTVJRNE) command