[Stackless] Exceptional state and pickling

Christian Tismer tismer at stackless.com
Sat Mar 29 03:15:30 CET 2008


hylje wrote:
> Pickling causes an fairly unintuitive exception if there is exceptional 
> state lingering about, but not in all conditions.
> 
> Yours truly is tinkering with a simple application I'm sure most of you 
> know -- the stackless game. The game of actors, which do things with 
> each other on a plane. In normal usage the poor actors get pickled all 
> swell upon process quit. However, when there happens a certain kind of 
> interaction through channels, the pickler dies with an intimidating 
> exception: a whole lot of pickle-related stack trace, and behold!
> 
> ValueError: frame exec function at 080c8f00 is not registered! (For the 
> inquisitive, for me 080c8f00 is named restore_exception)
> 
> The true problem lies with how stackless pickles execution frames. Not 
> all frames are created equal, for stackless needs special frames for 
> pickling. Therein lies a source -- functions produce frames pickle 
> cannot digest. This is normal for vanilla extension modules (C modules), 
> but should be worrisome for stackless-internal functions 
> (language-fundamental at that).
> 
> The trouble, however, is not only the incompatible frames. Those are to 
> be lived with, because before stackless rules the universe, there's 
> little actual need for explicit support for pickleable function state, 
> for just stackless. To finally get to it, the last straw is picking 
> those "bad" frames for pickling. As it is now, exceptional state -- 
> apparently, a try..except..finally block -- will try to get pickled, 
> though pickle can't eat it. Result is above.
> 
> This begs the question -- what to do with exceptional state with pickle? 
> (Disregard it? Re-raise stuff on the appropriate place? Where is that?)
> 
> p.s. greetings and credits for /stakkars/, from the #stacklesss IRC, for 
> helping me through this.

Well, thanks, and thanks for revealing this forgotten omission.

The fact that certain frames need special execution functions
is an implementation detail.
The fact that some of the seldom occurring situations are not yet
pickleable is an omission.

This is probably easy to implement, regardless of the implementation
model, but I didn't do it because the concept was not clear to me.

Let's think about it:

What should be done with an unhandled exception and pickling?
There are options, and they need to be discussed.

Do we want to

- save this unchanged
- silently forget the exception
- forbid exceptions for pickling, and raise a pickling error
- something more sophisticated?

What do you think would make most sense?

As a remark: pickling such an exceptional state is very likely
not to be un-picklable, because it contains very many unwanted
objects from the exception context.

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/




More information about the Stackless mailing list