Repository navigation
[BUG] Lite: XE permission error 15247 is classified as ERROR instead of PERMISSIONS #5378
Description
Problem
In Performance Monitor Lite 3.9.0, SQL Server error 15247 ("User does not have permission to perform this action.") raised while ensuring the optional long-query completion Extended Events session is classified as ERROR instead of PERMISSIONS.
A monitoring account can intentionally lack permission to create/start this session. The defect is the application's classification and repeated handling of that denial, not the account's restricted permissions.
Observed failure path
With long_query_completions enabled, XE reconciliation fails during ExecuteNonQueryAsync in EnsureLongQueryCompletionsXeSessionOnPremAsync with SQL error 15247. The stored reconciliation exception reaches CollectLongQueryCompletionsAsync and then RunCollectorAsync. The resulting collector status is ERROR.
Repeated occurrences of this path were observed. This issue is distinct from the general archive-query performance problem; it is not claimed to explain the whole UI slowdown.
Root cause in v3.9.0
- SqlServerPermissionErrors.IsPermissionDenied recognizes 229, 262, 297, 300, 916, and 8189, but omits 15247. Calling IsPermissionDenied(15247) therefore returns false.
- RemoteCollectorService.RunCollectorAsync uses this predicate both for a SQL exception and for the SQL error inside an XE ensure exception. A 15247 denial falls through to ERROR.
- RecordCollectorResult in that same file marks IsPermissionRestricted only for PERMISSIONS. ERROR instead follows ordinary error tracking, so the intended per-session permission suppression is not engaged.
- ReconcileLongQueryCompletionsXeSessionAsync is a separate, pre-collector path. When enabled it re-ensures the session, remembers a failure, and leaves state so later cycles retry. Merely fixing the classifier does not necessarily suppress these out-of-run DDL retries.
Reproduction
Minimal deterministic classification check:
Assert.True(SqlServerPermissionErrors.IsPermissionDenied(15247));This expectation fails against the current predicate.
Integration reproduction in a disposable SQL Server test environment:
- Use a monitoring login that can connect but lacks the effective permission needed to create/start the long-query XE session.
- Enable the optional long_query_completions collector; ensure the required XE session is absent.
- Exercise a configuration/version that returns 15247 during XE creation/start, or inject a SQL exception with that number at the ensure seam. Other denial numbers are possible and should remain covered separately.
- Run reconciliation and the collector classification path.
- Observe ERROR instead of PERMISSIONS; run subsequent collection cycles and inspect whether reconciliation repeatedly attempts the denied DDL.
The classifier omission is source-confirmed; the assertion above is a proposed regression test, not a claim that a new test suite was run.
Expected behavior and fix
- Classify 15247 as a permission denial through the shared predicate, including both direct and wrapped SQL exception paths.
- Preserve the XE-unavailable indication and permission-specific health message.
- Ensure the separate reconciliation path respects the intended denied-permission suppression/backoff policy, while allowing a defined retry after restart, relevant configuration changes, or another explicit recovery mechanism.
- Continue classifying unrelated operational SQL failures as ERROR.
Extend SqlServerPermissionErrorsTests with 15247. Add coverage for the stored reconcile exception reaching collector health, subsequent-cycle retry behavior, and recovery after the permission restriction is resolved. Since the predicate is shared, verify its other callers also retain the intended permission handling.
Activity
Pin the PERMISSIONS run row a denied long-query session create writes (…
The long-query fault pin follows the fault's backing field and the pe…
The drain/fetchPhases null-arm census counts the long-query PERMISSIO…
A denied Extended Events session setup shows as a permission state an…
erikdarlingdata commentedon Oct 6, 2026
Fixed by #5386, merged to dev in 8a9c39f.