You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
EventPipeEventSource blocks until the first event is read #1060
If you follow the sample code on how to use EventPipeEventSource but replace the provider with a provider that doesn't produce any events, it will block forever in the constructor to EventPipeEventSource.
var providers = new List<EventPipeProvider>()
{
new EventPipeProvider("Microsoft-Windows-DotNETRuntime",
EventLevel.Informational, (long)ClrTraceEventParser.Keywords.GC)
};
var client = new DiagnosticsClient(processId);
using (var session = client.StartEventPipeSession(providers, false))
{
var source = new EventPipeEventSource(session.EventStream);
source.Clr.All += (TraceEvent obj) => {
Console.WriteLine(obj.EventName);
}
try
{
source.Process();
}
// NOTE: This exception does not currently exist. It is something that needs to be added to TraceEvent.
catch (EventStreamException e)
{
Console.WriteLine("Error encountered while processing events");
Console.WriteLine(e.ToString());
}
}
This seems like a pitfall, and it's not clear what is happening. I've used that code pattern lots before and it's never failed, then all of a sudden it hangs my app and I have to do a lot of digging to understand why. I imagine customers will run in to it as well.
@davmason I think a better place for this issue is the perfview repo since that's where TraceEvent and the implementation of EventPipeEventSource lives. For some reason it seems like I can't transfer this issue to PerfView repo so I just filed microsoft/perfview#1172 to track it there.
Activity
davmason commentedon Apr 23, 2020
cc @sywhang
Wojmik commentedon May 12, 2020
I have the same issue. Even in first sample code: https://github.com/dotnet/diagnostics/blob/master/documentation/design-docs/diagnostics-client-library.md
If you debug line by line, it can be saw that it hangs for a while on EventPipeEventSource constructor.
In the real application it is very hard even to Dispose, because constructor hangs, so you don't have reference to Dispose on.
sywhang commentedon May 12, 2020
@davmason I think a better place for this issue is the perfview repo since that's where TraceEvent and the implementation of EventPipeEventSource lives. For some reason it seems like I can't transfer this issue to PerfView repo so I just filed microsoft/perfview#1172 to track it there.