[Python-Dev] Provoking Jim's MRO segfault before shutdown
Tim Peters
tim at zope.com
Thu Nov 13 02:17:34 EST 2003
[Tim]
> ...
> The suggested approach in the long earlier email should repair both
> the segfault and the AttributeError-out-of-thin-air surprises. ...
> The specific invocation of gc in which this occurred wouldn't be able
> to collect anything (at all, even if there were a million other objects
> in vanilla trash cycles at the time -- they wouldn't get collected
> until a later run of gc, one that didn't resurrect dead cycles).
Sorry, not so -- the "mini gc pass" of the same gc invocation would collect
all million of the other objects in vanilla trash cycles. It's only weakref
callbacks sick enough to install brand new weakref callbacks on dead objects
that would prevent the other trash from getting collected in the same gc
invocation. There wasn't anything like that in the segfaulting program.
It's also possible that we could change the weakref implementation to refuse
to allow creating new weakrefs while a weakref callback was in progress.
But that would be a new restriction; it wouldn't save gc much work (the mini
gc pass would still have to do full live-dead analysis on the leftover
trash; it would only save that pass from asking the "survivors" whether they
grew any new weakref callbacks); and reporting an exception that occurs
during gc happens by calling Py_FatalError (it's extreme).
More information about the Python-Dev
mailing list