473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

gc assertion failure

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
3 3149
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Etayki | last post by:
Hi, I am getting an assertion failure when declaring a CInternetSession object: CInternetSession mySession; // a session object I am still able to run the program, but I receive that...
2
by: Craig Klementowski | last post by:
Pardon the cross post, but I'm not sure where exactly to post this question. We have MFC application using many MFC extention DLL's. We started using a new MFC extention DLL that is mixed mode so...
5
by: Ron Louzon | last post by:
I have some C++ code that uses the CSingleLock( CCriticalSection *) constructor. In visual C++ 6.0, this code compiles and runs fine in both Debug and release modes. However, in Visual Studio...
9
by: Bern McCarty | last post by:
I am porting stuff from MEC++ syntax to the new C++/CLI syntax. Something that we did in the old syntax that proved to be very valuable was to make sure that the finalizer would purposefully...
2
by: Pushpa | last post by:
Hi All, This my part of the c++ program using threads in windows : //modified by pushpa struct structExrdDoc { CExrdDoc* spDoc; LPCTSTR sstrFileName;
1
by: =?Utf-8?B?SWxpYW4=?= | last post by:
Hello there, I recently installed MS Office 2007. I have two computers- one runs XP and the second Media Center. When I type a letter in Ward the spell check doesn't work. When I close the...
2
by: rsr | last post by:
hi, I am unable to execute my application though I am able to build and compile it without warnings or errors, because of this. Debug Assertion failure file tcscat_s.inl line: 42 can...
22
by: kudruu | last post by:
Hello, I am having a problem in Microsoft Visual C++ with some code I have written (I am a bit of a novice so I appologize if this is a very mundane problem). This is a segment from one of the...
1
by: aalam | last post by:
class base { int a; base(int x) { a=x; } ~base(); } class derive:public base
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.