-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue correct Enable/Disable commands for EventSources with EventPipe #81867
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 tasks
noahfalk
reviewed
Feb 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the direction. More comments on the details inline. Thanks @davmason!
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Outdated
Show resolved
Hide resolved
This was referenced Feb 17, 2023
4 tasks
davmason
force-pushed
the
multiple_counters
branch
from
February 22, 2023 21:29
391ba78
to
be07d2e
Compare
noahfalk
approved these changes
Mar 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…acing/EventProvider.cs Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
…, and fix session_id
davmason
force-pushed
the
multiple_counters
branch
from
March 3, 2023 08:35
7e03a56
to
c76a33c
Compare
There were more failures than I'm comfortable merging with, rebasing against the latest in main |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ETW has the behavior that if multiple sessions are open the control code will always be 1 (Enable) in the callback: https://learn.microsoft.com/en-us/windows/win32/api/evntprov/nc-evntprov-penablecallback
We have code in EventSource.DoCommand() that detects this and changes the command sent to a Disable if a session is closing by checking the per session id:
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Line 2601 in 232fbce
However, EventPipe did not set this up properly. We would detect that it was an EventPipe session by checking if the return value from GetSessions() was empty, and then create a placeholder session:
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Lines 231 to 232 in 232fbce
But this session would always have the per session id of 0, so it would not trigger the Enable->Disable logic in DoCommand(). The end result is that if you had 3 sessions enabled and then disabled, you would get 5 Enable commands and one Disable command.
This PR does the following
Partial fix for #61353, there is still a bug in EventListener that means Disable won't be sent