Skip to content
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

Thousands and thousands of EventSourceException while processing event "TraceOperationBegin" thrown throughout a debugging session #22313

Closed
davkean opened this issue Jun 15, 2017 · 4 comments

Comments

@davkean
Copy link
Member

davkean commented Jun 15, 2017

Windows Build: 15063.rs2_release.170317-1834

While debugging, I'm seeing thousands upon thousands of:

EventSourceException while processing event "TraceOperationBegin"

The stack at the time is:

           mscorlib.dll!System.Diagnostics.Tracing.EventSource.ReportOutOfBandMessage(string msg, bool flush) Line 3931       C#
           mscorlib.dll!System.Diagnostics.Tracing.EventSource.ThrowEventSourceException(string eventName, System.Exception innerEx) Line 2452       C#
           mscorlib.dll!System.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityIdCore(int eventId, System.Guid* relatedActivityId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) Line 1230       C#
           mscorlib.dll!System.Threading.Tasks.TplEtwProvider.TraceOperationBegin(int TaskID, string OperationName, long RelatedContext) Line 653    C#
           mscorlib.dll!System.Threading.Tasks.AsyncCausalityTracer.TraceOperationCreation(System.Threading.Tasks.CausalityTraceLevel traceLevel, int taskId, string operationName, ulong relatedContext) Line 191         C#
           mscorlib.dll!System.Threading.Tasks.StandardTaskContinuation.StandardTaskContinuation(System.Threading.Tasks.Task task, System.Threading.Tasks.TaskContinuationOptions options, System.Threading.Tasks.TaskScheduler scheduler) Line 313                C#
           mscorlib.dll!System.Threading.Tasks.Task.ContinueWithCore(System.Threading.Tasks.Task continuationTask, System.Threading.Tasks.TaskScheduler scheduler, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions options) Line 4644       C#

The code that is throwing is:

                                if (etwSessions.IsEqualOrSupersetOf(m_curLiveSessions))
                                {
                                    // OutputDebugString(string.Format("  (1) id {0}, kwd {1:x}", 
                                    //                   m_eventData[eventId].Name, m_eventData[eventId].Descriptor.Keywords));
                                    // by default the Descriptor.Keyword will have the perEventSourceSessionId bit 
                                    // mask set to 0x0f so, when all ETW sessions want the event we don't need to 
                                    // synthesize a new one
                                    if (!m_provider.WriteEvent(ref m_eventData[eventId].Descriptor, pActivityId, relatedActivityId, eventDataCount, (IntPtr)data))
                                        ThrowEventSourceException(m_eventData[eventId].Name);  <!--- Throwing

Almost every time I break there's 1 or more threads sitting on the ReportOutOfBandMessage frame.

Any idea what's going on?

@danmoseley
Copy link
Member

This is from TPL but I don't know why it's doing this. @brianrob ?

@davkean
Copy link
Member Author

davkean commented Jun 15, 2017

I'm unsure if this is only the TPL path that's throwing or whether it's all tracing. It's just that we kick off thousands of Tasks in VS and everyone of them is throwing.

@vancem
Copy link
Contributor

vancem commented Jun 15, 2017

This bug was fixed by the following PR in coreCLR.

dotnet/coreclr#11941 Fix failures in ETW logging on 4GB aware 32 bit processes

Basically the problem was that Rosyn compiler both uses Tasks heavily (which causes many TPL events), and used more than 2GB of heap. Some of the TPL event log the address of the object, and if this address is over 2GB, it got SIGN EXTENDED rather than zero extended and causes the OS to fail to log the event. EventSource in turn logs an OutputDebugString.

This bug has been fixed on CoreCLR, and the following bug tracks fixing it for the Desktop (it has not yet been ported however).

443469 Fix failures in ETW logging on 4GB aware 32 bit processes

However it turns out that the particular TPL events being logged are not event necessary, so rather than having to wait for a fixed .NET Runtime on Desktop, the VS debugger can be changed to only ask for the events it needs (which should eliminate the spew.

The following VS bug tracks that.

442073 Don't enable all TPL events in the debugger Cagri (Charlie) Aslan

I believe this issue can be closed as the work is now being tracked by the other two bugs.

Vance

@vancem vancem closed this as completed Jun 15, 2017
@davkean
Copy link
Member Author

davkean commented Jun 15, 2017

Thanks @vancem

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants