[Numpy-tickets] [NumPy] #551: numpy.ndarray messed up after unpickling

NumPy numpy-tickets@scipy....
Fri Feb 8 15:03:48 CST 2008


#551: numpy.ndarray messed up after unpickling
---------------------------------------+------------------------------------
 Reporter:  cotackst                   |        Owner:  somebody
     Type:  defect                     |       Status:  new     
 Priority:  normal                     |    Milestone:  1.0.5   
Component:  numpy.core                 |      Version:  1.0.1   
 Severity:  normal                     |   Resolution:          
 Keywords:  pickle, ndarray, segfault  |  
---------------------------------------+------------------------------------
Comment (by bolme):

 I was able to reproduce this problem in MacOS X Leopard and Ubuntu 7.04.
 I ran valgrind under Ubuntu.  Valgrind suggests the error may be caused by
 uninitialized values.

 Test code...
 {{{
 import pickle
 from numpy import array,dot,ones

 # Create the arrays
 a = ones((47,128*128))
 b = ones((128*128,2))
 c = ones((128*128,1))

 # Test dot
 print "Computing dot product on original arrays..."
 print dot(a,b).shape # WORKS
 print dot(a,c).shape # WORKS

 print "Pickle and unpickel the array with workaround."
 buffer = pickle.dumps(a)
 a = array(pickle.loads(buffer))

 # Test dot
 print "Computing dot product with workaround..."
 print dot(a,b).shape # WORKS
 print dot(a,c).shape # WORKS

 print "Pickle and unpickel the array without workaround."
 a = pickle.loads(buffer)

 # Test dot
 print "Computing dot product without workaround..."
 print dot(a,b).shape # WORKS
 print dot(a,c).shape # CRASH
 }}}


 Valgrind output:

 {{{
 Computing dot product on original arrays...
 ==13157==
 ==13157== Conditional jump or move depends on uninitialised value(s)
 ==13157==    at 0x48FCA42: ATL_dmmK (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== Use of uninitialised value of size 4
 ==13157==    at 0x48794C0: ATL_dgecopy (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== Use of uninitialised value of size 4
 ==13157==    at 0x48794CE: ATL_dgecopy (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== Use of uninitialised value of size 4
 ==13157==    at 0x4879531: ATL_dgecopy (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== Conditional jump or move depends on uninitialised value(s)
 ==13157==    at 0x48FCBAF: ATL_dmmK (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 (47, 2)
 (47, 1)
 Pickle and unpickel the array with workaround.
 Computing dot product with workaround...
 (47, 2)
 (47, 1)
 Pickle and unpickel the array without workaround.
 Computing dot product without workaround...
 (47, 2)
 (47, 1)
 ==13157==
 ==13157== ERROR SUMMARY: 41065 errors from 10 contexts (suppressed: 2174
 from 4)
 ==13157==
 ==13157== 1 errors in context 1 of 10:
 ==13157== Invalid read of size 4
 ==13157==    at 0x4014759: (within /lib/ld-2.5.so)
 ==13157==    by 0x4005B69: (within /lib/ld-2.5.so)
 ==13157==    by 0x4007995: (within /lib/ld-2.5.so)
 ==13157==    by 0x400B836: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x400BA2A: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010DF4: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==  Address 0x46AD6BC is 36 bytes inside a block of size 38 alloc'd
 ==13157==    at 0x4021620: malloc (vg_replace_malloc.c:149)
 ==13157==    by 0x4007F33: (within /lib/ld-2.5.so)
 ==13157==    by 0x400B836: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x400BA2A: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010DF4: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==
 ==13157== 3 errors in context 2 of 10:
 ==13157== Conditional jump or move depends on uninitialised value(s)
 ==13157==    at 0x48FCBAF: ATL_dmmK (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== 3 errors in context 3 of 10:
 ==13157== Invalid read of size 4
 ==13157==    at 0x4014743: (within /lib/ld-2.5.so)
 ==13157==    by 0x4005B69: (within /lib/ld-2.5.so)
 ==13157==    by 0x4007995: (within /lib/ld-2.5.so)
 ==13157==    by 0x400B836: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x400BA2A: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010DF4: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==  Address 0x45AE548 is 16 bytes inside a block of size 19 alloc'd
 ==13157==    at 0x4021620: malloc (vg_replace_malloc.c:149)
 ==13157==    by 0x4007F33: (within /lib/ld-2.5.so)
 ==13157==    by 0x400B836: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x400BA2A: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010DF4: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==
 ==13157== 3 errors in context 4 of 10:
 ==13157== Invalid read of size 4
 ==13157==    at 0x4014743: (within /lib/ld-2.5.so)
 ==13157==    by 0x4005B69: (within /lib/ld-2.5.so)
 ==13157==    by 0x4007995: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010D94: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x40FCB76: _PyImport_GetDynLoadFunc (dynload_shlib.c:130)
 ==13157==    by 0x40EAB17: _PyImport_LoadDynamicModule (importdl.c:42)
 ==13157==  Address 0x4629440 is 64 bytes inside a block of size 66 alloc'd
 ==13157==    at 0x4021620: malloc (vg_replace_malloc.c:149)
 ==13157==    by 0x4006EB4: (within /lib/ld-2.5.so)
 ==13157==    by 0x40078D9: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010D94: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x40FCB76: _PyImport_GetDynLoadFunc (dynload_shlib.c:130)
 ==13157==    by 0x40EAB17: _PyImport_LoadDynamicModule (importdl.c:42)
 ==13157==
 ==13157== 4 errors in context 5 of 10:
 ==13157== Invalid read of size 4
 ==13157==    at 0x4014770: (within /lib/ld-2.5.so)
 ==13157==    by 0x4005B69: (within /lib/ld-2.5.so)
 ==13157==    by 0x4007995: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010D94: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x40FCB76: _PyImport_GetDynLoadFunc (dynload_shlib.c:130)
 ==13157==    by 0x40EAB17: _PyImport_LoadDynamicModule (importdl.c:42)
 ==13157==  Address 0x44F65E0 is 56 bytes inside a block of size 57 alloc'd
 ==13157==    at 0x4021620: malloc (vg_replace_malloc.c:149)
 ==13157==    by 0x4006EB4: (within /lib/ld-2.5.so)
 ==13157==    by 0x40078D9: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010D94: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x40FCB76: _PyImport_GetDynLoadFunc (dynload_shlib.c:130)
 ==13157==    by 0x40EAB17: _PyImport_LoadDynamicModule (importdl.c:42)
 ==13157==
 ==13157== 14 errors in context 6 of 10:
 ==13157== Invalid read of size 4
 ==13157==    at 0x4014759: (within /lib/ld-2.5.so)
 ==13157==    by 0x4005B69: (within /lib/ld-2.5.so)
 ==13157==    by 0x4007995: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010D94: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x40FCB76: _PyImport_GetDynLoadFunc (dynload_shlib.c:130)
 ==13157==    by 0x40EAB17: _PyImport_LoadDynamicModule (importdl.c:42)
 ==13157==  Address 0x44A602C is 52 bytes inside a block of size 55 alloc'd
 ==13157==    at 0x4021620: malloc (vg_replace_malloc.c:149)
 ==13157==    by 0x4006EB4: (within /lib/ld-2.5.so)
 ==13157==    by 0x40078D9: (within /lib/ld-2.5.so)
 ==13157==    by 0x4010D94: (within /lib/ld-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x40108ED: (within /lib/ld-2.5.so)
 ==13157==    by 0x4189C2C: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x400CFA5: (within /lib/ld-2.5.so)
 ==13157==    by 0x418A2AB: (within /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x4189B63: dlopen (in /lib/tls/i686/cmov/libdl-2.5.so)
 ==13157==    by 0x40FCB76: _PyImport_GetDynLoadFunc (dynload_shlib.c:130)
 ==13157==    by 0x40EAB17: _PyImport_LoadDynamicModule (importdl.c:42)
 ==13157==
 ==13157== 852 errors in context 7 of 10:
 ==13157== Conditional jump or move depends on uninitialised value(s)
 ==13157==    at 0x48FCA42: ATL_dmmK (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== 855 errors in context 8 of 10:
 ==13157== Use of uninitialised value of size 4
 ==13157==    at 0x4879531: ATL_dgecopy (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== 19665 errors in context 9 of 10:
 ==13157== Use of uninitialised value of size 4
 ==13157==    at 0x48794CE: ATL_dgecopy (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)
 ==13157==
 ==13157== 19665 errors in context 10 of 10:
 ==13157== Use of uninitialised value of size 4
 ==13157==    at 0x48794C0: ATL_dgecopy (in /home/bolme/tools/lib/python2.6
 /site-packages/numpy/core/_dotblas.so)

 }}}

 The errors with ATL_dmmK and ATL_dgecopy only seem to occure with the line
 that typically causes the segfault.

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/551#comment:11>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list