[Numpy-discussion] Vectorize bug

Albert Strasheim fullung at gmail.com
Fri Apr 14 17:19:05 CDT 2006


Hello all

I think Valgrind might be very useful in tracking down this bug.

http://valgrind.org/

Example usage:

~/bin/valgrind \
	-v --error-limit=no --leak-check=full \ 
	python -c 'import numpy; numpy.test()'

Valgrind emits many warnings for things going on inside Python on my Fedora
Core 4 system, but there is also a lot of interesting things going on in the
NumPy code.

Some warnings that someone might want to look at:

==26750== Use of uninitialised value of size 4
==26750==    at 0x453D4B1: DOUBLE_to_OBJECT (arraytypes.inc:4470)
==26750==    by 0x46AB3F3: PyUFunc_GenericFunction (ufuncobject.c:1566)
==26750==    by 0x46ABE9F: ufunc_generic_call (ufuncobject.c:2653)

==26750== Conditional jump or move depends on uninitialised value(s)
==26750==    at 0x4556055: PyArray_Newshape (multiarraymodule.c:524)
==26750==    by 0x45568F4: PyArray_Reshape (multiarraymodule.c:369)
==26750==    by 0x4556931: array_shape_set (arrayobject.c:4642)

==26750==  Address 0x41D2010 is 392 bytes inside a block of size 1,648
free'd
==26750==    at 0x4004F6B: free (vg_replace_malloc.c:235)
==26750==    by 0x46A53C3: ufuncloop_dealloc (ufuncobject.c:1280)
==26750==    by 0x46AAD60: PyUFunc_GenericFunction (ufuncobject.c:1656)
==26750==    by 0x46ABE9F: ufunc_generic_call (ufuncobject.c:2653)

==26750== Conditional jump or move depends on uninitialised value(s)
==26750==    at 0x454EE52: PyArray_NewFromDescr (arrayobject.c:4119)
==26750==    by 0x4550919: PyArray_GetField (arraymethods.c:265)
==26750==    by 0x456C05A: array_subscript (arrayobject.c:2010)
==26750==    by 0x456D606: array_subscript_nice (arrayobject.c:2250)

==26750== Conditional jump or move depends on uninitialised value(s)
==26750==    at 0x455ED1D: PyArray_MapIterReset (arrayobject.c:7788)
==26750==    by 0x456D087: array_ass_sub (arrayobject.c:1812)

A possible memory leak:

==26750== 6,051 (1,120 direct, 4,931 indirect) bytes in 28 blocks are
definitely lost in loss record 35 of 55
==26750==    at 0x400444E: malloc (vg_replace_malloc.c:149)
==26750==    by 0x45442D8: array_alloc (arrayobject.c:5332)
==26750==    by 0x454F19D: PyArray_NewFromDescr (arrayobject.c:4155)
==26750==    by 0x46A61E4: construct_loop (ufuncobject.c:1000)
==26750==    by 0x46AAD09: PyUFunc_GenericFunction (ufuncobject.c:1401)
==26750==    by 0x46ABE9F: ufunc_generic_call (ufuncobject.c:2653)
==26750==    by 0x454243B: PyArray_GenericBinaryFunction
(arrayobject.c:2593)
==26750==    by 0x456DA2C: PyArray_Round (multiarraymodule.c:291)

The following error is generated when the test segfaults:

==26750== Process terminating with default action of signal 11 (SIGSEGV)
==26750==  Access not within mapped region at address 0x10FFFF
==26750==    at 0x453D4B1: DOUBLE_to_OBJECT (arraytypes.inc:4470)
==26750==    by 0x46AB3F3: PyUFunc_GenericFunction (ufuncobject.c:1566)
==26750==    by 0x46ABE9F: ufunc_generic_call (ufuncobject.c:2653)

Regards,

Albert

> -----Original Message-----
> From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-
> discussion-admin at lists.sourceforge.net] On Behalf Of Albert Strasheim
> Sent: 15 April 2006 01:55
> To: 'numpy-discussion'
> Subject: RE: [Numpy-discussion] Vectorize bug
> 
> Hello
> 
> I don't have SciPy installed. Is there any way of doing a debug build of
> the
> C code so that I can investigate this problem?
> 
> You say that you cannot reproduce this problem. Are you trying to
> reproduce
> it on Linux or on Windows under IPython? I have also been unable to
> reproduce the crash on Linux, but as we saw earlier, this crash also
> cropped
> up on Solaris, without having to run the tests N times.
> 
> Regards,
> 
> Albert
> 
> > -----Original Message-----
> > From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-
> > discussion-admin at lists.sourceforge.net] On Behalf Of Travis Oliphant
> > Sent: 15 April 2006 01:42
> > To: numpy-discussion
> > Subject: Re: [Numpy-discussion] Vectorize bug
> >
> > Albert Strasheim wrote:
> >
> > >Hello Travis
> > >
> > >I'm still getting the same crash when running via IPython, which is the
> > only
> > >way I've been able to reproduce the crash on Windows.
> > >
> > >Just to confirm:
> > >
> > >In [1]: import numpy
> > >
> > >In [2]: numpy.__version__
> > >Out[2]: '0.9.7.2356'
> > >
> > >The crash now happens in check_large, which is the new name of the test
> > >method in question.
> > >
> > >
> > Do you have SciPy installed?
> >
> > Make sure you are not importing an old version of SciPy.
> >
> > I cannot reproduce this problem.
> >
> > -Travis
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion





More information about the Numpy-discussion mailing list