November 15, 2017 at 1:12 am
To start with, the deadlocks are on row-level locks, not table level, so lock escalation will have no effect here. Please turn it back on.
The key, I suspect, is this:
transactionname="implicit_transaction"
That means that a transaction gets automatically started when a statement runs, and only gets committed when an explicit COMMIT TRANSACTION is run.
This is not the default in SQL Server, so someone would have had to either set this in the application (session-level setting), or by SET IMPLICIT TRANSACTIONS ON
I suspect that transactions are getting started, and not committed, and since locks taken from data modifications are held until the end of the transaction, you're having long-running transactions holding locks longer than expected, and hence causing deadlocks.
I would recommend removing the implicit transaction settings and explicitly creating and committing transactions where necessary, and allowing autocommit where they're not.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 15, 2017 at 11:23 pm
GilaMonster - Wednesday, November 15, 2017 1:12 AMTo start with, the deadlocks are on row-level locks, not table level, so lock escalation will have no effect here. Please turn it back on.The key, I suspect, is this:
transactionname="implicit_transaction"
That means that a transaction gets automatically started when a statement runs, and only gets committed when an explicit COMMIT TRANSACTION is run.
This is not the default in SQL Server, so someone would have had to either set this in the application (session-level setting), or by SET IMPLICIT TRANSACTIONS ONI suspect that transactions are getting started, and not committed, and since locks taken from data modifications are held until the end of the transaction, you're having long-running transactions holding locks longer than expected, and hence causing deadlocks.
I would recommend removing the implicit transaction settings and explicitly creating and committing transactions where necessary, and allowing autocommit where they're not.
Thanks GilaMonster for detailed analysis.
Viewing 2 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply