[Stackless] Exception handling crashes, how to contribute

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Apr 4 11:57:53 CEST 2012

The scenario you describe might happen if the main tasklet is entered more than once, but with different structured exception handling in place. yes.  Interesting, we didn't think of this.
How involved is this exception chain repatching of which you speak?

I think that if you simply post a .patch file here, made from the sources at http://hg.python.com/stackless, but Richard Tew will know for sure :)


From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Gil Colgate
Sent: 3. apríl 2012 16:28
To: stackless at stackless.com
Subject: [Stackless] Exception handling crashes, how to contribute

I had the unfortunate experience of mixing python and C++ code on the Windows environment on a large program with multiple libraries not written by me.

The C++ code uses the structured exception handling protocol, and stackless does no properly handle this. This could result in crashes in the following way:

Whenever a python tasklet is suspended the top of the exception chain is saved by stackless. This very well could be pointing into code above the python stack into the main program. When the python tasklet is called again, it's stack is put back *in the same place*, but the environment above the stack *might be different*. This would cause the exception chain to screw up in the part where the exception chain points above the stack.

This would cause a crash on an exception... for example a function uses OutputDebugStr (which routes by using an exception).... the exception handler itself could crash.

I have corrected this issue in my local copy of Stackless.. it involves changes to stacklesseval.c and involves patching the exception chain properly when tasklet switching, in cases when windows structured execption handling is defined.  I have not contributed to stackless open source before, but I think anyone else getting peculiar crashes with exceptions on Windows might appreciate this fix.

I would like someone to explain the procedure to contribute to me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120404/264aa68f/attachment.html>

More information about the Stackless mailing list