Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
10.2.2.0
-
None
-
None
Description
When a deadlock occurs, derby includes the cycle of locks which caused the deadlock in the SQLException message. This is also printed to derby.log if the properties derby.locks.deadlockTrace and derby.locks.monitor are set to true, or if debug code is being used (e.g. jars from lib-debug distributions). It will be easier to debug deadlocks if the entire lock table is printed to derby.log as well (alternatively to both derby.log and the exception message) in these cases. An example of such a lock table is available at http://wiki.apache.org/db-derby/LockDebugging.
For example, in a long-running test I have observed deadlocks with lock cycle messages such as:
Lock : ROW, DELETED, (2,1)
Waiting XID :
, U1, DELETE FROM "U1"."DELETED" WHERE CURRENT OF "SQL_CURLH000C9"
Granted XID :
Lock : ROW, DELETED, (3,3523)
Waiting XID :
, U1, SELECT ITEMID FROM DELETED
Granted XID :
. The selected victim is XID : 6241401573.
It is not clear from this output why XID 6241401573 is waiting for a shared lock (S) on row (2,1), as an S lock is compatible with other S locks [1].
Having a snapshot of the contents of the lock table at the time of the deadlock would probably help a great deal in the debugging process.
[1]: Lock compatibility: http://db.apache.org/derby/docs/dev/devguide/rdevconcepts2462.html
Attachments
Issue Links
- relates to
-
DERBY-3980 Conflicting select then update with REPEATABLE_READ gives lock timeout instead of deadlock
- Closed
-
DERBY-5073 Derby deadlocks without recourse on simultaneous correlated subqueries
- Closed
-
DERBY-2828 derby.locks.deadlockTrace docs claim the property is meaningless without derby.locks.monitor=true
- Closed
-
DERBY-666 Enhance derby.locks.deadlockTrace to print stack traces for all threads involved in a deadlock
- Open
-
DERBY-2845 Devguide tips on debugging deadlocks should be clearer
- Closed