Skip to content

[BUG] Issue with PerformanceMonitor_BlockedProcess and PerformanceMonitor_Deadlock Extended Events #1086

@gotqn

Description

@gotqn

Component

Lite

Performance Monitor Version

2.11.0

SQL Server Version

Microsoft SQL Server 2022 (RTM-CU19) (KB5054531) - 16.0.4195.2 (X64)

Windows Version

Windows Server 2019 Standard

Describe the Bug

In the Lite edition, the PerformanceMonitor_BlockedProcess and PerformanceMonitor_Deadlock Extended Events sessions are created only on the "open the server tab" code path. The recurring background collection loop never (re)creates them. As a result, if that first creation attempt doesn't succeed (connection not fully established yet, or insufficient rights at that moment), the sessions are never created and never retried automatically — the blocked_process_report and deadlocks collectors then silently read a non‑existent ring buffer and report success, so there's no indication anything is wrong.

Steps to Reproduce

  1. Add a server and let background collection run without opening the server tab (e.g., app minimized to tray after restart). → XE sessions are never created.

or

  1. On the very first tab‑open, have the create attempt fail (connection not yet established, or the login temporarily lacks ALTER ANY EVENT SESSION). → it fails once, and no later background cycle retries it.

  2. Observe: blocked_process_report / deadlocks collectors show OK, but sys.server_event_sessions has no PerformanceMonitor_* sessions and the Blocking/Deadlock data + Blocking alert stay empty indefinitely.

  3. Manually re‑open (double‑click) the server tab with a live connection and adequate rights → sessions are created and everything starts working. (Confirmed.)

Expected Behavior

XE sessions should be ensured as part of the recurring collection lifecycle (or retried), so that:

  • servers monitored without an open tab still get their sessions, and
  • a failed first attempt self‑heals on a later collection cycle instead of requiring a manual tab re‑open.

Actual Behavior

Sessions are created only on RunAllCollectorsForServerAsync (tab‑open). The background loop never ensures or retries; a failed first attempt leaves blocking/deadlock collection permanently broken until a manual tab re‑open, with no UI signal.

Error Messages / Log Output


Screenshots

No response

Additional Context

Suggested fix

  • Call EnsureBlockedProcessXeSessionAsync / EnsureDeadlockXeSessionAsync from the background collection path (e.g., once per server per cycle, or guarded so it only re‑attempts when the session is missing), not only from RunAllCollectorsForServerAsync.
  • Add a null/ready guard at RemoteCollectorService.cs:349 so the ensure step is skipped cleanly (and retried next cycle) when GetConnectionStatus isn't populated yet, instead of bailing out.
  • Surface the ensure failure beyond a LogWarning — e.g., mark the blocked_process_report/deadlocks collector health as degraded so the UI doesn't show "OK" while capture is non‑functional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions