Skip to content

Fix EventPipe keyword/level filter recomputation after session close#130491

Draft
steveisok with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-eventpipe-filter-update
Draft

Fix EventPipe keyword/level filter recomputation after session close#130491
steveisok with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-eventpipe-filter-update

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

EventPipe maintains aggregate keyword/level filters per EventSource across all active sessions. When a session stops while others remain active, two bugs caused stale filter values — IsEnabled(level, keyword) would return true even when no remaining session matched.

Fixes

Bug 1 — Native (ep-config.c)

config_compute_keyword_and_level included the session being disabled in its keyword/level aggregation. Added a session_to_exclude parameter; callers pass NULL when enabling (no exclusion) and the session pointer when disabling, so the computed values reflect only the remaining active sessions.

Bug 2 — Managed (EventSource.cs, DoCommand)

When a session stops with others still active, the provider callback fires ENABLE_PROVIDER (source still enabled) with bSessionEnable=false. The existing code only handled two cases — first enable (copy) and new session starting (expand via max/OR). It never narrowed the filter when a session stopped. Added a third branch:

  • !m_eventSourceEnabled → first enable: copy values
  • bSessionEnable → new session: expand (max/OR)
  • else → session stopping, others remain: replace m_level/m_matchAnyKeyword with the recomputed values from native (which now correctly exclude the stopping session)

Test

Added KeywordLevelFilterValidation to enabledisable.cs: starts two sessions (Informational+keyword=0x2, Error+keyword=0x1), stops the broader one first, and asserts IsEnabled(Informational, 0x2) is false once only the Error session remains.

Copilot AI self-assigned this Jul 10, 2026
Copilot AI review requested due to automatic review settings July 10, 2026 14:19
Copilot AI removed the request for review from Copilot July 10, 2026 14:19
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 10, 2026 14:56
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 10, 2026 14:58
Copilot AI changed the title [WIP] Fix EventPipe keyword and level filters update on session close Fix EventPipe keyword/level filter recomputation after session close Jul 10, 2026
Copilot AI requested a review from steveisok July 10, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EventPipe doesn't correctly recompute global keyword and level filters after session close

2 participants