Repository navigation
Description
Claude posting for Erik Darling.
What happens
A parallel query whose threads wait on each other is still counted as blocking. It inflates the blocking event count, the head blocker count and the chain facts. It also feeds the "N blocking events" anomaly. This was item 1 of #5633. It is still present in v3.11.0 (1b6af51).
#5704 has no lane for it, because the #5633 triage said "There is no defect 1". #5705 says "No self-blocking filter (that is #5633 M1)". So neither PR fixed it.
What I saw
Build: v3.11.0, managed PostgreSQL 18 + TimescaleDB store. The data is a replay of 2026-10-07 and 2026-10-08 on one 16-CPU SQL Server 2022 test instance. That window holds exactly one real lock wait, an X lock on a KEY. Every other report is one SQLCMD parallel query.
The self-blocked reports look like this (get_blocking with as_of 2026-10-08T23:42:14Z):
| Field | Value |
|---|---|
| blocked_spid / blocked_ecid | 59 / 2, 5, 6 |
| blocking_spid / blocking_ecid | 59 / 1 |
| lock_mode | empty string |
| wait_resource | null |
| blocked_status | suspended |
What the tools report for the same window:
| Read | Value | Expected |
|---|---|---|
get_analysis_facts (source blocking, hours_back 48, as_of 2026-10-08T23:42:14Z): BLOCKING_EVENTS event_count |
13 | 1 |
same: distinct_head_blockers |
3 | 1 |
| same: BLOCKING_CHAIN | worst_apex_spid 59, cycle_detected 1 |
no chain |
analyze_server (same window): ANOMALY_BLOCKING_SPIKE |
"59 blocking events this window" | 1 |
get_daily_summary 2026-10-07 + 2026-10-08: blocking_events |
1 + 12 | 1 |
W1 (#5705) shrank the count from 59 reports to 13 waits. It did not remove the self-waits. The chain reconstruction treats the self edge (spid 59 to spid 59) as a cycle.
Where
PerformanceMonitor.Common/BlockingWaits.cs:WaitsCteSqlandCollapse. This is the shared definition of a wait.Darling/PerformanceMonitor.Darling.Analysis/PgFactCollector.Waits.cs:277BuildBlockingSql(BLOCKING_EVENTS). The chain reconstruction setscycle_detectedat about line 712.PerformanceMonitor.Alerting/AlertContextBuilders.cs:497BlockingWaitRows(the alert value and card).- The fleet tile (
FleetBlockingSql),get_server_summary, the daily summary, and the report counts the health band and anomaly detectors use. - Lite:
Lite/Analysis/DuckDbFactCollector.Waits.csand the Lite overview.
Suggested fix
Leave out rows where blocked_spid = blocking_spid wherever a report becomes a blocking wait. These are intra-query parallelism waits, not lock blocking. Do it once, in BlockingWaits (both the C# and the SQL text). Then do the same in the chain reconstruction and in the report count that the band tiers and the anomaly detectors read.
get_blocking can keep the rows. It could mark them, for example with intra_query: true, so the raw read still shows what SQL Server wrote.
How to verify
- A fixture with a self-blocked parallel report set plus one real lock wait gives
event_count1,distinct_head_blockers1 and no cycle. - On a live store, rerun the replay reads above with the same
as_of. The 10-08 rows are kept for 30 days, until about 2026-11-07.
Activity
Keep spid 0/0 reports as waits in the SQL, and filter the Lite blocki…
Decide XE-or-DMV on XE reports that are not self-waits (#6645)
Pin Lite's self-wait filter in the twin test's blocking arm (#6645)
A parallel query waiting on itself is no longer counted as blocking (#…
erikdarlingdata commentedon Oct 24, 2026
Claude posting for Erik Darling. Fixed on dev by #6663 (3b8d13e). Ships in the next release.