-
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
Remove static modifiers from ThreadPool events in NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs #85563
Conversation
remove static modifiers from lines: - 156 - 191 in: src\libraries\System.Private.CoreLib\src\System\Threading\NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs
Tagging subscribers to this area: @mangod9 Issue DetailsHere is a fix for issue #78006 that works with win11 .NET 7. The EventPipeEventDispatcher cycles through EventPipeInternal via QCall and sends them to be processed by the NativeRuntimeEventSource. Lines 169 to 181 in 0c612cf
From there they are sent to be decoded by the EventPipePayloadDecoder. Line 55 in a08818e
There is where the NRE occurs because the metadata is uninitialized. Parameters is default null and attempting to get its length results in NRE. Looking back at the NativeRuntimeEventSource the NRE occurs with eventID 64 (ThreadPoolIODequeue). Lines 16 to 19 in a08818e
In the EventSource. There are no BindingFlags for static methods. This is important because any static methods from the NativeRuntimeEventSource won’t get loaded. Because this data is used to initialize m_eventData values, any methods left out will leave uninitialized slots in m_eventData. Slot 64 being one of them. runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs Line 3042 in 0c612cf
The fix will allow for event 64 and 63 to be loaded into m_eventData before pr #66333 again.
|
cc @marek-safar This is regression introduced by https://github.com/dotnet/runtime/pull/66333/files#diff-f7c0dd1b698275f0f183b9517883bc82280850fc6f256e8b7405c02ce0d0c22fR152 |
Is it possible to add a test for this? |
Hmm... |
After adding tests to NativeRuntimeEventSourceTest.cs and returning the static modifiers to NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs the tests successfully failed. I will now remove the static modifiers and the tracing tests should now pass. |
@davmason ptal |
Here is a fix for issue #78006 that works with win11 .NET 7.
The EventPipeEventDispatcher cycles through EventPipeInternal via QCall and sends them to be processed by the NativeRuntimeEventSource.
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventPipeEventDispatcher.cs
Lines 169 to 181 in 0c612cf
From there they are sent to be decoded by the EventPipePayloadDecoder.
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.cs
Line 55 in a08818e
There is where the NRE occurs because the metadata is uninitialized. Parameters is default null and attempting to get its length results in NRE. Looking back at the NativeRuntimeEventSource the NRE occurs with eventID 64 (ThreadPoolIODequeue).
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventPipePayloadDecoder.cs
Lines 16 to 19 in a08818e
In the EventSource. There are no BindingFlags for static methods. This is important because any static methods from the NativeRuntimeEventSource won’t get loaded. Because this data is used to initialize m_eventData values, any methods left out will leave uninitialized slots in m_eventData. Slot 64 being one of them.
runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
Line 3042 in 0c612cf
The fix will allow for event 64 and 63 to be loaded into m_eventData before pr #66333 again.