[Stackless] Stackless status

Christian Tismer tismer at appliedbiometrics.com
Mon Oct 9 18:16:44 CEST 2000

Gordon McMillan wrote:

[about leaks]

> Well, it's easy to leak by not destroying continuations, but
> you already knew that :). What I've found is that an exception
> that crosses a continuation-boundary produces a leak (at
> least, that's my best deduction). If you catch the exception
> within the continuation, all is fine; but if you let it cross back
> into the guy that called the continuation, you're stuck. Seems
> to me I discovered this by toying with generator-like patterns:
> throwing an IndexError in the continuation, so the (caller of
> the) caller would fall out of a for loop. That's with 1.1.

Yes this is right. It is also with 1.2 (and for that reason I
must repair it before publishing).
The problem is exceptions. When a frame had an exception,
the exception state is not cleaned up until the function returns.
And if you leave a function via a continuation, the cleanup
doesn't take place (yet).
But the situation is much worse, since a frame that has seen
an exception and is later turned into a continuation frame,
is still referenced by the not yet cleaned-up traceback.
And if another frame now calls this cleanup by doing a return,
but it is still referenced, Python uses this frame to save
a reference to "the last exception of this thread", and we
end up with a pretty cycle that will eventually persist.

Exceptions have a stackful design, and I believe I have
to rewrite them, finally. At the moment, I'm just seeking for
a quick solution for the common cases that allows me to
deliver Stackless 1.2, but it is in fact a brain-teaser.

cheers - and thanks for any further hints - chris

Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com
Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list