Question

I'm no expert on deadlocks but what I'm seeing doesn't quite make sense to me. It appears that two different processes are deadlocking on the same object. Wouldn't the one process just wait on the resource to be released and move on with it's life? Usually with deadlocking there are 2 resources involved and that's why I'm confused.

Deadlock:

<deadlock-list>
 <deadlock victim="process53f288">
  <process-list>
   <process id="process53f288" taskpriority="0" logused="264" waitresource="KEY: 7:72057594065977344 (651c594e0a33)" waittime="4406" ownerId="293044707" transactionname="user_transaction" lasttranstarted="2013-10-03T15:41:21.040" XDES="0x80cd53c0" lockMode="X" schedulerid="1" kpid="14284" status="suspended" spid="92" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-10-03T15:41:21.560" lastbatchcompleted="2013-10-03T15:41:21.553" clientapp=".Net SqlClient Data Provider" hostname="MCCMTLMCS001" hostpid="2952" loginname="asapdb" isolationlevel="read committed (2)" xactid="293044707" currentdb="7" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
    <executionStack>
     <frame procname="adhoc" line="1" stmtstart="34" sqlhandle="0x0200000065487b054151f9a8d40f9f90d40cba7ff11e6228">
UPDATE InnoPickCaseList SET DestinationSpiral = @p0 WHERE Sequence = @p1     </frame>
     <frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
unknown     </frame>
    </executionStack>
    <inputbuf>
(@p0 int,@p1 int)UPDATE InnoPickCaseList SET DestinationSpiral = @p0 WHERE Sequence = @p1    </inputbuf>
   </process>
   <process id="process7ed948" taskpriority="0" logused="4556" waitresource="KEY: 7:72057594065977344 (62b5bdcd3e80)" waittime="4403" ownerId="293044717" transactionname="user_transaction" lasttranstarted="2013-10-03T15:41:21.050" XDES="0x1298df950" lockMode="X" schedulerid="4" kpid="7344" status="suspended" spid="94" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-10-03T15:41:21.560" lastbatchcompleted="2013-10-03T15:41:21.557" clientapp=".Net SqlClient Data Provider" hostname="MCCMTLMCS001" hostpid="2952" loginname="asapdb" isolationlevel="read committed (2)" xactid="293044717" currentdb="7" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
    <executionStack>
     <frame procname="adhoc" line="1" stmtstart="34" sqlhandle="0x0200000065487b054151f9a8d40f9f90d40cba7ff11e6228">
UPDATE InnoPickCaseList SET DestinationSpiral = @p0 WHERE Sequence = @p1     </frame>
     <frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
unknown     </frame>
    </executionStack>
    <inputbuf>
(@p0 int,@p1 int)UPDATE InnoPickCaseList SET DestinationSpiral = @p0 WHERE Sequence = @p1    </inputbuf>
   </process>
  </process-list>
  <resource-list>
   <keylock hobtid="72057594065977344" dbid="7" objectname="ExactaDB.dbo.InnoPickCaseList" indexname="PK_InnoPickCaseList" id="locka7110b00" mode="X" associatedObjectId="72057594065977344">
    <owner-list>
     <owner id="process7ed948" mode="X"/>
    </owner-list>
    <waiter-list>
     <waiter id="process53f288" mode="X" requestType="wait"/>
    </waiter-list>
   </keylock>
   <keylock hobtid="72057594065977344" dbid="7" objectname="ExactaDB.dbo.InnoPickCaseList" indexname="PK_InnoPickCaseList" id="lockbb807a80" mode="X" associatedObjectId="72057594065977344">
    <owner-list>
     <owner id="process53f288" mode="X"/>
    </owner-list>
    <waiter-list>
     <waiter id="process7ed948" mode="X" requestType="wait"/>
    </waiter-list>
   </keylock>
  </resource-list>
 </deadlock>
</deadlock-list>

Graph

enter image description here

Additional details

  • InnoPickCaseList.Sequence is the primary key on the table and it has a clustered index
  • Table generally contains around 10k records

I think the issue is occurring because of the way a particular application is doing it's updates. Essentially there are two different threads that could be updating the same set of data (range of InnoPickCaseList.Sequence numbers) within a transaction but it could be doing the updates in a different order. I've made a change at this point to order the data in the same way across the two different threads such that the updates would occur in the same sequence.

Was it helpful?

Solution

There are two different resources. One is the key with hash a7110b00 and the other is the key with hash bb807a80. Is tru that they belong to the same object ExactaDB.dbo.InnoPickCaseList.PK_InnoPickCaseList, but they are different none the less.

  1. Do you have an index on Sequence ?
  2. What is the selectivity of the Sequence column (how many distinct values)?
  3. How big is InnoPickCaseList ?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top