Symptoms
Consider the following scenario:
-
You have a Microsoft SQL Server 2012 database that has the ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT options enabled.
-
You have at least three concurrent queries that run against the same table.
-
The queries use the (TABLOCK, UPDLOCK) query hint.
-
Each query is wrapped in an explicit BEGIN TRAN statement, but the COMMIT TRAN statementis not executed.
When the first query is committed in this scenario, one of the other queries will deadlock.
When READ_COMMITTED_SNAPSHOT is enabled together with the TABLOCK and UPDLOCK query hints, the sessions take IX locks on the table. The deadlock occurs when the two concurrent sessions try to convert the IX locks to X locks at the same time. If READ_COMMITTED_SNAPSHOT is disabled, the sessions will obtain SIX locks that will not deadlock when they are converted to X locks. The hotfix addresses this behavior by granting LCK_M_SCH_S locks instead of IX locks when READ_COMMITTED_SNAPSHOT is used with TABLOCK and UPDLOCK hints. Note This issue also occurs in Microsoft SQL Server 2008 R2. A hotfix for SQL Server 2008 R2 will be released soon.Resolution
The issue was first fixed in the following cumulative update of SQL Server.
Cumulative Update 8 for SQL Server 2012 SP1 /en-us/help/2917531
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.