-
Notifications
You must be signed in to change notification settings - Fork 358
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
Dotnet-gcdump collect causes OutOfMemoryException #2038
Comments
Sorry you ran into issues @iliamosko. The issue is probably due to the following sequence of events happening:
Couple of things you could try doing:
@josalem do you have a rough estimate on how much memory the object graph dotnet-gcdump forms would eat up in a large GC heap? |
@sywhang is most likely correct. If the memory threshold for the container is "just right" for the target application and you collect a gc-dump, you may trip the memory limit. The actual file that gets output is fairly compact compared to the heap size if I recall. More likely, an OOM would get triggered while the tool collects the incoming events and parses them to build the graph. It stores the data from each event in arrays of values and objects, which, if the heap is sufficiently large, could grow quickly. I haven't done any analysis about what the memory overhead of that process is, though. |
We should probably analyze the memory usage of the tool itself and document that as part of dotnet-gcdump docs. |
@sywhang |
Could we raise priority of this issue for this very important member of .NET Core tollbox? The cost of unpredictable tool behavior is just too high in a production environment, making it effectively useless because of the added risk. |
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
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:
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?
The text was updated successfully, but these errors were encountered: