[Stackless] pickling & killing

Giovanni Bajo giovannibajo at libero.it
Sun Sep 28 21:54:10 CEST 2003


On Saturday, September 27, 2003 6:29 PM [GMT+1=CET],
Christian Tismer <tismer at tismer.com> wrote:

> [CFrame pickling]
>
>> Do you have any planned timeframe for this? For instance, do you
>> plan to do this before or after the first release of 3.0?
>> Right now, my company needs to understand whether we can rely on
>> tasklet pickling or not, this is why I'm asking. If it's going to
>> take weeks, we'll have to drop this feature from our product for now.
>
> I'm trying to do it now. But you can live without it, see below.

Ok, let me now when it's done. Our junior programmers are still puzzled by
this.

>> right? But this actually causes a new segfault deep inside
>> python22.dll, which, alas, I can't reproduce with a small sample.
>> I'll be working on it.
>
> There is a bug right now, that prevends tasklets from correct
> unpickling if they never have run. I will fix this bug,
> so you can rely on the above to be working.


That might well have been the cause of the crash I have seen. Again, please
let me know when it's done.

>> I'm afraid I still don't understand enough of stackless internals to
>> follow you. Can you explain me, from a Python point of view, how can
>> I tell if my tasklets have a captured C state or not? And, does it
>> have anything to do with the softswitching?
>
> You can task the tasklet, inspect its frame attribute, and follow
> this frame chain, looking for a cstack attribute of the frames
> that isn't None. This one will be the problem you are seeking for.
>
> def valid_for_revival(t):
>      f = t.frame
>      while f:
>          if f.cstack:
>              return False
>          f = f.f_back
>      return True

Thanks for the code. I plugged it in and it seems that we never create a
cstack. We don't do anything fancy like driving Python from C, and we're
extending with a DLL, so I was kind of expecting everything to be ok.

>> I understand. I will try to isolate this but I don't think it's
>> going to be easy. Meanwhile, a crash location / call stack within
>> the code might help you? If so, I could recompile a debug version of
>> python stackless and make it crash.
>
> Yes, please.


I was unable to reproduce it with our current codebase. I already removed
all the cframe tasklets, and I don't use become() anymore, so it's probably
related to either of them. Anyway, I'll try reactivating task pickling in a
while when you fix the bugs.

>> So for instance, is there a way to get a list of all the alive
>> tasklets? Or all the tasklets insert in the scheduler list? This
>> would be a nice way to properly finish all of them immediatly.
>
> while stackless.runcount > 1:
>      t = stackless.current.next
>      t.kill()

Thanks, this helps. I'm going to remove my tasklet garbage collector.

Giovanni Bajo


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




More information about the Stackless mailing list