-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
We've observed a significant decrease in the performance of creating mini dumps while migrating an application from .NET Framework to .NET 8. In our case, this was revealed as a result of unhandled exceptions being reported by Windows Error Reporting, generating a long-running mini dump and hanging our application while the mini dump was being created.
While we're unsure why, we decided to benchmark a minimum repro across various .NET versions, by deliberately causing unhanded stack overflow exceptions and letting Windows Error Reporting create mini dumps for the crashing processes.
The sample below is our minimum repro case, causing a deliberate stack overflow on some number of threads.
using System;
using System.Threading;
namespace DotNetDumpRepro
{
public static class Program
{
public static void Main()
{
CreateThreads(StackOverflow);
}
private static void StackOverflow()
{
StackOverflow();
}
private static void CreateThreads(Action threadAction)
{
for (int i = 0; i < THREAD_COUNT; i++)
{
Thread t = new Thread(() => { threadAction(); });
t.Start();
}
}
private const int THREAD_COUNT = 5;
}
}To run the experiment you can perform the following steps:
- Create C# projects for targeting the two versions (.NET Framework 4.6.1 and .NET 8, for instance)
- Use the code sample as the entrypoint for both executables
- Publish the executable somewhere on disk or build the executable in Release
- Run the executable with the debugger detached (in my experiments I ran this directly from the command-line)
- Observe that the dump being created in
%LocalAppData%\CrashDumpstakes a significant amount of time to create when targeting .NET 8 compared to .NET Framework 4.6.1
Configuration
Affected .NET Version: .NET 9.0.11 (targeting .NET Framework 4.6.1 and .NET 8)
Architecture: x64
Specs:
- Version 10.0.26100 Build 26100
- Processor AMD Ryzen Threadripper 7960X 24-Cores, 4201 Mhz, 24 Core(s), 48 Logical Processor(s)
- Installed Physical Memory (RAM) 256 GB
Regression?
Our results indicate that this may be a regression.
Data
For our experiments we deliberately caused Windows to generate a crash dump using the code sample above by causing an unhandled stack overflow exception. For projects targeting the two versions we observed the following results.
The posted time is from the start of the executable until when the mini dump is finished being created and the Windows Error Reporting process exits (generated mini dumps can be found in %LocalAppData%\CrashDumps).
| .NET Framework 4.6.1 | .NET 8 | |
|---|---|---|
| 5 Thread Stack Overflow | 0:22.44s | 1:42.92s |
| 50 Thread Stack Overflow | 0:33.84s | 30:30.38s |
It's also worth noting that I investigated the available registry flags for controlling the parameters used by Windows Error Reporting to generate a minimal mini dump (CustomDumpType = 0x0001000, DumpType = 0). No significant difference in the performance of generating the mini dump was observed, despite a noticeable difference in file sizes of the resultant dumps.
I also installed a .NET 10 test environment, yielding similar results, with no significant difference.
Analysis
I'm unsure if this is a runtime problem exactly. Feel free to redirect me if needed.