[Stackless] Strange crashes after channel send/receive

Christian Tismer tismer at stackless.com
Mon May 29 19:51:42 CEST 2006


Hi Lloyd,

> I'm having problems with totally trashed stacks after recent channel 
> send/receives.

*Weird*

> Python is embedded in my application and the main update loop calls into 
> a python function that calls stackless.run() each update. Somewhere 
> between the return of the python based update function and the calling C 
> PyObject_CallObject it crashes with 0xcccccccc being the only thing on 
> the stack.

Besides the fact that doing things this way guarantees worst
possible performance :-) - (I assume that you are calling into
uninitialized Stackless all the time, and the main tasklet
gets re-created all the time?) -
are you absolutely sure that you don't call into things
in your C code that is non-reentrant? This is easy to do
with Stackless.

Also, are you aware that the main tasklet will be a different
object every time you call into Stackless?

> As far as I can tell it gets triggered after the C++ app sends a message 
> down a channel ( from the main tasklet ), stackless switches into the 
> target tasklet, processes the event and switches back to the main 
> tasklet... The main tasklet then does the stackless.run(), which 
> executes all pending tasklets and then trashes the stack on its return 
> into the main C++ code.

Please add checks about what your real main tasklet is.
Maybe you are referring to a zombie?

> Does anybody have any tips on the best way to start debugging a problem 
> like this? Is there a way to get more debugging information out of the 
> stackless core?

There is not too much. I recommend a debug build, of course.
And you can register callbacks on schedule() calls and channel
operations for debugging.

If you don't mind, you also can send me the whole project
and I can take a look.

cheers - chris
-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

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



More information about the Stackless mailing list