Re: Frame-based exception handling problem on Server 2008

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



If all you want is a signal, then would a vectored exception handler work?
(AddVectoredExceptionHandler)



Alternately, your could set the default handler
(SetUnhandledExceptionFilter)



IMHO: Your problem is likely the result of Windows scanning the stack of EH
frames before calling them to ensure that there are no 'unsafe' (i.e. hacked
via buffer overrun etc.) frames that might be called.


"Corinna Vinschen" <corinna@xxxxxxxxxxxxxxxx> wrote in message
news:fpmver$cvt$1@xxxxxxxxxxxxxxxxxx
roger.orr@xxxxxxxxx wrote:
On Feb 21, 4:54?pm, Corinna Vinschen <cori...@xxxxxxxxxxxxxxxx> wrote:
Debugging turned up that Server 2008 has apparently a problem with
Cygwin's exception handling.

Curious.

What is the call stack, including kernel entries?

One easy way to get this is using Process Explorer:

Uh, right, I forgot to use ProcessExplorer when I sent my reply
to Jeffrey. I'll follow up with the stack info in my reply to Ivan.
Thanks for the hint.

Out of interest, why does the exception handler chain end in a loop?
I'd always assumed that if an exception handler didn't return the
"continue search" value then there would be no reason to even read
the pointer to prev value.

Two reasons:

Cygwin is trying to emulate Linux as close as possible. Exceptions are
converted to POSIX signals. If an application has no signal handler for
a given signal, the behaviour is defined by a system specific default
behaviour (SIG_DFL), which is either to ignore the signal and just go on
as if nothing happened, or to throw a core dump. If an application has
a signal handler for the given signal, and if the signal handler
returns, it returns to exactly the same spot where the exception
occured. If the cause of the exception hasn't been rectified, the
signal handler is called again.

The second reason is that the default signal handler interferes with
our exception handling. If the default handler is called, we can't
do the stuff we usually do, like, say, generating a core dump, making
kernel syslog entries, etc.


Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


.



Relevant Pages

  • Re: Rationale behind unwind-protect and double errors
    ... So: an error occurs in our Java program: an exception is constructed (if ... we'll resume the search for a matching handler. ... case we start unwinding stack frames and doing UNWIND-PROTECT stuff. ... the way finds itself in a bad state and signals a condition, well, that ...
    (comp.lang.lisp)
  • Re: Using SetConsoleCtrlHandler
    ... "bare minimum" principal should work even in multithreaded POSIX apps, ... you rely on recursive lock acqusition in your "signal handler" - hard to ... POSIX signals to POSIX processes". ... "Kernel mode APCs interrupt a thread and execute a procedure without ...
    (microsoft.public.win32.programmer.kernel)
  • Re: SetConsoleCtrlHandler
    ... This modified handler does not call ... signals. ... This allows the service to continue running after the user logs ... If the service installs its own console control handler, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: pitfalls of signals
    ... If you have a signal handler that was invoked as a result of your program ... in that case you've invoked undefined behavior ... without invoking undefined behavior ... -Temporarily block a set of signals that includes the one the handler ...
    (comp.lang.c)
  • Re: Mars Rover Controlled By Java
    ... When handling signals Ada provides a higher level abstraction that ... -- Defines the interface for a signal handler ... task Responder is ... interrupt is handled only once. ...
    (comp.programming)