*** glibc detected *** gdb: malloc(): smallbin double linked list

2010-11-05 Thread John Reid

Hi,

I've compiled
Python 2.7 (r27:82500, Nov  2 2010, 09:00:37)
[GCC 4.4.3] on linux2

with the following configure options
./configure --prefix=/home/john/local/python-dbg --with-pydebug

I've installed numpy and some other packages but when I try to run my 
extension code under gdb I get the errors below. Does anyone have any 
ideas of how to track down what's happening here? I imagine I've 
misconfigured something somewhere. Is valgrind the answer?


Thanks,
John.



*** glibc detected *** gdb: malloc(): smallbin double linked list 
corrupted: 0x04de7ad0 ***

=== Backtrace: =
/lib/libc.so.6(+0x775b6)[0x7f0a252215b6]
/lib/libc.so.6(+0x7b8e9)[0x7f0a252258e9]
/lib/libc.so.6(__libc_malloc+0x6e)[0x7f0a2522658e]
gdb(xmalloc+0x18)[0x45bc38]
gdb[0x476df1]
gdb[0x474c9b]
gdb[0x474ee8]
gdb(execute_command+0x2dd)[0x458d1d]
gdb(catch_exception+0x50)[0x535510]
gdb[0x4b5191]
gdb(interp_exec+0x17)[0x535637]
gdb(mi_cmd_interpreter_exec+0x6c)[0x4b9adc]
gdb[0x4ba71a]
gdb(catch_exception+0x50)[0x535510]
gdb(mi_execute_command+0x97)[0x4ba137]
gdb[0x53a0f8]
gdb(gdb_do_one_event+0x29a)[0x53b38a]
gdb(catch_errors+0x5b)[0x53531b]
gdb(start_event_loop+0x1e)[0x53a90e]
gdb[0x44f619]
gdb(catch_errors+0x5b)[0x53531b]
gdb[0x450166]
gdb(catch_errors+0x5b)[0x53531b]
gdb(gdb_main+0x24)[0x44f554]
gdb(main+0x2e)[0x44f51e]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f0a251c8c4d]
gdb[0x44f429]
=== Memory map: 
0040-00818000 r-xp  08:05 4832730  /usr/bin/gdb
00a17000-00a18000 r--p 00417000 08:05 4832730  /usr/bin/gdb
00a18000-00a25000 rw-p 00418000 08:05 4832730  /usr/bin/gdb
00a25000-00a43000 rw-p  00:00 0
0287f000-0b92 rw-p  00:00 0  [heap]
7f0a1c00-7f0a1c021000 rw-p  00:00 0
7f0a1c021000-7f0a2000 ---p  00:00 0
7f0a20fc-7f0a20fd6000 r-xp  08:05 3498245  /lib/libgcc_s.so.1
7f0a20fd6000-7f0a211d5000 ---p 00016000 08:05 3498245  /lib/libgcc_s.so.1
7f0a211d5000-7f0a211d6000 r--p 00015000 08:05 3498245  /lib/libgcc_s.so.1
7f0a211d6000-7f0a211d7000 rw-p 00016000 08:05 3498245  /lib/libgcc_s.so.1
7f0a211fd000-7f0a21211000 r--p 000dc000 08:05 4825848 
/usr/lib/libstdc++.so.6.0.13
7f0a21211000-7f0a21218000 r--p 00018000 08:05 4841756 
/usr/lib/debug/lib/librt-2.11.1.so
7f0a21218000-7f0a21226000 r--p 1000 08:05 4841756 
/usr/lib/debug/lib/librt-2.11.1.so

7f0a21226000-7f0a2123e000 r--p 000bc000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a2123e000-7f0a21287000 r--p 003dd000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a21287000-7f0a21299000 r--p 00425000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a21299000-7f0a213e7000 r--p 0018c000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a213e7000-7f0a2152f000 r--p 0207c000 08:05 4653324 
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/_stempy.so
7f0a2152f000-7f0a22027000 r--p 01585000 08:05 4653324 
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/_stempy.so

7f0a22027000-7f0a2240 rw-p  00:00 0
7f0a22408000-7f0a224d1000 r--p 00315000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a224d1000-7f0a224ff000 r--p 002e8000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a224ff000-7f0a22526000 r--p 00038000 08:05 4653310
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/myrrh_pylib-d
7f0a22526000-7f0a2259c000 r--p 0151 08:05 4653324 
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/_stempy.so
7f0a2259c000-7f0a2280c000 r--p 012a 08:05 4653324 
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/_stempy.so

7f0a2280c000-7f0a2343f000 rw-p  00:00 0
7f0a23443000-7f0a2344c000 r--p 0001a000 08:05 6169643 
/home/john/local/python-dbg/lib/python2.7/lib-dynload/datetime.so

7f0a2344c000-7f0a2345c000 r--p 002d9000 08:05 4653290
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_python.so.1.44.0
7f0a2345c000-7f0a23461000 r--p 0005e000 08:05 4653310
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/myrrh_pylib-d
7f0a23461000-7f0a23477000 r--p 0001f000 08:05 4653310
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/myrrh_pylib-d
7f0a23477000-7f0a2347d000 r--p 4000 08:05 4653095
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/libboost_system.so.1.44.0
7f0a2347d000-7f0a2350c000 r--p 00757000 08:05 4653324 
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/_stempy.so
7f0a2350c000-7f0a23555000 r--p 021c3000 08:05 4653324 
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stempy/_debug/_stempy.so
7f0a23555000-7f0a2355b000 r--p 00048000 08:05 6169627 
/home/john/local/python-dbg/lib/python2.7/lib-dynload

Re: *** glibc detected *** gdb: malloc(): smallbin double linked list

2010-11-05 Thread Nobody
On Fri, 05 Nov 2010 19:39:12 +, John Reid wrote:

 I've compiled
 Python 2.7 (r27:82500, Nov  2 2010, 09:00:37) [GCC 4.4.3] on linux2
 
 with the following configure options
 ./configure --prefix=/home/john/local/python-dbg --with-pydebug
 
 I've installed numpy and some other packages but when I try to run my
 extension code under gdb I get the errors below. Does anyone have any
 ideas of how to track down what's happening here? I imagine I've
 misconfigured something somewhere. Is valgrind the answer?

I imagine that your extension code is trashing the heap, in which case,
valgrind is probably the answer.

My first guess would be that something is writing to a heap block after it
has been deallocated (possibly due to omitting a Py_INCREF). Of course,
other causes are possible, but writing to deallocated memory is a common
problem when writing extensions for languages with garbage collection.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: *** glibc detected *** gdb: malloc(): smallbin double linked list

2010-11-05 Thread Lawrence D'Oliveiro
In message pan.2010.11.05.21.30.11.656...@nowhere.com, Nobody wrote:

 I imagine that your extension code is trashing the heap, in which case,
 valgrind is probably the answer.

Something simpler to try first is to run the code with the MALLOC_CHECK_ 
environment variable set to 2 or 3. That might give a few more clues.
-- 
http://mail.python.org/mailman/listinfo/python-list