Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: "Günter Prossliner" <g.prossliner/gmx/at>
- Date: Wed, 22 Nov 2006 12:56:40 +0100
Hi Oleg!
You simply should be aware that when you run heavy operations (like
MiniDumpWriteDump) in the process
that has just exhibited unhandled exception, the process state can be
corrupted badly enough for those operations to fail.
I thought about it.
In managed applications, probability of such fatal state corruptions
is lower than in native ones, though.
It is exactly what I tought too. The primary purpose is to catch unhandled
_managed_ exceptions. In most cases it sould be possible to create a
MiniDimp even if there has been an unhandled managed Exception.
In case of an StackOverflowException, I will try to use Jochens Assembler
Routine to recover from that.
Various issues related with reliability of exception filters and
just-in-time debugging have been discussed in this newsgroup before, e.g.
you can
find this thread interesting:
http://groups.google.fi/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/aa0bff4829bf3a44
Your posting within this thread (the last one) is quite informative! Maybe I
can implement more than one method to create the MiniDump:
Method A: The registered custom Exception Filter calls MiniDumpWriteDump
from a new thread within the same process
Method B: The registered custom Exception Filter signals a Watchdog Process
which creates the dump
Method C: The Watchdog Process is attached as a Debugger to the "real"
Process and creates the dump without the need to setup an custom Exception
Filter.
The user of the Component may choose what is nessersary in the concrete
case.
Maybe you can answer me the following question too:
If Method C will be implemented, how much performance does it cost? And one
which operations? Where does the performance - degradation come from? The
Debugger-Events?
There are two basic options:
1) Use just-in-time debugger configured in Registry, system-wide.
The problem with reliability of just-in-time debugging is the same as
with MiniDumpWriteDump - JIT debugger has to be started from the
inside of the crashed process, using CreateProcess function, and
CreateProcess itself can fail because of corruption of the process'
state (e.g. process heap).
Ok. If I understand this correctly, choosing the method will not be any
safer than creating a Thread in-process which creates the dump (new Process
vs. new Thread).
2) Run the application under debugger all the time (that's what
Jochen meant, probably, and that's also what ADPlus (crash mode) and
similar tools do).
This is much more reliable than JIT debugging, since it is not
affected by the possibly corrupted internals of the crashed process.
Also, it does not depend on Registry.
This would be Method C.
A last question: Can Method C be implemented without installing the
"Debugging Tools for Windows" on the users machine? This is the main reason
for me to implement an own component. The first solution I have tried to
implement is to create a "mini-installation" of the Debugging Tools for
Windows (just with cdb, adplus and the needed dlls). But when looking at
redist.txt, you can see that only "dbghelp.dll", "symsrv.dll" and
"srcsrv.dll" may be redistributed.
"MiniDumpWriteDump" is implemented within "dbghelp.dll", so the distribution
would be possible. But may I implement an "Watchdog Debugger" by using just
the redist dll's?
GP
.
- Follow-Ups:
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Oleg Starodumov
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- References:
- How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Aurelien Regat-Barrel
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Jochen Kalmbach [MVP]
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Aurelien Regat-Barrel
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Jochen Kalmbach [MVP]
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Günter Prossliner
- Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- From: Oleg Starodumov
- How to recover from a EXCEPTION_STACK_OVERFLOW?
- Prev by Date: Re: Detect log off in Console App
- Next by Date: Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- Previous by thread: Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- Next by thread: Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
- Index(es):
Relevant Pages
|