Symptoms

Consider the following scenario:

  • You have a database that has the options ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT enabled in Microsoft SQL Server 2008 R2.

  • You run a SELECT statement that contains TABLOCK and UPDLOCK hints against a table in the database.

  • The SELECT statement is wrapped in an explicit BEGIN TRAN, but COMMIT TRAN is not executed.

  • Two more of the same queries that are started with the same query hints are in the explicit transaction.

In this scenario, when the first query is committed, one of the other queries will be deadlock.

Cause

The issue occurs because SQL Server incorrectly reports deadlock in one of the following scenarios:

  • When ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT are enabled for a database, multiple queries against the same transaction may be reported as deadlocked incorrectly when one of them is completed.

  • When ALLOW_SNAPSHOT_ISOTION is enabled and the hints TABLOCK and UPDLOCK are used, the second and third SELECT statement take IX locks with the intent to convert to X. The IX locks end up deadlocking when an attempt to convert to X is made.

  • When ALLOW_SNAPSHOT_ISOLATION is disabled, the second and third queries will obtain a SIX lock. In this situation, when the SIX lock is converted to X, it is just a blocking scenario, not a deadlock.

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.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×