-
Notifications
You must be signed in to change notification settings - Fork 357
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
NativeRuntimeEventSource behaving poorly in conjunction with other providers #4825
Comments
Enabling Thread 1
Thread 2
This is a recurring theme for EventSource - we call out to user code at times that is hard to reason about and potentially dangerous. This particular example could be avoided by calling Console.Write before trying to initialize any EventSources, but we see this type of issue repeatedly. I don't think we'll be able to address this in 8 but longer term we should consider anything we can do to avoid these types of deadlocks. |
The stack overflow for TPLEventSource is due to the jitting of a method in Console.EnsureInitialized triggering a jit, which triggers an ActivityID to be created and an event to be fired, then calls in to the eventsource and when it tries to log to the console it triggers a new jit for the same method because the previous jit is blocked waiting for the previous event This stack is repeated until the overflow. The method we are trying to jit is System.Text.EncodingHelper.GetSupportedConsoleEncoding(Int32)
|
Moving this to 9 |
We plan to document this as the behavior can be controlled in the EventSource callbacks. The problem is re-entrant behavior triggering other callbacks which can cause undesired behavior. |
Consider this repro:
Run it, and it correctly spews lots of GC-related events to the console.
Uncomment either or both of the ArrayPoolEventSource and/or FrameworkEventSource lines, and everything still outputs as expected.
But if you uncomment the System.Runtime line, no events get output at all.
And if you uncomment the TplEventSource line, the app crashes.
cc: @brianrob, @noahfalk
The text was updated successfully, but these errors were encountered: