Frame-based exception handling problem on Server 2008
- From: Corinna Vinschen <corinna@xxxxxxxxxxxxxxxx>
- Date: Thu, 21 Feb 2008 16:54:34 +0000 (UTC)
Hi,
while testing Cygwin on Server 2008, I encountered a couple of spurious
hangs in OS functions, taking as much CPU it can get. This happens only
on Server 2008, both, 32 and 64 bit version, but it does not happen on
any other Windows version, up to and including Vista SP1.
Debugging turned up that Server 2008 has apparently a problem with
Cygwin's exception handling.
Usually, when using frame-based exception handling, the exception
handlers are organized via a linked list on the stack, starting at the
address referenced by the register %fs:0, using a structure like this.
typedef struct exception_list
{
struct exception_list *prev;
exception_handler *handler;
};
This is used by Cygwin, too, but with a tweak. There is only one
exception_list entry on the stack (not counting the default handler).
This entry is generated before the application's entry function is
called, and at creation time of any thread. The specific tweak is that
the exception prev pointer points back to itself, instead of to the
default handler. This allowed Linux-like signal handling even for
recurring computational exceptions so far in all Windows releases up to
and including Vista SP1, including all 64 bit versions.
However, exactly here's the problem. If the exception handler list is
an endless loop as described above, certain OS calls on Server 2008
simply hang endlessly, taking 100% CPU.
A very simple testcase is a division by zero:
main ()
{
return 1 / 0;
}
This is usually handled by our exception handler by either dumping a
stacktrace or core file, or by calling the applications's signal handler
for SIGFPE.
However, on Server 2008, our exception handler never gets called when
this happens. The process simply hangs, taking whatever CPU it can
grab.
Since this worked for all Windows versions before 2008, and since we're
not interested in the default exception handler taking over for Cygwin,
we would like to know, if there's a chance that this problem could be
fixed in 2008.
Barring that, it would be nice to learn how we can get our old behaviour
back, even if we don't create a exception handler loop, and if possible
in a unified way which works on previous Windows releases as well.
Thanks in advance,
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
.
- Follow-Ups:
- Re: Frame-based exception handling problem on Server 2008
- From: roger . orr
- RE: Frame-based exception handling problem on Server 2008
- From: "Jeffrey Tan[MSFT]"
- Re: Frame-based exception handling problem on Server 2008
- Prev by Date: Re: Cannot get reference to Locked screen when the system is in RDP st
- Next by Date: Re: high resolution timers
- Previous by thread: Re: rename fails on handle obtained by IoCreateFileSpecifyDeviceObject
- Next by thread: RE: Frame-based exception handling problem on Server 2008
- Index(es):
Relevant Pages
|