Skip to content

sp_BlitzLock: Duplicate findings when different lock types involved for the same object #3711

@Tisit

Description

@Tisit

Version of the script
8.25, newest version from Github

What is the current behavior?

If there are different types of locks(page, row, object) involved in deadlocks for the same object the findings get duplicated.

If the current behavior is a bug, please provide the steps to reproduce.
Setup:

CREATE TABLE dbo.LockTest (
    Id INT NOT NULL PRIMARY KEY,
    Value INT NOT NULL
);
GO

INSERT INTO dbo.LockTest (Id, Value) VALUES (1, 100), (2, 200);
GO

Session A:

BEGIN TRAN;

UPDATE dbo.LockTest
SET Value = Value + 1
WHERE Id = 1;

UPDATE dbo.LockTest  WITH(ROWLOCK)
SET Value = Value + 1
WHERE Id = 2;

--ROLLBACK

Session B:

BEGIN TRAN;

UPDATE dbo.LockTest
SET Value = Value + 1
WHERE Id = 2;

UPDATE dbo.LockTest  WITH(TABLOCK)
SET Value = Value + 1
WHERE Id = 1;

--ROLLBACK
  1. Set up table and insert data
  2. Open 2 sessions A and B
  3. In session A start transaction and run first update
  4. In session B start transaction and run first update
  5. In session A start second update. It will hang
  6. In session B start second update. It will succeed or become a deadlock victim
  7. execute sp_BlitzLock

Observer there are two identical rows for dbo.LockTest in the findings
Image

What is the expected behavior?
After performing reproducing procedure only one finding should be generated for dbo.LockTest

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
Microsoft SQL Server 2019 (RTM-CU32-GDR) (KB5058722) - 15.0.4435.7 (X64) Jun 9 2025 18:36:12 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 (Build 19045: )

I'm sure other versions are affected too. This does not appear to be version specific.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions