Quantcast
Channel: CRM Development 論壇
Viewing all articles
Browse latest Browse all 10280

CRM Dynamics 4 (Plugins) - Database deadlocks happening

$
0
0

Hello,

I had a thread in the other CRM forum but had to close it due to one of the questions I had being solved.

I have several plugins that are doing updates and needed to add one more that specifically creates write in products on the quote, migrating them from a custom entity on the opportunity.

Since I did this I started having deadlocks in the database.

I made some traces to the DB and one of them is as shown below:

<deadlock-list><victimProcess id="process5a9b88"/><process-list><process id="process5a9b88" taskpriority="0" logused="1444" waitresource="KEY: 7:72057594175946752 (084f5371347c)" waittime="362" ownerId="15352" transactionname="user_transaction" lasttranstarted="2012-12-12T17:55:00.827" XDES="0x93b93950" lockMode="U" schedulerid="2" kpid="2040" status="suspended" spid="62" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2012-12-12T17:55:00.837" lastbatchcompleted="2012-12-12T17:55:00.833" clientapp=".Net SqlClient Data Provider" hostname="CRMDEV" hostpid="3820" loginname="NT AUTHORITY\NETWORK SERVICE" isolationlevel="read committed (2)" xactid="15352" currentdb="7" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"><executionStack><frame procname="" line="1" stmtstart="1270" stmtend="2962" sqlhandle="0x020000004c21c40dc4182d05f4587dc8e362cd513431d540"/><frame procname="" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000"/></executionStack><inputbuf> (@TotalLineItemAmount0 decimal(9,4),@TotalLineItemDiscountAmount_Base0 decimal(1,0),@TotalTax_Base0 decimal(1,0),@TotalLineItemAmount_Base0 decimal(5,0),@TotalAmount0 decimal(9,4),@TotalAmount_Base0 decimal(5,0),@TotalTax0 decimal(1,0),@PricingErrorCode0 int,@TotalLineItemDiscountAmount0 decimal(1,0),@TotalDiscountAmount_Base0 decimal(1,0),@TotalDiscountAmount0 decimal(1,0),@ModifiedBy0 uniqueidentifier,@TotalAmountLessFreight0 decimal(9,4),@ExchangeRate0 decimal(11,10),@TotalAmountLessFreight_Base0 decimal(5,0),@ModifiedOn0 datetime,@TransactionCurrencyId0 uniqueidentifier,@QuoteId0 uniqueidentifier,@QuoteId1 uniqueidentifier)update QuoteBase set TotalLineItemAmount=@TotalLineItemAmount0, TotalLineItemDiscountAmount_Base=@TotalLineItemDiscountAmount_Base0, TotalTax_Base=@TotalTax_Base0, TotalLineItemAmount_Base=@TotalLineItemAmount_Base0, TotalAmount=@TotalAmount0, TotalAmount_Base=@TotalAmount_Base0, FreightAmount=NULL, TotalTax=@TotalTax0, DiscountAmount=NULL, FreightAmount_Base=NULL, PricingErrorCode=@Pr    </inputbuf></process><process id="process807002c8" taskpriority="0" logused="13948" waitresource="KEY: 7:72057594176012288 (7323801fb3f0)" waittime="378" ownerId="15353" transactionname="user_transaction" lasttranstarted="2012-12-12T17:55:00.827" XDES="0x83647950" lockMode="U" schedulerid="1" kpid="2072" status="suspended" spid="61" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2012-12-12T17:55:00.850" lastbatchcompleted="2012-12-12T17:55:00.847" clientapp=".Net SqlClient Data Provider" hostname="CRMDEV" hostpid="3820" loginname="NT AUTHORITY\NETWORK SERVICE" isolationlevel="read committed (2)" xactid="15353" currentdb="7" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"><executionStack><frame procname="" line="1" stmtstart="1344" stmtend="2576" sqlhandle="0x02000000241fc72e499e309b28db478d530e5020d6cdfb2d"/><frame procname="" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000"/></executionStack><inputbuf> (@ExtendedAmount0 decimal(6,2),@VolumeDiscountAmount_Base0 decimal(1,0),@VolumeDiscountAmount0 decimal(4,4),@PricePerUnit0 decimal(6,4),@PricingErrorCode0 int,@PricePerUnit_Base0 decimal(2,0),@ExtendedAmount_Base0 decimal(4,0),@BaseAmount0 decimal(6,2),@ModifiedBy0 uniqueidentifier,@BaseAmount_Base0 decimal(4,0),@ExchangeRate0 decimal(11,10),@ModifiedOn0 datetime,@TransactionCurrencyId0 uniqueidentifier,@QuoteDetailId0 uniqueidentifier,@esri_custounitario_Base0 decimal(2,0),@ESRI_margem0 decimal(8,4),@ESRI_custototal0 decimal(8,4),@esri_custototal_Base0 decimal(4,0),@esri_margem_Base0 decimal(4,0),@ESRI_custounitario0 decimal(6,4),@QuoteDetailId1 uniqueidentifier)update QuoteDetailBase set Tax=NULL, ExtendedAmount=@ExtendedAmount0, VolumeDiscountAmount_Base=@VolumeDiscountAmount_Base0, VolumeDiscountAmount=@VolumeDiscountAmount0, ManualDiscountAmount=NULL, PricePerUnit=@PricePerUnit0, PricingErrorCode=@PricingErrorCode0, PricePerUnit_Base=@PricePerUnit_Base0, ExtendedAmount_Base=@ExtendedAmount_Base0, BaseAm    </inputbuf></process></process-list><resource-list><keylock hobtid="72057594175946752" dbid="7" objectname="" indexname="" id="lock877ce180" mode="X" associatedObjectId="72057594175946752"><owner-list><owner id="process807002c8" mode="X"/></owner-list><waiter-list><waiter id="process5a9b88" mode="U" requestType="wait"/></waiter-list></keylock><keylock hobtid="72057594176012288" dbid="7" objectname="" indexname="" id="lock877c4a00" mode="X" associatedObjectId="72057594176012288"><owner-list><owner id="process5a9b88" mode="X"/></owner-list><waiter-list><waiter id="process807002c8" mode="U" requestType="wait"/></waiter-list></keylock></resource-list></deadlock-list> 

I set the parallelism on the DB to 1 , turned on read commited snapshot and transaction isolation level to snapshot as well as suggested by several posts I read.

Still to no avail.

Odd thing is sometimes the process(asynchronous) runs well. Yesterday I tried to creat 10 quotes in a row to trigger the whole process and the result was:

Execution 1 and 3 gave a deadlock. All the others ran just fine. It was exactly the same quote creation with the same amount of products.

My question is, where can I go from here? How can I approach this problem?

If someone could help me that would be great.

Thanks for your time.


Viewing all articles
Browse latest Browse all 10280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>