我不是死锁专家,但我所看到的对我来说并不合理。似乎两个不同的进程在同一个对象上死锁。一个进程难道不会等待资源被释放并继续它的生命吗?通常有死锁,涉及2个资源,这就是为什么我感到困惑。
<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>
我认为问题正在发生,因为特定应用程序正在进行更新。本质上,有两个不同的线程可以在事务中更新同一组数据(InnoPickCaseList.Sequence数字的范围),但它可能以不同的顺序进行更新。此时我做了一个更改,就是在两个不同的线程中以相同的方式对数据进行排序,以便更新以相同的顺序进行。
答案 0 :(得分:1)
有两种不同的资源。一个是散列a7110b00
的密钥,另一个是散列bb807a80
的密钥。是真的,他们属于同一个对象ExactaDB.dbo.InnoPickCaseList.PK_InnoPickCaseList
,但它们是不同的。
Sequence
的索引吗?Sequence
列的选择性是多少(多少个不同的值)?InnoPickCaseList
有多大?