gc assertion failure
Michael Hudson
mwh at python.net
Thu Oct 30 05:44:37 EST 2003
Todd Miller <jmiller at stsci.edu> writes:
> Michael Hudson wrote:
> > Todd Miller <jmiller at stsci.edu> writes:
> >
> >>I recently discovered an assertion failure in the Python garbage
> >>collection system when scripts using our C extension (numarray)
> >>exit. The assertion is activated for Pythons configured using
> >>--with-pydebug. I have a feeling I may be doing something wrong with
> >>garbage collection support for some of our c types, but I'm not sure
> >>exactly what.
> >>
> >>Here is the assertion output:
> >>
> >>python: Modules/gcmodule.c:231: visit_decref: Assertion
> >>`gc->gc.gc_refs != 0' failed.
> >>Abort (core dumped)
> >>
> >>
> >>Here's the traceback from gdb:
> > [snip]
> >>Can anyone give me any insight into what needs fixing?
> > Oh good grief, it could be anything (I think).
>
> Sorry...
It seems I was a bit extreme, reading followups. But I think that
assertion failure has been a symptom of some scary bugs in Python
itself.
> I have two theories myself:
>
> 1) I need to implement explicit support for GC for some of the
> numarray c types. I was hoping to avoid this by virtue of the
> unlikeliness of reference cycles in the types in question.
>
> 2) There are other reference counting errors in numarray which are
> being exposed during gc. In particular, it appears the tuple type
> is being traversed when the assertion fails.
I know you found your error, but yet another tool for finding things
like this is the TrackRefs class from Zope's test runner. I found a
bunch of refcounting bugs in Python 2.3(.0) with it a couple months
back.
Cheers,
mwh
--
About the use of language: it is impossible to sharpen a
pencil with a blunt axe. It is equally vain to try to do
it with ten blunt axes instead.
-- E.W.Dijkstra, 18th June 1975. Perl did not exist at the time.
More information about the Python-list
mailing list