Я получаю исключение тупика SQL для операторов выбора. ПОЧЕМУ ЭТО ТАК? Ниже приведен XML-отчет о взаимоблокировке:
<deadlock>
<victim-list>
<victimProcess id="process2f7b088"/>
</victim-list>
<process-list>
<process id="process2f7b088" taskpriority="0" logused="5036" waitresource="KEY: 7:72057594042908672 (7c056d827cc3)" waittime="2497" ownerId="2702472" transactionname="user_transaction" lasttranstarted="2019-10-30T03:59:35.440" XDES="0x1878e987b0" lockMode="S" schedulerid="37" kpid="3268" status="suspended" spid="57" sbid="0" ecid="0" priority="0" trancount="1" lastbatchstarted="2019-10-30T03:59:35.437" lastbatchcompleted="2019-10-30T03:59:35.443" lastattention="2019-10-30T03:59:35.433" clientapp=".Net SqlClient Data Provider" hostname="BY3SCH106010521" hostpid="6692" loginname="NT AUTHORITY\SYSTEM" isolationlevel="read committed (2)" xactid="2702472" currentdb="7" currentdbname="IronMan" lockTimeout="4294967295" clientoption1="671219744" clientoption2="128056">
<executionStack>
<frame procname="IronMan.dbo.addRequestDependencyInternal" line="9" stmtstart="534" stmtend="964" sqlhandle="0x03000700a8429701375d7500d9aa000001000000000000000000000000000000000000000000000000000000"> insert into @dependentIds select distinct RequestId from RequestFileModificationList where IsActive = 1 and FilePath = ANY (select FilePath from RequestFileModificationList where RequestId =@id </frame>
<frame procname="IronMan.dbo.addToFileModificationListTable" line="36" stmtstart="2220" stmtend="2360" sqlhandle="0x030007006f1ea300305d7500d9aa000001000000000000000000000000000000000000000000000000000000"> execute addRequestDependencyInternal @id, @noOfRequestsAhead out; </frame>
</executionStack>
<inputbuf> Proc [Database Id = 7 Object Id = 10690159] </inputbuf>
</process>
<process id="process2ea8ca8" taskpriority="0" logused="5036" waitresource="KEY: 7:72057594042908672 (2713e7c4424f)" waittime="7493" ownerId="2703208" transactionname="user_transaction" lasttranstarted="2019-10-30T03:59:38.967" XDES="0x1879b447b0" lockMode="S" schedulerid="16" kpid="7152" status="suspended" spid="59" sbid="0" ecid="0" priority="0" trancount="1" lastbatchstarted="2019-10-30T03:59:38.967" lastbatchcompleted="2019-10-30T03:59:38.977" lastattention="1900-01-01T00:00:00.977" clientapp=".Net SqlClient Data Provider" hostname="BY3SCH106010521" hostpid="6692" loginname="NT AUTHORITY\SYSTEM" isolationlevel="read committed (2)" xactid="2703208" currentdb="7" currentdbname="IronMan" lockTimeout="4294967295" clientoption1="671219744" clientoption2="128056">
<executionStack>
<frame procname="IronMan.dbo.addRequestDependencyInternal" line="9" stmtstart="534" stmtend="964" sqlhandle="0x03000700a8429701375d7500d9aa000001000000000000000000000000000000000000000000000000000000"> insert into @dependentIds select distinct RequestId from RequestFileModificationList where IsActive = 1 and FilePath = ANY (select FilePath from RequestFileModificationList where RequestId =@id </frame>
<frame procname="IronMan.dbo.addToFileModificationListTable" line="36" stmtstart="2220" stmtend="2360" sqlhandle="0x030007006f1ea300305d7500d9aa000001000000000000000000000000000000000000000000000000000000"> execute addRequestDependencyInternal @id, @noOfRequestsAhead out; </frame>
</executionStack>
<inputbuf> Proc [Database Id = 7 Object Id = 10690159] </inputbuf>
</process>
</process-list>
<resource-list>
<keylock hobtid="72057594042908672" dbid="7" objectname="IronMan.dbo.RequestFileModificationList" indexname="NonClusteredIndex-20190423-035837" id="lock187e052080" mode="X" associatedObjectId="72057594042908672">
<owner-list>
<owner id="process2ea8ca8" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process2f7b088" mode="S" requestType="wait"/>
</waiter-list>
</keylock>
<keylock hobtid="72057594042908672" dbid="7" objectname="IronMan.dbo.RequestFileModificationList" indexname="NonClusteredIndex-20190423-035837" id="lock1860b3ea00" mode="X" associatedObjectId="72057594042908672">
<owner-list>
<owner id="process2f7b088" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process2ea8ca8" mode="S" requestType="wait"/>
</waiter-list>
</keylock>
</resource-list>
</deadlock>