You are currently offline, waiting for your internet to reconnect

FIX: Deadlocked query when ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT are enabled in SQL Server 2012

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.
The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 8 for SQL Server 2012 SP1

About cumulative updates for SQL Server

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:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Article ID: 2923460 - Last Review: 04/27/2014 13:28:00 - Revision: 2.0

  • Microsoft SQL Server 2012 Service Pack 1
  • kbqfe kbfix kbsurveynew kbexpertiseadvanced KB2923460