|
107 | 107 | font-family: 'Cascadia Code', 'Consolas', monospace; |
108 | 108 | font-size: 0.875rem; |
109 | 109 | line-height: 1.6; |
| 110 | + white-space: pre; |
110 | 111 | } |
111 | 112 |
|
112 | 113 | .code-block .comment { color: #6a9955; } |
@@ -291,6 +292,7 @@ <h1>☁️ Azure Monitoring Guide</h1> |
291 | 292 | <li><a href="#cpu">Diagnosing High CPU</a></li> |
292 | 293 | <li><a href="#memory">Diagnosing Memory Pressure</a></li> |
293 | 294 | <li><a href="#threads">Diagnosing Thread Pool Starvation</a></li> |
| 295 | + <li><a href="#crash">Diagnosing Application Crashes</a></li> |
294 | 296 | <li><a href="#latency">Latency Monitor</a></li> |
295 | 297 | <li><a href="#setup">Monitoring Setup</a></li> |
296 | 298 | <li><a href="#best-practices">Best Practices</a></li> |
@@ -495,6 +497,129 @@ <h3>Code Pattern (What's Wrong)</h3> |
495 | 497 | </div> |
496 | 498 | </section> |
497 | 499 |
|
| 500 | + <!-- Diagnosing Application Crashes Section --> |
| 501 | + <section id="crash" class="doc-section"> |
| 502 | + <h2>💥 Diagnosing Application Crashes</h2> |
| 503 | + |
| 504 | + <h3>Symptoms</h3> |
| 505 | + <ul> |
| 506 | + <li>Application suddenly becomes unavailable</li> |
| 507 | + <li>HTTP 502/503 errors returned to clients</li> |
| 508 | + <li>Azure auto-restarts the application</li> |
| 509 | + <li>Event logs show process termination</li> |
| 510 | + </ul> |
| 511 | + |
| 512 | + <h3>Azure Crash Monitoring</h3> |
| 513 | + <p>Azure App Service includes built-in Crash Monitoring that can automatically capture memory dumps when your application crashes.</p> |
| 514 | + |
| 515 | + <h4>Enabling Crash Monitoring</h4> |
| 516 | + <ol> |
| 517 | + <li>Navigate to your App Service in the Azure Portal</li> |
| 518 | + <li>Go to <strong>Diagnose and solve problems</strong></li> |
| 519 | + <li>Search for "Crash Monitoring"</li> |
| 520 | + <li>Enable crash dump collection</li> |
| 521 | + </ol> |
| 522 | + |
| 523 | + <div class="info-box"> |
| 524 | + <h4>⚠️ Important: Storage Account Restrictions</h4> |
| 525 | + <p>In some Azure environments, Crash Monitoring may not work due to security restrictions on storage accounts. If you cannot use Crash Monitoring, you can collect memory dumps manually using <strong>ProcDump</strong> from the Kudu console.</p> |
| 526 | + </div> |
| 527 | + |
| 528 | + <h3>Using ProcDump for Manual Dump Collection</h3> |
| 529 | + <p><a href="https://learn.microsoft.com/en-us/sysinternals/downloads/procdump" target="_blank">ProcDump</a> is a Sysinternals command-line utility that can monitor applications and generate crash dumps. It's available on Azure App Service through the Kudu console.</p> |
| 530 | + |
| 531 | + <h4>Accessing the Kudu Console</h4> |
| 532 | + <ol> |
| 533 | + <li>Navigate to your App Service</li> |
| 534 | + <li>Go to <strong>Development Tools</strong> > <strong>Advanced Tools</strong></li> |
| 535 | + <li>Click <strong>Go</strong> to open Kudu</li> |
| 536 | + <li>Select <strong>Debug console</strong> > <strong>CMD</strong> or <strong>PowerShell</strong></li> |
| 537 | + </ol> |
| 538 | + |
| 539 | + <h4>Common ProcDump Commands</h4> |
| 540 | + <div class="code-block"> |
| 541 | +<span class="comment"># Write a full memory dump of a process by name</span> |
| 542 | +procdump -ma w3wp.exe |
| 543 | + |
| 544 | +<span class="comment"># Write a full dump when an unhandled exception occurs</span> |
| 545 | +procdump -ma -e w3wp.exe |
| 546 | + |
| 547 | +<span class="comment"># Write a full dump on 1st or 2nd chance exception</span> |
| 548 | +procdump -ma -e 1 w3wp.exe |
| 549 | + |
| 550 | +<span class="comment"># Write up to 10 dumps, one per exception</span> |
| 551 | +procdump -ma -n 10 -e 1 w3wp.exe |
| 552 | + |
| 553 | +<span class="comment"># Write a dump when CPU exceeds 80% for 10 seconds</span> |
| 554 | +procdump -ma -c 80 -s 10 w3wp.exe |
| 555 | + |
| 556 | +<span class="comment"># Write a dump when memory exceeds 1GB</span> |
| 557 | +procdump -ma -m 1024 w3wp.exe |
| 558 | + |
| 559 | +<span class="comment"># Write a dump when a hung window is detected</span> |
| 560 | +procdump -ma -h w3wp.exe |
| 561 | + </div> |
| 562 | + |
| 563 | + <h4>ProcDump Options Reference</h4> |
| 564 | + <table class="latency-table"> |
| 565 | + <thead> |
| 566 | + <tr> |
| 567 | + <th>Option</th> |
| 568 | + <th>Description</th> |
| 569 | + </tr> |
| 570 | + </thead> |
| 571 | + <tbody> |
| 572 | + <tr> |
| 573 | + <td><code>-ma</code></td> |
| 574 | + <td>Full dump (all memory)</td> |
| 575 | + </tr> |
| 576 | + <tr> |
| 577 | + <td><code>-mm</code></td> |
| 578 | + <td>Mini dump (default, smaller size)</td> |
| 579 | + </tr> |
| 580 | + <tr> |
| 581 | + <td><code>-mp</code></td> |
| 582 | + <td>MiniPlus dump (detailed but 10-75% smaller than full)</td> |
| 583 | + </tr> |
| 584 | + <tr> |
| 585 | + <td><code>-e</code></td> |
| 586 | + <td>Dump on unhandled exception (add <code>1</code> for first-chance)</td> |
| 587 | + </tr> |
| 588 | + <tr> |
| 589 | + <td><code>-c</code></td> |
| 590 | + <td>CPU threshold percentage</td> |
| 591 | + </tr> |
| 592 | + <tr> |
| 593 | + <td><code>-m</code></td> |
| 594 | + <td>Memory commit threshold in MB</td> |
| 595 | + </tr> |
| 596 | + <tr> |
| 597 | + <td><code>-n</code></td> |
| 598 | + <td>Number of dumps to write before exiting</td> |
| 599 | + </tr> |
| 600 | + <tr> |
| 601 | + <td><code>-s</code></td> |
| 602 | + <td>Consecutive seconds before dump (default 10)</td> |
| 603 | + </tr> |
| 604 | + <tr> |
| 605 | + <td><code>-h</code></td> |
| 606 | + <td>Dump on hung window</td> |
| 607 | + </tr> |
| 608 | + <tr> |
| 609 | + <td><code>-t</code></td> |
| 610 | + <td>Dump on process termination</td> |
| 611 | + </tr> |
| 612 | + </tbody> |
| 613 | + </table> |
| 614 | + |
| 615 | + <h4>Downloading the Dump File</h4> |
| 616 | + <ol> |
| 617 | + <li>In Kudu, navigate to the folder where the dump was created</li> |
| 618 | + <li>Click the download icon next to the <code>.dmp</code> file</li> |
| 619 | + <li>Open the dump in Visual Studio, WinDbg, or another debugger</li> |
| 620 | + </ol> |
| 621 | + </section> |
| 622 | + |
498 | 623 | <!-- Using the Request Latency Monitor Section --> |
499 | 624 | <section id="latency" class="doc-section"> |
500 | 625 | <h2>⏱️ Using the Request Latency Monitor</h2> |
|
0 commit comments