[Stackless] Crash after throwing C++ exception? (SOLVED)

Lloyd Weehuizen lloyd at fusion.net.nz
Sat Nov 4 15:03:26 CET 2006


>>
>> Could the thrown exception be preventing stackless from processing its
>> UnwindTokens correctly?
>> 

Thanks for your help with this Richard, correcting the Watchdog 
scheduler's Yield return values solved a couple of problems. However it 
seems it was the thrown exception that was breaking things, here are my 
findings:

I have a method that explicitly catches the boost python exception at 
the point where the python function is called from C++. However, when 
the exception is thrown, its caught by the handler code surrounding the 
RunWatchdog. Am not sure why the code finds the watchdog handler instead 
of the handler surrounding the original call? I'm guessing it must have 
something to do with the way stackless switches the C stacks?

--- Tasklet --> C++ Initialise
              try
                 Call python initialise
                   Python code yields in scheduler, then throws exception
              catch boost::python::error_already_set
                 Handle Error
                 ( Code never reaches here )

... later ...

--- C++ Main Tasklet
              try
                   Resume Yielded
              catch boost::python::error_already_set
                   Error is caught here

This throw will probably bypass a lot of the stackless unwind code which 
gets it throughly confused as to whats going on causing the random crashes.

I've reworked the way I call the python function to prevent the 
exception from being thrown.

Cheers,
Lloyd


_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list