I am looking into a deadlock problem on an application server which is affecting a particular part of the system.
The part of the system in question is a scoring engine which runs a few dozen stored procedures and carries out multiple update / insert statements across several tables. For various reasons the quality of this T-SQL code is questionable as none of it is error trapped and transactions are not used; hence if an error does occur you can get a half scored transactions.
The text of the error message is below. The stored procedure name varies but always references a stored proc in the scoring part of the system. I have been able to replicate the error by running the top level scoring procedure across two discrete sets of transactions simultaneously.
Running a trace when the error occurs reveals that the deadlock is occurring on the following statement which is common to all the test procedures:
In each case the transaction ID and test ID are different so different rows are targeted by the operation. This does not seem like something which is vulnerable to a deadlock situation.Code:DELETE FROM dbo.TestResults WHERE (TestID = @TestID AND GroupID = 1 AND TransactionID = @TransactionID AND Config= @config)
Three examples of the error:
Code:Msg 1205, Level 13, State 52, Procedure spGroup2, Line 42 Transaction (Process ID 67) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.Code:Msg 1205, Level 13, State 52, Procedure spGroup3, Line 42 Transaction (Process ID 68) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.The SQLProfiler deadlock graph event shows that the deadlock might be occurring at the page level. Again, I am not sure why this would be the case as different rows from different parts of the table are being deletedCode:Msg 1205, Level 13, State 52, Procedure spTest10, Line 92 Transaction (Process ID 68) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.. Another thing I am looking into is parallelism which I hear can cause problems on OLTP type systems; but I am not sure if switching this off globally would have an impact on performance.
I still need to find out what is causing the problem an come up with a workaround which doesn't require re-writing the whole lot if possible. Sigh, such is workplace politics. Is there anything I am missing here? Anything else I could try?


. Another thing I am looking into is parallelism which I hear can cause problems on OLTP type systems; but I am not sure if switching this off globally would have an impact on performance.
Reply With Quote

