By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,221 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,221 IT Pros & Developers. It's quick & easy.

gc assertion failure

P: n/a
Hi,

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:

#0 0x4017dfd1 in kill () from /lib/libc.so.6
#1 0x4002d762 in raise () from /lib/libpthread.so.0
#2 0x4017dca2 in raise () from /lib/libc.so.6
#3 0x4017f04d in abort () from /lib/libc.so.6
#4 0x40177695 in __assert_fail () from /lib/libc.so.6
#5 0x080e9222 in visit_decref (op=0x405adc74, data=0x0) at
Modules/gcmodule.c:231
#6 0x0808cebf in tupletraverse (o=0x40a62f74, visit=0x80e9194
<visit_decref>, arg=0x0) at Objects/tupleobject.c:398
#7 0x080e9275 in subtract_refs (containers=0x813d2e8) at
Modules/gcmodule.c:250
#8 0x080e9a9e in collect (generation=2) at Modules/gcmodule.c:582
#9 0x080ea342 in PyGC_Collect () at Modules/gcmodule.c:993
#10 0x080e1bf6 in Py_Finalize () at Python/pythonrun.c:335
#11 0x08055543 in Py_Main (argc=4, argv=0xbffff6d4) at Modules/main.c:435
#12 0x08054cae in main (argc=4, argv=0xbffff6d4) at Modules/python.c:23
#13 0x4016c4ed in __libc_start_main () from /lib/libc.so.6

Can anyone give me any insight into what needs fixing?

Thanks,
Todd

Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Todd Miller <jm*****@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). Are you using the very
latest version of Python?

Cheers,
mwh

--
Well, yes. I don't think I'd put something like "penchant for anal
play" and "able to wield a buttplug" in a CV unless it was relevant
to the gig being applied for...
-- Matt McLeod, alt.sysadmin.recovery
Jul 18 '05 #2

P: n/a
Michael Hudson wrote:
Todd Miller <jm*****@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...

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.
Are you using the very latest version of Python?
This was Python-2.3.2.

Cheers,
mwh


Thanks,
Todd

Jul 18 '05 #3

P: n/a
Todd Miller <jm*****@stsci.edu> writes:
Michael Hudson wrote:
Todd Miller <jm*****@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.
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.