Skip to content

Commit ba24bc5

Browse files
author
rhamlett_microsoft
committed
Removed Native Crash - unable to make it work reliably and it doesn't add much value over FailFast.
Increased log container height and input width to accommodate longer messages and prevent overflow.
1 parent 4b3726d commit ba24bc5

4 files changed

Lines changed: 4 additions & 53 deletions

File tree

src/PerfProblemSimulator/Models/CrashRequest.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,5 @@ public enum CrashType
8484
/// Allocates memory until the process runs out and crashes.
8585
/// Different from memory pressure - this is meant to be fatal.
8686
/// </summary>
87-
OutOfMemory = 4,
88-
89-
/// <summary>
90-
/// Uses RtlFailFast to trigger an unbypassable native crash.
91-
/// This bypasses all .NET and ANCM exception handlers and guarantees
92-
/// a Windows Error Report is generated. Best option for Azure Crash Monitoring.
93-
/// </summary>
94-
NativeCrash = 5
87+
OutOfMemory = 4
9588
}

src/PerfProblemSimulator/Services/CrashService.cs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ private void ExecuteCrash(CrashType crashType, string message)
117117
ExecuteOutOfMemory();
118118
break;
119119

120-
case CrashType.NativeCrash:
121-
ExecuteNativeCrash();
122-
break;
123-
124120
default:
125121
throw new ArgumentOutOfRangeException(nameof(crashType), crashType, "Unknown crash type");
126122
}
@@ -236,37 +232,6 @@ private void ExecuteAccessViolation()
236232
[DllImport("kernel32.dll", SetLastError = true)]
237233
private static extern void RaiseException(uint dwExceptionCode, uint dwExceptionFlags, uint nNumberOfArguments, IntPtr lpArguments);
238234

239-
/// <summary>
240-
/// Uses RtlFailFast to trigger an unbypassable crash that guarantees WER capture.
241-
/// </summary>
242-
/// <remarks>
243-
/// <para>
244-
/// <strong>Educational Note:</strong> RtlFailFast (the underlying implementation of __fastfail)
245-
/// is the nuclear option for crash generation. It:
246-
/// </para>
247-
/// <list type="bullet">
248-
/// <item>Bypasses ALL exception handlers (including ANCM in IIS InProcess mode)</item>
249-
/// <item>Generates a Windows Error Report that Crash Monitoring can capture</item>
250-
/// <item>Cannot be caught, filtered, or intercepted by any managed or unmanaged code</item>
251-
/// <item>Is what the CLR itself uses for internal fatal errors</item>
252-
/// </list>
253-
/// <para>
254-
/// Use this crash type if other crash types are not being captured by Azure Crash Monitoring.
255-
/// The error code 7 (FAST_FAIL_FATAL_APP_EXIT) is specifically designed for application crashes.
256-
/// </para>
257-
/// </remarks>
258-
private void ExecuteNativeCrash()
259-
{
260-
_logger.LogCritical("Triggering native crash via RaiseException (FAIL_FAST_EXCEPTION)!");
261-
262-
// Use RaiseException with FAIL_FAST_EXCEPTION code (0xC0000409)
263-
// This is the same exception code used by __fastfail and is reliably captured
264-
// by Windows Error Reporting and Azure Crash Monitoring
265-
const uint STATUS_STACK_BUFFER_OVERRUN = 0xC0000409; // __fastfail exception code
266-
const uint EXCEPTION_NONCONTINUABLE = 0x1;
267-
RaiseException(STATUS_STACK_BUFFER_OVERRUN, EXCEPTION_NONCONTINUABLE, 0, IntPtr.Zero);
268-
}
269-
270235
/// <summary>
271236
/// Allocates memory until the process runs out and crashes.
272237
/// </summary>
@@ -346,8 +311,7 @@ public Dictionary<CrashType, string> GetCrashTypeDescriptions()
346311
[CrashType.StackOverflow] = "Triggers StackOverflowException via infinite recursion. Cannot be caught. Creates interesting stack traces for analysis.",
347312
[CrashType.UnhandledException] = "Throws an unhandled exception on a background thread, demonstrating the importance of proper exception handling.",
348313
[CrashType.AccessViolation] = "Writes to invalid memory (null pointer). Demonstrates native-level crashes common in P/Invoke or unsafe code bugs.",
349-
[CrashType.OutOfMemory] = "Allocates memory until the process crashes. Useful for learning memory dump analysis techniques.",
350-
[CrashType.NativeCrash] = "Uses RtlFailFast to bypass ALL exception handlers including ANCM. Guarantees WER capture - use this if other types aren't detected by Azure Crash Monitoring."
314+
[CrashType.OutOfMemory] = "Allocates memory until the process crashes. Useful for learning memory dump analysis techniques."
351315
};
352316
}
353317
}

src/PerfProblemSimulator/wwwroot/documentation.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,6 @@ <h3>Available Crash Types</h3>
580580
<td>Allocates memory until the process crashes</td>
581581
<td>Memory dump analysis</td>
582582
</tr>
583-
<tr>
584-
<td><strong>NativeCrash</strong></td>
585-
<td>Uses <code>RtlFailFast</code> to bypass ALL exception handlers including ANCM</td>
586-
<td><strong>Best for Azure Crash Monitoring</strong> - guaranteed WER capture</td>
587-
</tr>
588583
</tbody>
589584
</table>
590585

@@ -840,7 +835,7 @@ <h3>Crash Simulation</h3>
840835
<span class="string">"message"</span>: <span class="string">"Optional crash message"</span>
841836
}
842837
</div>
843-
<p><strong>Available crash types:</strong> <code>NativeCrash</code> (recommended), <code>FailFast</code>, <code>StackOverflow</code>, <code>UnhandledException</code>, <code>AccessViolation</code>, <code>OutOfMemory</code></p>
838+
<p><strong>Available crash types:</strong> <code>FailFast</code> (recommended), <code>AccessViolation</code>, <code>StackOverflow</code>, <code>UnhandledException</code>, <code>OutOfMemory</code></p>
844839
</section>
845840

846841
<!-- Configuration Section -->

src/PerfProblemSimulator/wwwroot/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,10 @@ <h3>💥 Application Crash</h3>
109109
<div class="control-inputs">
110110
<label>Type:
111111
<select id="crashType" class="wide-input">
112-
<option value="NativeCrash">Native Crash (Best)</option>
113112
<option value="FailFast">FailFast</option>
113+
<option value="AccessViolation">Access Violation</option>
114114
<option value="StackOverflow">Stack Overflow</option>
115115
<option value="UnhandledException">Unhandled Exception</option>
116-
<option value="AccessViolation">Access Violation</option>
117116
<option value="OutOfMemory">Out of Memory</option>
118117
</select>
119118
</label>

0 commit comments

Comments
 (0)