dotnet / dotnet/runtime

Creating Minidump for DOTNET_DbgMiniDumpType=2/4 fails due to not enough memory, use compression

Open
#131,316 7 comments 0 reactions 0 assignees View on GitHub
area-Diagnostics-coreclr enhancement
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Description

We use .NET 10 and have an issue when creating heap/full dumps on systems with constrained memory: Dumps are about 500M-800M depending on system state. System memory is only 1GB depending on device (armv7/armv8). We can't put such big dumps into tmpfs there. The applications run as systemd-service.

https://learn.microsoft.com/en-us/dotnet/core/diagnostics/collect-dumps-crash
Dump types: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/collect-dumps-crash#types-of-mini-dumps

As a workaround, we create the dump on eMMC, and then compress it using tar/gzip. This brings it down to 5..80MB per dump, which fits into the tmpfs.

It would be useful to have an option to already create compressed dumps directly. E.g. add an env variable: `DOTNET_DbgMiniDumpCompress=1` (or even different methods for compression, but just having any option like this would be very helpful already).

Thanks for considering this!

### Reproduction Steps

- Create any dump Type 2/4 and observe the obscene size:
- Set Env:
```
Environment=DOTNET_DbgEnableMiniDump=1
Environment=DOTNET_DbgMiniDumpType=4
Environment=DOTNET_EnableCrashReport=1
Environment=DOTNET_DbgMiniDumpName=/path/to/dump.dmp
```
- Start .NET application and let it crash on purpose, so it creates a mini dump
- Compress the dump: tar -czf compressed.tar.gz /path/to/dump.dmp
- Now compare the size compressed/uncompressed

### Expected behavior

The output file should already be compressed if the option is selected

### Actual behavior

Dump fails beeing created when target path is on tmpfs.

### Regression?

_No response_

### Known Workarounds

Create the file (DOTNET_DbgMiniDumpName) on eMMC/flash and compress as a 2nd step.

### Configuration

Setup env:
```
Environment=DOTNET_DbgEnableMiniDump=1
Environment=DOTNET_DbgMiniDumpType=4
Environment=DOTNET_EnableCrashReport=1
Environment=DOTNET_DbgMiniDumpName=/path/to/dump.dmp
```

### Other information

Used Runtime: Arm/arm64 (10.0.5)

Contributor guide

Open the contributing guide

Research direction

Start with the DOTNET_DbgMiniDumpType=4 and DOTNET_DbgMiniDumpName environment settings in the reproduction. Compare dump creation on tmpfs with the eMMC workaround, then verify that the selected option produces a compressed dump and avoids the memory failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.