[Numpy-tickets] [NumPy] #487: Segfault with recarrays and r3632
NumPy
numpy-tickets@scipy....
Sun Apr 1 13:56:40 CDT 2007
#487: Segfault with recarrays and r3632
------------------------+---------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: numpy.core | Version: none
Severity: normal | Resolution:
Keywords: |
------------------------+---------------------------------------------------
Comment (by faltet):
More info about this. Here it is another way of getting the segfault:
{{{
import numpy
dtype = [('var1', 'S4')]
recarr = numpy.empty(shape=1, dtype=dtype)
recarr['var1'][:] = ''
print "-->", recarr
}}}
i.e. without need of the loop. However, assigning to ' ' (a single blank)
instead of an empty string seems to work well. Also, if you don't print
the recarray, you don't get the segfault.
Finally, running the failing test through valgrind outs this:
{{{
==4875== Invalid write of size 1
==4875== at 0x401DC9C: memcpy (mc_replace_strmem.c:406)
==4875== by 0x808B462: PyString_FromStringAndSize (stringobject.c:82)
==4875== by 0x467A1C4: STRING_getitem (arraytypes.inc.src:376)
==4875== by 0x46B1A7E: VOID_getitem (arraytypes.inc.src:490)
==4875== by 0x46AB3A2: array_toscalar (arraymethods.c:460)
==4875== by 0x80C2EAD: PyEval_EvalFrameEx (ceval.c:3566)
==4875== by 0x80C3F4A: PyEval_EvalCodeEx (ceval.c:2833)
==4875== by 0x80C1E35: PyEval_EvalFrameEx (ceval.c:3662)
==4875== by 0x80C3F4A: PyEval_EvalCodeEx (ceval.c:2833)
==4875== by 0x810AB68: function_call (funcobject.c:517)
==4875== by 0x8059E66: PyObject_Call (abstract.c:1858)
==4875== by 0x80BBFDC: PyEval_CallObjectWithKeywords (ceval.c:3435)
==4875== Address 0x5F78027 is 1 bytes before a block of size 262,144
alloc'd
==4875== at 0x401C38B: malloc (vg_replace_malloc.c:149)
==4875== by 0x80888B0: PyObject_Malloc (obmalloc.c:563)
==4875== by 0x81042C9: PyCode_New (codeobject.c:80)
==4875== by 0x80DBEFF: r_object (marshal.c:873)
==4875== by 0x80DC829: PyMarshal_ReadLastObjectFromFile
(marshal.c:1019)
==4875== by 0x80D9037: load_source_module (import.c:750)
==4875== by 0x80DA375: load_package (import.c:998)
==4875== by 0x80D9738: import_submodule (import.c:2383)
==4875== by 0x80D9C8E: load_next (import.c:2207)
==4875== by 0x80D9E1D: import_module_level (import.c:1984)
==4875== by 0x80DA436: PyImport_ImportModuleLevel (import.c:2055)
==4875== by 0x80BBA85: builtin___import__ (bltinmodule.c:47)
==4875==
[4 more like this]
==4875== Process terminating with default action of signal 11 (SIGSEGV)
==4875== Bad permissions for mapped region at address 0x5F73FFF
==4875== at 0x401DC9C: memcpy (mc_replace_strmem.c:406)
==4875== by 0x808B462: PyString_FromStringAndSize (stringobject.c:82)
==4875== by 0x467A1C4: STRING_getitem (arraytypes.inc.src:376)
==4875== by 0x46B1A7E: VOID_getitem (arraytypes.inc.src:490)
==4875== by 0x46AB3A2: array_toscalar (arraymethods.c:460)
==4875== by 0x80C2EAD: PyEval_EvalFrameEx (ceval.c:3566)
==4875== by 0x80C3F4A: PyEval_EvalCodeEx (ceval.c:2833)
==4875== by 0x80C1E35: PyEval_EvalFrameEx (ceval.c:3662)
==4875== by 0x80C3F4A: PyEval_EvalCodeEx (ceval.c:2833)
==4875== by 0x810AB68: function_call (funcobject.c:517)
==4875== by 0x8059E66: PyObject_Call (abstract.c:1858)
==4875== by 0x80BBFDC: PyEval_CallObjectWithKeywords (ceval.c:3435)
--> --4875-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11
(SIGSEGV) -
exiting
--4875-- si_code=1; Faulting address: 0x20004; sp: 0x626EB6E8
valgrind: the 'impossible' happened:
Killed by fatal signal
==4875== at 0x3802032A: vgPlain_arena_free (m_mallocfree.c:601)
==4875== by 0x38036001: vgPlain_cli_free (replacemalloc_core.c:108)
==4875== by 0x380019DB: die_and_free_mem (mc_malloc_wrappers.c:111)
==4875== by 0x38036782: do_client_request (scheduler.c:1158)
==4875== by 0x380380A0: vgPlain_scheduler (scheduler.c:869)
==4875== by 0x3801E159: shutdown_actions_NORETURN (m_main.c:2782)
==4875== by 0x3805719C: run_a_thread_NORETURN (syswrap-linux.c:139)
sched status:
running_tid=1
Thread 1: status = VgTs_Runnable
==4875== at 0x401BFA5: free (vg_replace_malloc.c:233)
==4875== by 0x4192B59: _nl_archive_subfreeres (loadarchive.c:519)
==4875== by 0x4192ADB: _nl_locale_subfreeres (setlocale.c:507)
==4875== by 0x4192786: free_mem (gconv_db.c:792)
==4875== by 0x4192EE1: __libc_freeres (set-freeres.c:47)
==4875== by 0x40181F6: _vgnU_freeres (vg_preloaded.c:60)
Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.
If that doesn't help, please report this bug to: www.valgrind.org
In the bug report, send all the above text, the valgrind
version, and what Linux distro you are using. Thanks.
}}}
--
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/487#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list