How to use ADPLUS to _ONLY_ get MiniDumpOnSecond

2020-05-03 12:00发布

问题:

For a production Win2003 web server, I'd like to be able to allways log minidumps whenever the w3wp.exe processes crash...I've read the documentation for ADPLUS, and have xcopy-deployed it to the production web server, and have started adplus.exe from the command line as follows:

adplus.exe -crash -MiniOnSecond -NoDumpOnFirst -pmn w3wp.exe -o C:\Dumps

This does log the "MiniOnSecond," but it is also logging full dumps on first--and I don't want those (they're big fat files, and don't have what I need). Has anyone found a way to get the "-NoDumpOnFirst" flag to actually work? Additionally, I'd like this behavior every time the box is rebooted--How can that be accomplished without running a batch file on-reboot? I've read about Windows Error Reporting (WER), and it is trivial to impliment this behavior on a Win2008R2 server--how to make that work on a 2003 server?

I've read the documentation for both ADPLUS and WER--but I need help with the actually command line and/or registry settings to make capturing minidumps simple on a Win 2003 Server. Thanks for your help!

回答1:

I played with the configuration file that can be attached with the -c flag...since i'm mostly interested in catching errors in my custom COM components, these settings create minidumps without fulldumps, and ignore CLR crashes, and don't full-dump on IISReset.

To have this run all the time, create a scheduled task. From an admin prompt:

schtasks /create /tn "Crash Dump Monitor w3wp" /tr "\"C:\Program Files\Debugging Tools for Windows (x86)\adplus.exe\" -c \"C:\Program Files\Debugging Tools for Windows (x86)\adplus_w3wp.xml\"" /sc ONSTART

Save this file as C:\Program Files\Debugging Tools for Windows (x86)\adplus_w3wp.xml :

<ADPlus Version="2">
<!-- 
PURPOSE:      Capture mini crash dumps in IIS 6.0. Do not capture full dumps
INSTRUCTIONS: Save this file in the same location as adplus.exe (usually C:\Program Files\Debugging Tools for Windows (x86))
COMMAND LINE: 
          "C:\Program Files\Debugging Tools for Windows (x86)\adplus.exe" -iis -c "C:\Program Files\Debugging Tools for Windows (x86)\adplus_w3wp.xml"
-->
  <Settings>
    <RunMode>Crash</RunMode>
    <OutputDir>C:\Dumps</OutputDir>
    <ProcessToMonitor>w3wp.exe</ProcessToMonitor>
  </Settings>
  <Exceptions>
    <All>
      <Actions1>VOID</Actions1>
      <Actions2>VOID</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </All>
    <Exception Code="av"><!-- Access Violoation -->
      <Actions1>Log;Time;Stack;MiniDump;EventLog</Actions1>
      <ReturnAction1>GN</ReturnAction1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="ch"><!-- InvalidHandle -->
      <Actions1>Log;Time;Stack;MiniDump;EventLog</Actions1>
      <ReturnAction1>GN</ReturnAction1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="ii"><!-- Illegal Instruction -->
      <Actions1>Log;Time;Stack;MiniDump;EventLog</Actions1>
      <ReturnAction1>GN</ReturnAction1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="dz"><!-- IntegerDivide -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="c000008e"><!-- FloatingDivide -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="iov"><!-- IntegerOverflow -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="lsq"><!-- InvalidLockSequence -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="sov"><!-- StackOverflow -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="aph"><!-- Application_hang -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="dm"><!-- Data_misaligned -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="gp"><!-- Guard_page_violation -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="ip"><!-- In_page_IO_error -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="isc"><!-- Invalid_system_call -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="sbo"><!-- StackOverflow -->
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>
    <Exception Code="epr"><!-- Process_Shut_Down -->
      <Actions1>Log;Time;</Actions1>
      <ReturnAction1>Q</ReturnAction1>
    </Exception>
    <!--
    <Exception Code="clr">
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>

    <Exception Code="*">
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>

    <Exception Code="clr">
      <Actions1>VOID</Actions1>
      <Actions2>Log;Time;Stack;MiniDump;EventLog</Actions2>
      <ReturnAction1>GN</ReturnAction1>
      <ReturnAction2>GN</ReturnAction2>
    </Exception>-->

  </Exceptions>

</ADPlus>

Can anyone improve on this? Have I missed any important crashing exceptions?