goldshtn / LiveStacks

Collect, aggregate, and display live stack traces for ETW events, including CPU sampling, of native and .NET processes.
MIT License
52 stars 4 forks source link

No CallStacks for .NET Core Applications #12

Open shortspider opened 6 years ago

shortspider commented 6 years ago

Hi,

If I run LiveStacks against a .NET Core app I don't get any callstacks. If the dotnet process has a pid of 11108 and I run .\LiveStacks.exe -p 11108 I get:

Ctrl+C pressed, stopping... 2:39:52 PM 1769 [UNKNOWN 11108] 7FFD72360527 7FFD723604AB 7FFDD1E62D33 7FFDD1DACA6F 7FFDD1E1FA87 7FFDD1D7FBF9 7FFDD1D365B9 7FFDD1E1EBAE 7FFDECA1E8B9 7FFDECA1EE44 7FFDF8F79B05 7FFDF8F7F42B 7FFDF8F7E819 7FFDF8F7CC8D 7FF77BF29ABC 7FF77BF2E099 7FFE236D2774 7FFE255A0D51

379 [UNKNOWN 11108] 7FFD7236051E 7FFD723604AB 7FFDD1E62D33 7FFDD1DACA6F 7FFDD1E1FA87 7FFDD1D7FBF9 7FFDD1D365B9 7FFDD1E1EBAE 7FFDECA1E8B9 7FFDECA1EE44 7FFDF8F79B05 7FFDF8F7F42B 7FFDF8F7E819 7FFDF8F7CC8D 7FF77BF29ABC 7FF77BF2E099 7FFE236D2774 7FFE255A0D51

How can I get the correct callstacks? I'm not sure how to force the symbols to be loaded, the readme says that CLRMD should be doing that for me right?

goldshtn commented 6 years ago

Thanks for the report. LiveStacks should resolve the symbols automatically. Can you please confirm that you're using the right bitness of LiveStacks, i.e. 32-bit LiveStacks for 32-bit target or 64-bit LiveStacks for 64-bit target? Also, if you could provide a bit more information about your environment: OS, Visual Studio, .NET Core version, etc.

shortspider commented 6 years ago

@goldshtn sorry for the late response.

My machine is 64 bit and the .NET Core app is configured for Any CPU and LiveStacks is compiled for x64.

OS is Windows 10 Pro version 1703, OS build 15063.674. Visual Studio is version 15.4.1. LiveStacks compiled against .NET 4.6. .NET Core application compiled against 2.0.0.

Should I be compiling LiveStacks against .NET Core? I don't see that configuration in VS.

goldshtn commented 6 years ago

AnyCPU will default to 32-bit I think, because of the “Prefer 32-bit” setting. Can you please confirm that your application is running as 64-bit using Task Manager?

On Nov 3, 2017, at 08:01, Nathan Mascitelli notifications@github.com wrote:

@goldshtn sorry for the late response.

My machine is 64 bit and the .NET Core app is configured for Any CPU and LiveStacks is compiled for x64.

OS is Windows 10 Pro version 1703, OS build 15063.674. Visual Studio is version 15.4.1. LiveStacks compiled against .NET 4.6. .NET Core application compiled against 2.0.0.

Should I be compiling LiveStacks against .NET Core? I don't see that configuration in VS.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

shortspider commented 6 years ago

Sorry should have mentioned that “Prefer 32-bit” was unchecked. The application is 64 bit.

shortspider commented 6 years ago

@goldshtn Hey any updates on this? Is there anything I can do to help solve this? Is anyone else having this issue?

goldshtn commented 6 years ago

I don't have any updates because I haven't reproduced the issue. Does this happen with any .NET Core app, or just one specific app? I'm a bit worried about the "UNKNOWN" marker as well, it should be the process name. Is it possible that the application has exited by the time you hit Ctrl+C?

shortspider commented 6 years ago

@goldshtn it does seem to happen with any core app I try. I also had someone else try in production and had the same results.

I tested again this morning with the following small program:

using System;

namespace TestProject.Core
{
    static class Program
    {
        public static void Main(string[] args)
        {
            var b = true;
            while (true)
            {
                if (b)
                {
                    MethodA();
                }
                else
                {
                    MethodB();
                }
                b = !b;
            }
        }

        static void MethodA()
        {
            Console.WriteLine("Running Method A");
            for (int i = 0; i < 100000; i++)
            {

            }
        }

        static void MethodB()
        {
            Console.WriteLine("Running Method B");
            for (int i = 0; i < 100000; i++)
            {

            }
        }
    }
}

So the program basically maxes out a core on my machine and never exits. I made sure that it built for x64 (not Any CPU and prefer 32 bit was also unchecked just for kicks). I rebuilt LiveStacks as well, making sure I chose the x64 build.

If I take the same small program and build and run it against the full framework LiveStacks works beautify.

Is there any other test I can do for you? Any other info I can provide?