Skip to content

Dotnet-gcdump collect causes OutOfMemoryException #2038

@iliamosko

Description

@iliamosko

Description

When we are using gcdump to troubleshoot a server that is running a dockerized application, OutOfMemoryExceptions become apparent when the gcdump collect command is being executed. On this server we have a hard limit on the amount of memory that is available with no file swap allowed in the container. Once the application consumes ~90% of the allocated memory, we would run a gcdump command: “dotnet gcdump collect -p ” inside the container. A spike in the applications memory could be seen when the collect command is executed with the application crashing shortly after with an OutOfMemoryException.

Configuration

Net version: .NET 5.0
OS: Linux, Docker container.
Architecture: ARM64
MEMORY: 90GB

Data

Server-stats
This is a small snippet of the server’s memory graph at some points when gcdumps were taken. The application's memory could be seen by the red line and the blue line is the total available memory. The application’s memory is seen to be ~80Gb which is ~90%-95% of the allocated memory for that server. At that point we start the gcdump collection, memory spikes ~10Gb which results in the application maxing the allocated memory which then results in an OutOfMemoryException which inturn crashes the application. The application is then restarted, once again, the application starts showing signs of memory exhaustion, another gcdump is taken with the same outcome as the first one.

Analysis

Looking over the documentation for gcdump and its normal operation, it does not state what the minimum amount of memory is required for gcdump to run safely.

All I have found is this:

To walk the GC heap, this command triggers a generation 2 (full) garbage collection, which can suspend the runtime for a long time, especially when the GC heap is large. Don't use this command in performance-sensitive environments when the GC heap is large.

This then leads to the question, is there any suggested amount of free memory needed to run gcdump safely, or does it solely rely on how large the GC heap is at that point?

Metadata

Metadata

Assignees

Labels

documentationDocumentation related issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions