This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python crashes when running numpy test
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: alex_lai, amaury.forgeotdarc, ezio.melotti
Priority: normal Keywords:

Created on 2011-04-30 01:16 by alex_lai, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg134827 - (view) Author: Alex Lai (alex_lai) Date: 2011-04-30 01:16
Hi experts,

            I’m wondering if anyone would look into this issue. We recently installed Python 3.1.2 on a Solaris 10 machine. While testing numpy package, Python crashed with the following error:

sbtorsvr391:~ $ cd /home/dcottr/local/tests
sbtorsvr391:~/local/tests $ export PYTHONPATH=$PYTHONPATH:~/local/lib/python3.1/site-packages

sbtorsvr391:~/local/tests $ /usr/local/bin/python3 -c "import numpy; numpy.test()"
Running unit tests for numpy
NumPy version 1.5.1
NumPy is installed in /home/dcottr/local/lib/python3.1/site-packages/numpy

Python version 3.1.2 (r312:79147, Mar 23 2010, 02:42:06) [GCC 3.4.6]
nose version 1.0.0
..S...............................................................................................................................................S........Warning: invalid value encountered in isfinite
............................................................................................................................................................................................Warning: invalid value encountered in isinf
Warning: invalid value encountered in isinf
......................................................................................................SSS........................K...........................................................K.....................................................................................................................................................F.F....................K.............................................................................................K...SK.F.......S...........................................................................................Segmentation Fault (core dumped)


            Below is the stack trace from the core dump:

 

# mdb core_sbtorsvr391_python3_10439_5000_1304101376_11246

Loading modules: [ libc.so.1 libavl.so.1 libuutil.so.1 ld.so.1 ]

> 
> ::stack
libc.so.1`strlen+0x50(fba55238, ffbf9ef8, ffbf9761, 0, 0, 0)
libc.so.1`sprintf+0x40(ffbf9f18, 7fffffff, 7ffffc00, 2, 2, 1b74cc)
test_array_from_pyobj_ext.so`array_from_pyobj+0x4e0(6, 17d3ec0, 1, 7, 16176c0, ff13a5a0)
test_array_from_pyobj_ext.so`f2py_rout_wrap_call+0xbc(1, 1, 0, 17f000, fffffffe, fba65b94)
PyCFunction_Call+0x90(15ff350, 1841900, 1844e90, 0, 1, 183df38)
PyEval_EvalFrameEx+0x4f10(0, ffbfa1c0, 1615770, 1, 16491b0, 15ff350)
PyEval_EvalCodeEx+0x874(1615770, 161ff60, 0, 160cf3c, 5, 0)
function_call+0x8c(162e270, 160cf30, 0, 17f000, fffffffe, 40)
PyObject_Call+0x44(162e270, 160cf30, 0, 160cf3c, 4, 16176c0)
method_call+0x8c(162e270, 18418d0, 0, 1849f60, 1, 3f)
PyObject_Call+0x44(176b620, 18418d0, 0, 2ed5c, 2efe0, 176b620)
slot_tp_init+0x7c(176b620, 18418d0, 0, 2, 1, 16296d0)
type_call+0xdc(16521a0, 18418d0, 0, 17f000, fffffffe, 3e)
PyObject_Call+0x44(16521a0, 18418d0, 0, 18418d8, 1820030, 183ddbc)
PyEval_EvalFrameEx+0x37b4(0, ffbfa688, 162e9b0, 1, 16259c0, 16521a0)
PyEval_EvalFrameEx+0x5c98(0, ffbfa788, 16154e8, 1, 1626030, 162eb28)
PyEval_EvalFrameEx+0x5c98(0, ffbfa888, 52b260, 1, 57ec00, 162e468)
PyEval_EvalCodeEx+0x874(52b260, 5229c0, 0, 1808834, 2, 1ac03c)
function_call+0x8c(5a36a8, 1808828, 0, 17f000, fffffffe, 3a)
PyObject_Call+0x44(5a36a8, 1808828, 1825a50, 19b000, 163ab30, fe36c4)
PyEval_EvalFrameEx+0x13bc(0, fe36c8, 52b2f0, 1, 526d50, 1808828)
PyEval_EvalCodeEx+0x874(52b2f0, 1, 0, 1808c1c, 2, 0)
function_call+0x8c(5a3738, 1808c10, 0, 17f000, fffffffe, 38)
PyObject_Call+0x44(5a3738, 1808c10, 0, 1808c10, 1, 1849e50)
method_call+0x8c(5a3738, 1630450, 0, 1630440, 9, 37)
PyObject_Call+0x44(1612850, 1630450, 0, 193618, 2, 1612850)
slot_tp_call+0x7c(163ab30, 1630450, 0, 17f000, fffffffe, 36)
PyObject_Call+0x44(163ab30, 1630450, 0, 1630458, 1849e50, fe355c)
PyEval_EvalFrameEx+0x37b4(0, ffbfaf78, b1e0f8, 1, a873a0, 163ab30)
PyEval_EvalFrameEx+0x5c98(0, ffbfb078, b1e0b0, 1, b1db58, b1ed20)
PyEval_EvalCodeEx+0x874(b1e0b0, b0e810, 0, 180b67c, 2, 1ac03c)
function_call+0x8c(b1ecd8, 180b670, 0, 17f000, fffffffe, 33)
PyObject_Call+0x44(b1ecd8, 180b670, 18258a0, 19b000, 163abf0, fe2f3c)
PyEval_EvalFrameEx+0x13bc(0, fe2f40, b1ccc8, 1, b1a350, 180b670)
PyEval_EvalCodeEx+0x874(b1ccc8, 1, 0, 1844dac, 2, 0)
function_call+0x8c(b1ea50, 1844da0, 0, 17f000, fffffffe, 31)
PyObject_Call+0x44(b1ea50, 1844da0, 0, 1844da0, 1, e4ddf0)
method_call+0x8c(b1ea50, 16306d0, 0, 16306c0, b, 30)
PyObject_Call+0x44(176b5a8, 16306d0, 0, 1ab728, 18f708, 176b5a8)
slot_tp_call+0x7c(163abf0, 16306d0, 0, 17f000, fffffffe, 2f)
PyObject_Call+0x44(163abf0, 16306d0, 0, 16306d8, e4ddf0, 18374d8)
PyEval_EvalFrameEx+0x37b4(0, ffbfb768, b2e4e8, 1, ad9ce8, 163abf0)
PyEval_EvalCodeEx+0x874(b2e4e8, b1b4b0, 0, 18087bc, 2, 1ac03c)
function_call+0x8c(a00390, 18087b0, 0, 17f000, fffffffe, 2d)
PyObject_Call+0x44(a00390, 18087b0, 176c810, 19b000, 165c450, 182ea24)
PyEval_EvalFrameEx+0x13bc(0, 182ea28, b2e380, 1, b1ad50, 18087b0)
PyEval_EvalCodeEx+0x874(b2e380, 1, 0, 176b8ac, 2, 0)
function_call+0x8c(a002b8, 176b8a0, 0, 17f000, fffffffe, 2b)
PyObject_Call+0x44(a002b8, 176b8a0, 0, 176b8a0, 1, e4ddf0)
method_call+0x8c(a002b8, 16141b0, 0, 16141a0, 9, 2a)
PyObject_Call+0x44(1612c10, 16141b0, 0, 1ab728, 18f708, 1612c10)
slot_tp_call+0x7c(165c450, 16141b0, 0, 17f000, fffffffe, 29)
PyObject_Call+0x44(165c450, 16141b0, 0, 16141b8, e4ddf0, 1645cf0)
PyEval_EvalFrameEx+0x37b4(0, ffbfbe58, b2e4e8, 1, ad9ce8, 165c450)
PyEval_EvalCodeEx+0x874(b2e4e8, b1b4b0, 0, 16296a4, 2, 1ac03c)
function_call+0x8c(a00390, 1629698, 0, 17f000, fffffffe, 27)
PyObject_Call+0x44(a00390, 1629698, 161f8a0, 19b000, 176a270, 124868c)
PyEval_EvalFrameEx+0x13bc(0, 1248690, b2e380, 1, b1ad50, 1629698)
PyEval_EvalCodeEx+0x874(b2e380, 1, 0, 16127bc, 2, 0)
> ::quit

The C library used by Python is as follows:


sbtorsvr391:~/local/tests $ ldd /usr/local/bin/python3|grep libc
        libc.so.1 =>        /lib/libc.so.1
        /platform/SUNW,Sun-Fire-V490/lib/libc_psr.so.1
 
sbtorsvr391:~ $ ls -l /lib/libc.so.1
-rwxr-xr-x 1 root bin 1640776 Aug 10  2010 /lib/libc.so.1

sbtorsvr391:~ $ pkgchk -l -p /lib/libc.so.1
NOTE: Couldn't lock the package database.
Pathname: /lib/libc.so.1
Type: regular file
Expected mode: 0755
Expected owner: root
Expected group: bin
Expected file size (bytes): 1640776
Expected sum(1) of contents: 50250
Expected last modification: Aug 10 13:55:34 2010
Referenced by the following packages:
        SUNWcslr
Current status: installed

sbtorsvr391:~ $ pkginfo -l SUNWcslr
   PKGINST:  SUNWcslr
      NAME:  Core Solaris Libraries (Root)
  CATEGORY:  system
      ARCH:  sparc
   VERSION:  11.10.0,REV=2005.01.21.15.53
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  core software for a specific instruction-set architecture
    PSTAMP:  on10-patch20100511083333
  INSTDATE:  Jan 22 2011 16:10
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:      245 installed pathnames
                   2 shared pathnames
                   5 directories
                 133 executables
               34303 blocks used (approx)


The same problem doesn't occur when the command is run as root.

I opened a ticket with Oracle support for the libc isse, they responsed with the comment "The python program is passing an invalid address to the third parameter of sprintf. This is not a Solaris issue. Please contact python support."

I'm hoping I will find answer to this issue here...


Thanks in advance,

Alex
msg134833 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-04-30 02:45
Can you try with Python 3.2 (and/or get the dev version of 3.3 from http://hg.python.org/cpython and compile it)?
It would be also useful to know what test exactly causes the segfault and see its code.
Note that this might also be a numpy issue, so it might be useful to report it to the numpy bug tracker too.
msg134848 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-04-30 09:25
The issue is actually in numpy. In numpy/f2py/src/fortranobject.c, function array_from_pyobj(), there is::

        sprintf(mess,"failed to initialize intent(inout|inplace|cache) array"
                " -- input must be array but got %s",
                PyString_AsString(PyObject_Str(PyObject_Type(obj)))
                );

(In numpy headers, PyString_AsString is aliased to PyBytes_AsString.)
Besides the reference leaks, this function will fail when given the unicode string returned by PyObject_Str(), and sprintf receives the null string...
Please report this to numpy.
History
Date User Action Args
2022-04-11 14:57:16adminsetgithub: 56169
2011-04-30 09:25:11amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg134848

resolution: not a bug
2011-04-30 02:45:46ezio.melottisetnosy: + ezio.melotti
messages: + msg134833
2011-04-30 01:16:29alex_laicreate