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

EventPipeEventSource does not properly handle EventSource events #461

Closed
nategraf opened this issue Dec 9, 2017 · 4 comments
Closed

EventPipeEventSource does not properly handle EventSource events #461

nategraf opened this issue Dec 9, 2017 · 4 comments
Assignees

Comments

@nategraf
Copy link

nategraf commented Dec 9, 2017

When using the TraceEventDispatcher with handlers registered on Dynamic.All and UnhandledEvents, EventSource events appeared in UnhandledEvents and the provider name did not resolve.

@nategraf nategraf self-assigned this Dec 9, 2017
@vancem
Copy link
Contributor

vancem commented Jan 11, 2018

Nate can you provide more information. In particular

  1. If there is a easy way of generating *.netperf files on windows, please tell us about it).
  2. Providing a (hopefully small) *.netperf file
  3. If the symptoms show in PerfView tell us how what bad behavior it creates.
  4. Otherwise a small program that uses TraceEvent would be useful.

@nategraf
Copy link
Author

It's not particularly easy to generate *.netperf files on Windows right now, but it can be done by building coreclr and a test with an additional setting enabled. For this problem in particular it is not possible to generate the trace file on Windows because we don't yet support EventSource events through EventPipo there.

The test is called 'eventsourcetrace' (Could use a better name) that can produce and parse .netperf files. After being built as a test with coreclr using eventpipetrace.sh/.cmd <name>.netperf will produce a .netperf file. It does not build by default, so it will need to be built manually.

The clr support is in master for EventPipe on Windows, but the managed interface isn't enabled by default because it currently breaks EventSource's ETW support. It can be turned on by adding <FeaturePerfTracing>true</FeaturePerfTracing> to Windows in clr.coreclr.props

The issue does not appear when reading the file in PerfView.

Here is a trace file generated by that test on Linux: https://microsoft-my.sharepoint.com/:u:/p/vigraf/ERMrVGqe3mFLmLO0iAkHjO4BuZ9MiiR3pkxhmj77tYEvlQ?e=o8QRPH

@adamsitnik
Copy link
Member

@nategraf

Do I understand correctly that DynamicAll should handle all events and never invoke unhandled events?

[Fact]
public void DynamicAllHandlesAllEvents()
{
    PrepareTestData();

    const string eventPipeFileName = "eventpipe-dotnetcore2.0-win-objver3-x86.netperf";

    string eventPipeFilePath = Path.Combine(UnZippedDataDir, eventPipeFileName);

    using (var eventSource = EventPipeEventSourceFactory.CreateEventPipeEventSource(eventPipeFilePath))
    {
        int dynamicAllInvocationCount = 0;
        int unhandledEvents = 0;

        eventSource.Dynamic.All += _ => dynamicAllInvocationCount++;

        eventSource.UnhandledEvents += _ => unhandledEvents++;

        eventSource.Process();

        Assert.NotEqual(0, dynamicAllInvocationCount);
        Assert.Equal(0, unhandledEvents);
    }
}

@nategraf
Copy link
Author

Yes. In that test unhandledEvents should be zero at the end if everything is working correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants