Page 1 of 1

How to resolve deadlock permanently ?

PostPosted: Fri Mar 06, 2009 12:54 am
by teju
Hi

Can any tell me how to resolve deadlock permanently ?

Thnx

Re: How to resolve deadlock permanently ?

PostPosted: Fri Mar 06, 2009 1:58 am
by dick scherrer
Hello,

Change the order in which the rows are locked.

Right now you have some code that locks some tableA row(s), then some tableB row(s). While that is running, another process locks some tableB row(s), then some tableA row(s). When they are trying to lock the same rows, the deadlock occurs.

If all of the code is designed to lock tableA rows, then TableB rows, the deadlock will not happen. This sometimes means locking a row before it is actually needed by the code.

If there is reluctance to change the code, it becomes a scheduling problem. The tasks that deadlock should not be run concurrently.

Re: How to resolve deadlock permanently ?

PostPosted: Fri Mar 06, 2009 5:26 am
by teju
Can u tell me about negative dependency? how it is related in resolving deadlocks

Re: How to resolve deadlock permanently ?

PostPosted: Fri Mar 06, 2009 5:57 am
by dick scherrer
Hello,

Negative dependency is a scheduling term, rather than a database term (at least the one i'm familiar with :) ).

This could help with deadlocks as the confilcting tasks could be defined to the scheduling software such that neither would be submitted while the other was executing. It is a more formal term than
The tasks that deadlock should not be run concurrently.