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

Spike: memory dumps for high memory consumption #3366

Closed
wants to merge 1 commit into from

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented May 14, 2024

POC relates to #3315

Currently all the code is in one of the samples, but we could battle harden this and initialise it from some SentryOptions if we agreed this makes sense for the SDK.

Important Note

For the dump to work, dotnet-gcdump needs to be installed globally:

dotnet tool install --global dotnet-gcdump

Analysing the Dump File

A couple of different options:

  1. dotnet-gcdump report
  2. Open the dump file with Perfview or Visual Studio... provides richer functionality but is only available on Windows.
  3. dotnet-heapview

See Stefan Geiger's blog for a bit of info on the first two options.

@jamescrosswell
Copy link
Collaborator Author

This issue here is another really good use case for this capability. He has an issue every 90 minutes but can't easily get a memory dump because he's running in Azure:

I can't get a memory dump because Azure reasons. I will now redeploy with SignalR disabled and see what happens.

@bruno-garcia
Copy link
Member

@jamescrosswell if we bundled this binary in the Sentry SDK, could we shell out and invoke it from within the proc?

@jamescrosswell
Copy link
Collaborator Author

@jamescrosswell if we bundled this binary in the Sentry SDK, could we shell out and invoke it from within the proc?

Yes, indeed. The only thing it needs is for dotnet-gcdump to be installed... I think implicitly that means it won't work on Mobile (since you wouldn't have dotnet installed on Mobile) but could be a great diagnostic tool for server apps.

@bruno-garcia
Copy link
Member

@jamescrosswell if we bundled this binary in the Sentry SDK, could we shell out and invoke it from within the proc?

Yes, indeed. The only thing it needs is for dotnet-gcdump to be installed... I think implicitly that means it won't work on Mobile (since you wouldn't have dotnet installed on Mobile) but could be a great diagnostic tool for server apps.

That's what I meant by bundling it. If we add the exe to our package, and with msbuild copy to output when app is published. We'd have it there and know its path. Would that work?

@jamescrosswell
Copy link
Collaborator Author

That's what I meant by bundling it. If we add the exe to our package, and with msbuild copy to output when app is published. We'd have it there and know its path. Would that work?

Ah, I see... yes it looks like that should be possible. The dotnet-gcdump package doesn't have any dependencies other than the net6.0 runtime (or higher).

People targeting net fx/standard would need to ensure they installed the net6.0 runtime then, but it would work ootb of everyone else.

@jamescrosswell
Copy link
Collaborator Author

Replaced by:

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

Successfully merging this pull request may close these issues.

2 participants