-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[release/9.0] Root the System.Runtime EventSource #108348
Conversation
The System.Runtime EventSource (RuntimeEventSource), was unintentionally being garbage collected because it wasn't rooted. This caused runtime EventCounters to no longer be available after GC occurred. This was a regression from a recent change (#106014). That change accidentally converted the static field that was intended to the root the object into a property getter that returned a new instance each time it was called. This fix converts the property back into a statically initialized field. This will fix #107919 once it is backported.
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.
lgtm. we will take for consideration in 9 GA
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti |
/ba-g no real failure in the build analysis. The CI just skipped one leg. |
Could someone have permission help merge this PR? Thanks! |
I believe @jeffschwMSFT has merge permissions |
Backport of #108266 to release/9.0
/cc @noahfalk
Customer Impact
Starting in RC1 runtime metrics available via dotnet-counters, dotnet-monitor, Visual Studio and potentially other tools were missing if the tool wasn't started quickly after app startup. Once the metrics were missing they are unrecoverable for the remainder of the process lifetime.
The underlying cause is that the RuntimeEventSource object which provides the counters was being garbage collected because it isn't properly rooted. The timing on how quickly the counters go away depend on how quickly the GC runs.
Regression
Regressed starting in RC1, caused by #106014
Testing
I manually tested the change using the repro provided in the issue report.
Risk
Low - the change restores behavior that was present before the regression, its a tiny code change that is easy to reason about, and its been tested.