[Stackless] a stackless crash

Christian Tismer tismer at stackless.com
Wed Nov 7 02:28:23 CET 2007


Richard Tew wrote:
> On 11/6/07, Christian Tismer <tismer at stackless.com> wrote:
>> This is not true, see the start of channelobject.c .
>> The channel gets temporarily resurrected, and it is
>> anyway visible through its members, since it is the
>> head of the taskets that it contains.
>> Therefore, it is possible to create new references,
>> and the beast stays alive.
>> Maybe this was a bad hack in order to save a pointer,
>> but it is so right now.
> 
> We should probably add something like the following regardless (along
> with a new channel 'zombie' flag of course).  It wouldn't matter if
> the programmer obtained references to a zombie channel as they
> wouldn't be able to do anything with it.
> 
> static void
> channel_clear(PyObject *ob)
> {
> 	PyChannelObject *ch = (PyChannelObject *) ob;
> 	int dir = ch->balance > 0 ? 1 : -1;
> 
> 	self->flags.closing = 1;
> 	self->flags.zombie = 1;
> 	while (ch->balance) {
> 		ob = (PyObject *) slp_channel_remove(ch, dir);
> 		Py_DECREF(ob);
> 	}
> }
> 
> static PyObject *
> channel_open(PyChannelObject *self)
> {
> 	if (self->flags.zombie)
> 		RUNTIME_ERROR("cannot open a dying channel.", NULL);
> 
> 	self->flags.closing = 0;
> 
> 	Py_INCREF(Py_None);
> 	return Py_None;
> }
> 
> Richard.

Yes, looks so far quite reasonable.

Why do you want to kill the channel, isn't it enough to
have the members being zombies, and to disallow them
to do anything?

Anyway, good that this started, it was needed to discuss
this since a long time.

I think this makes sense. It is the programmer's intent
to dispose of a channel. It should become a zombie, together
with all of its members. Probably this makes it easier
to catch unwanted misbehavior. Please go for it.

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