-
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
Does locking for EventSource.DoCommand need to be a global lock? #45059
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Also |
|
To be clear, you're talking about the runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Lines 1488 to 1493 in 78adc93
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Lines 1536 to 1548 in 78adc93
The lock is used for registration of providers with the runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Line 2603 in 78adc93
The generation logic seems like a prime candidate for source generation at compile time. That being said, there should only be deferred commands for an |
That causes the manifest to be generated; and its generation uses ArrayPool, which calls
|
Cases 1 and 2 shouldn't be too expensive, but 3 certainly can be due to the reflection required to generate the data. I find it curious that these providers have deferred commands without being explicitly enabled. Do you observe this on non-Windows platforms? I'm wondering if ETW requests the manifest for all providers that register themselves. That would cause case 3 to fire every time for every |
Another thought: That UI looks like dotTrace. It's possible that dotTrace specifically uses the ThreadPool event source. |
Related to #45518 |
After #45901 the I'm not sure if |
I haven't worked out why |
Can you share a code sample to repro this? I'm curious how |
Happens with a
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Lines 3760 to 3767 in 574e625
Which is triggered by runtime/src/coreclr/System.Private.CoreLib/src/System/StartupHookProvider.cs Lines 29 to 35 in 07664ad
|
The only difference I can see is Etw runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Lines 1511 to 1516 in 07664ad
So when |
I'll defer to the experts on this, perhaps it has something to do with the double-registration, which wouldn't happen after the consolidation work item is done. I don't know the details about what kind of side effects may occur as a result of the current situation. It does look troubling though. |
Added PR to merge the two #45974 does look to stop the manifest generation (though may also be the change to not use it for tiering) |
Yea that's the path that tiering uses. I haven't looked at the PR yet, but my understanding was that there were some other issues that needed to be resolved in order to be able to merge those event sources, otherwise we would not get thread pool events, or there would be other issues. |
Hmm... I've clearly got something on my machine that's pre-registered for the portable threadpool (native eventsource)'s Guid; when I switch of all the Jetbrains stuff including the ETW Host Service its still triggering; so not sure what it is |
I noticed before that VS enables some providers when it's open |
You can check what's creating ETW sessions using |
Yep; looks like just having VS open on a project will register it for verbose
3rd provider |
Suppose that still counts as "part of a developer's inner loop development process" for #44598 😅 #amirite |
That makes sense. I'm curious if we observe the slowdown without VS open or on non-Windows platforms where we don't register with a system-wide tracing service. CC @karpinsn |
Note this is from just having VS open; running an app in VS also attaches 2 more listeners to the EventSource; so 3 listeners in total from VS
No; hence my inconsistent results on "fixing" the issue, it was more to do with if I had VS open when profiling or using
Is only triggered by default from the OTOH Using the EventSources #43390 would still trigger the issue with manifest generation unless they were changed to SelfDescribing (though the ManifestBuilder would still be populated in The reason why consolidating |
On startup
FrameworkEventSource
andRuntimeEventSource
; while running on different threads, contend onEventSource.Initialize
waiting for the DoCommand of the other to complete, so run sequentially (intermixed), alsoPortableThreadPoolEventSource
andArrayPoolEventSource
:/cc @stephentoub
Related to #44598
The text was updated successfully, but these errors were encountered: