Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

python module segment fault when import #1016

Closed
caron-lee opened this issue Dec 22, 2015 · 6 comments
Closed

python module segment fault when import #1016

caron-lee opened this issue Dec 22, 2015 · 6 comments

Comments

@caron-lee
Copy link

import mxnet
*** glibc detected *** python2.7: free(): invalid pointer: 0x00007fcf34b68880 ***
======= Backtrace: =========
/lib64/libc.so.6[0x39e4675f4e]
/lib64/libc.so.6[0x39e4678cad]
/usr/local/lib/python2.7/site-packages/cv2.so(+0x126fe7)[0x7fcf2aa95fe7]
/usr/local/lib/python2.7/site-packages/cv2.so(initcv2+0x23fa)[0x7fcf2ab2179a]
python2.7(_PyImport_LoadDynamicModule+0xc5)[0x4b56d5]
python2.7[0x4b3d51]
python2.7[0x4b3fc4]
python2.7(PyImport_ImportModuleLevel+0x1f0)[0x4b45f0]
python2.7[0x49693f]
python2.7(PyObject_Call+0x53)[0x41abc3]
python2.7(PyEval_CallObjectWithKeywords+0x43)[0x496e23]
python2.7(PyEval_EvalFrameEx+0x35e6)[0x49b326]
python2.7(PyEval_EvalCodeEx+0x88e)[0x49f1ee]
python2.7(PyEval_EvalCode+0x32)[0x49f302]
python2.7(PyImport_ExecCodeModuleEx+0xc2)[0x4b0862]
python2.7[0x4b2f9e]
python2.7[0x4b3d51]
python2.7[0x4b428c]
python2.7(PyImport_ImportModuleLevel+0x32c)[0x4b472c]
python2.7[0x49693f]
python2.7(PyObject_Call+0x53)[0x41abc3]
python2.7(PyEval_CallObjectWithKeywords+0x43)[0x496e23]
python2.7(PyEval_EvalFrameEx+0x35e6)[0x49b326]
python2.7(PyEval_EvalCodeEx+0x88e)[0x49f1ee]
python2.7(PyEval_EvalCode+0x32)[0x49f302]
python2.7(PyImport_ExecCodeModuleEx+0xc2)[0x4b0862]
python2.7[0x4b2f9e]
python2.7[0x4b37fa]
python2.7[0x4b3d51]
python2.7[0x4b3fc4]
python2.7(PyImport_ImportModuleLevel+0x1f0)[0x4b45f0]
python2.7[0x49693f]
python2.7(PyObject_Call+0x53)[0x41abc3]
python2.7(PyEval_CallObjectWithKeywords+0x43)[0x496e23]
python2.7(PyEval_EvalFrameEx+0x35e6)[0x49b326]
python2.7(PyEval_EvalCodeEx+0x88e)[0x49f1ee]
python2.7(PyEval_EvalCode+0x32)[0x49f302]
python2.7(PyRun_InteractiveOneFlags+0x195)[0x4bea55]
python2.7(PyRun_InteractiveLoopFlags+0x4e)[0x4bec6e]
python2.7(PyRun_AnyFileExFlags+0x4c)[0x4bf3ac]
python2.7(Py_Main+0xc74)[0x416474]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x39e461ed5d]
python2.7[0x4153e9]
======= Memory map: ========
00400000-00566000 r-xp 00000000 08:02 1720681 /usr/local/bin/python2.7
00766000-007a3000 rw-p 00166000 08:02 1720681 /usr/local/bin/python2.7
007a3000-007b2000 rw-p 00000000 00:00 0
010ed000-01610000 rw-p 00000000 00:00 0 [heap]
371bc00000-371bc3f000 r-xp 00000000 08:02 1723269 /usr/lib64/libjpeg.so.62
371bc3f000-371be3f000 ---p 0003f000 08:02 1723269 /usr/lib64/libjpeg.so.62
371be3f000-371be40000 rw-p 0003f000 08:02 1723269 /usr/lib64/libjpeg.so.62
371be40000-371be50000 rw-p 00000000 00:00 0
371c000000-371c1b9000 r-xp 00000000 08:02 1715861 /usr/lib64/libcrypto.so.10
371c1b9000-371c3b8000 ---p 001b9000 08:02 1715861 /usr/lib64/libcrypto.so.10
371c3b8000-371c3d3000 r--p 001b8000 08:02 1715861 /usr/lib64/libcrypto.so.10
371c3d3000-371c3df000 rw-p 001d3000 08:02 1715861 /usr/lib64/libcrypto.so.10
371c3df000-371c3e3000 rw-p 00000000 00:00 0
371d400000-371d425000 r-xp 00000000 08:02 1705511 /usr/lib64/libpng12.so.0
371d425000-371d625000 ---p 00025000 08:02 1705511 /usr/lib64/libpng12.so.0
371d625000-371d626000 rw-p 00025000 08:02 1705511 /usr/lib64/libpng12.so.0
371f000000-371f062000 r-xp 00000000 08:02 1738097 /usr/lib64/libssl.so.10
371f062000-371f261000 ---p 00062000 08:02 1738097 /usr/lib64/libssl.so.10
371f261000-371f265000 r--p 00061000 08:02 1738097 /usr/lib64/libssl.so.10
371f265000-371f26c000 rw-p 00065000 08:02 1738097 /usr/lib64/libssl.so.10
39e4200000-39e4220000 r-xp 00000000 08:02 1441820 /lib64/ld-2.12.so
39e441f000-39e4420000 r--p 0001f000 08:02 1441820 /lib64/ld-2.12.so
39e4420000-39e4421000 rw-p 00020000 08:02 1441820 /lib64/ld-2.12.so
39e4421000-39e4422000 rw-p 00000000 00:00 0
39e4600000-39e478a000 r-xp 00000000 08:02 1441822 /lib64/libc-2.12.so
39e478a000-39e498a000 ---p 0018a000 08:02 1441822 /lib64/libc-2.12.so
39e498a000-39e498e000 r--p 0018a000 08:02 1441822 /lib64/libc-2.12.so
39e498e000-39e498f000 rw-p 0018e000 08:02 1441822 /lib64/libc-2.12.so
39e498f000-39e4994000 rw-p 00000000 00:00 0
39e4a00000-39e4a17000 r-xp 00000000 08:02 1441862 /lib64/libpthread-2.12.so
39e4a17000-39e4c17000 ---p 00017000 08:02 1441862 /lib64/libpthread-2.12.so
39e4c17000-39e4c18000 r--p 00017000 08:02 1441862 /lib64/libpthread-2.12.so
39e4c18000-39e4c19000 rw-p 00018000 08:02 1441862 /lib64/libpthread-2.12.so
39e4c19000-39e4c1d000 rw-p 00000000 00:00 0
39e4e00000-39e4e02000 r-xp 00000000 08:02 1441896 /lib64/libdl-2.12.so
39e4e02000-39e5002000 ---p 00002000 08:02 1441896 /lib64/libdl-2.12.so
39e5002000-39e5003000 r--p 00002000 08:02 1441896 /lib64/libdl-2.12.so
39e5003000-39e5004000 rw-p 00003000 08:02 1441896 /lib64/libdl-2.12.so
39e5200000-39e5202000 r-xp 00000000 08:02 1442149 /lib64/libutil-2.12.so
39e5202000-39e5401000 ---p 00002000 08:02 1442149 /lib64/libutil-2.12.so
39e5401000-39e5402000 r--p 00001000 08:02 1442149 /lib64/libutil-2.12.so
39e5402000-39e5403000 rw-p 00002000 08:02 1442149 /lib64/libutil-2.12.so
39e5600000-39e5615000 r-xp 00000000 08:02 1442264 /lib64/libz.so.1.2.3
39e5615000-39e5814000 ---p 00015000 08:02 1442264 /lib64/libz.so.1.2.3
39e5814000-39e5815000 r--p 00014000 08:02 1442264 /lib64/libz.so.1.2.3
39e5815000-39e5816000 rw-p 00015000 08:02 1442264 /lib64/libz.so.1.2.3
39e5a00000-39e5a83000 r-xp 00000000 08:02 1442270 /lib64/libm-2.12.so
39e5a83000-39e5c82000 ---p 00083000 08:02 1442270 /lib64/libm-2.12.so
39e5c82000-39e5c83000 r--p 00082000 08:02 1442270 /lib64/libm-2.12.so
39e5c83000-39e5c84000 rw-p 00083000 08:02 1442270 /lib64/libm-2.12.so
39e5e00000-39e5e22000 r-xp 00000000 08:02 1441845 /lib64/libncurses.so.5.7
39e5e22000-39e6021000 ---p 00022000 08:02 1441845 /lib64/libncurses.so.5.7
39e6021000-39e6022000 rw-p 00021000 08:02 1441845 /lib64/libncurses.so.5.7
39e6200000-39e621d000 r-xp 00000000 08:02 1441883 /lib64/libtinfo.so.5.7
39e621d000-39e641c000 ---p 0001d000 08:02 1441883 /lib64/libtinfo.so.5.7
39e641c000-39e6420000 rw-p 0001c000 08:02 1441883 /lib64/libtinfo.so.5.7
39e6420000-39e6421000 rw-p 00000000 00:00 0
39e7a00000-39e7a16000 r-xp 00000000 08:02 1441916 /lib64/libresolv-2.12.so
39e7a16000-39e7c16000 ---p 00016000 08:02 1441916 /lib64/libresolv-2.12.so
39e7c16000-39e7c17000 r--p 00016000 08:02 1441916 /lib64/libresolv-2.12.so
39e7c17000-39e7c18000 rw-p 00017000 08:02 1441916 /lib64/libresolv-2.12.so
39e7c18000-39e7c1a000 rw-p 00000000 00:00 0
39eaa00000-39eaa03000 r-xp 00000000 08:02 1442025 /lib64/libcom_err.so.2.1
39eaa03000-39eac02000 ---p 00003000 08:02 1442025 /lib64/libcom_err.so.2.1
39eac02000-39eac03000 r--p 00002000 08:02 1442025 /lib64/libcom_err.so.2.1
39eac03000-39eac04000 rw-p 00003000 08:02 1442025 /lib64/libcom_err.so.2.1
39eca00000-39ecadb000 r-xp 00000000 08:02 1442155 /lib64/libkrb5.so.3.3Aborted (core dumped)

@caron-lee
Copy link
Author

opencv 2.4.11 and opencv 3.0 both tried, but failed.

@caron-lee
Copy link
Author

gdb python2.7 core.xxxx , bt information:
0 0x00000039e4632625 in raise () from /lib64/libc.so.6
#1 0x00000039e4633e05 in abort () from /lib64/libc.so.6
#2 0x00000039e4670537 in libc_message () from /lib64/libc.so.6
#3 0x00000039e4675f4e in malloc_printerr () from /lib64/libc.so.6
#4 0x00000039e4678cad in int_free () from /lib64/libc.so.6
#5 0x00007fc57bf7efe7 in init_submodule(object, char const
, PyMethodDef_, ConstDef_) () from /usr/local/lib/python2.7/site-packages/cv2.so
#6 0x00007fc57c00a79a in initcv2 () from /usr/local/lib/python2.7/site-packages/cv2.so
#7 0x00000000004b56d5 in _PyImport_LoadDynamicModule (name=0x1090340 "cv2", pathname=0x1091350 "/usr/local/lib/python2.7/site-packages/cv2.so", fp=) at ./Python/importdl.c:53
#8 0x00000000004b3d51 in import_submodule (mod=0x773bb0, subname=0x1090340 "cv2", fullname=0x1090340 "cv2") at Python/import.c:2700
#9 0x00000000004b3fc4 in load_next (mod=0x773bb0, altmod=0x773bb0, p_name=, buf=0x1090340 "cv2", p_buflen=0x7fff5a85f110) at Python/import.c:2515
#10 0x00000000004b45f0 in import_module_level (name=, globals=, locals=, fromlist=0x773bb0, level=) at Python/import.c:2224
#11 PyImport_ImportModuleLevel (name=, globals=, locals=, fromlist=0x773bb0, level=) at Python/import.c:2288
#12 0x000000000049693f in builtin___import
(self=, args=, kwds=) at Python/bltinmodule.c:49
#13 0x000000000041abc3 in PyObject_Call (func=0x7fc590533050, arg=, kw=) at Objects/abstract.c:2529
#14 0x0000000000496e23 in PyEval_CallObjectWithKeywords (func=0x7fc590533050, arg=0x7fc57cfd18f0, kw=) at Python/ceval.c:3902
#15 0x000000000049b326 in PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2346
#16 0x000000000049f1ee in PyEval_EvalCodeEx (co=0x7fc57cf71d30, globals=, locals=, args=, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3265
#17 0x000000000049f302 in PyEval_EvalCode (co=, globals=, locals=) at Python/ceval.c:673
#18 0x00000000004b0862 in PyImport_ExecCodeModuleEx (name=0xcbc8f0 "mxnet.recordio", co=0x7fc57cf71d30, pathname=0x108d960 "/usr/local/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/recordio.pyc") at Python/import.c:709
#19 0x00000000004b2f9e in load_source_module (name=0xcbc8f0 "mxnet.recordio", pathname=0x108d960 "/usr/local/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/recordio.pyc", fp=) at Python/import.c:1099
#20 0x00000000004b3d51 in import_submodule (mod=0x7fc590403b08, subname=0x7fc590404ad4 "recordio", fullname=0xcbc8f0 "mxnet.recordio") at Python/import.c:2700
#21 0x00000000004b428c in ensure_fromlist (mod=0x7fc590403b08, fromlist=0x7fc5903ff950, buf=0xcbc8f0 "mxnet.recordio", buflen=5, recursive=0) at Python/import.c:2606
#22 0x00000000004b472c in import_module_level (name=, globals=, locals=, fromlist=0x7fc5903ff950, level=) at Python/import.c:2269
#23 PyImport_ImportModuleLevel (name=, globals=, locals=, fromlist=0x7fc5903ff950, level=) at Python/import.c:2288
#24 0x000000000049693f in builtin___import__ (self=, args=, kwds=) at Python/bltinmodule.c:49
#25 0x000000000041abc3 in PyObject_Call (func=0x7fc590533050, arg=, kw=) at Objects/abstract.c:2529
#26 0x0000000000496e23 in PyEval_CallObjectWithKeywords (func=0x7fc590533050, arg=0x7fc5904d6170, kw=) at Python/ceval.c:3902
#27 0x000000000049b326 in PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2346
#28 0x000000000049f1ee in PyEval_EvalCodeEx (co=0x7fc5903e5f30, globals=, locals=, args=, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3265
#29 0x000000000049f302 in PyEval_EvalCode (co=, globals=, locals=) at Python/ceval.c:673
#30 0x00000000004b0862 in PyImport_ExecCodeModuleEx (name=0xcb88b0 "mxnet", co=0x7fc5903e5f30, pathname=0xcbb8e0 "/usr/local/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/init.pyc") at Python/import.c:709
#31 0x00000000004b2f9e in load_source_module (name=0xcb88b0 "mxnet", pathname=0xcbb8e0 "/usr/local/lib/python2.7/site-packages/mxnet-0.5.0-py2.7.egg/mxnet/init.pyc", fp=) at Python/import.c:1099
#32 0x00000000004b37fa in load_package (name=0xcb88b0 "mxnet", pathname=) at Python/import.c:1166
#33 0x00000000004b3d51 in import_submodule (mod=0x773bb0, subname=0xcb88b0 "mxnet", fullname=0xcb88b0 "mxnet") at Python/import.c:2700
#34 0x00000000004b3fc4 in load_next (mod=0x773bb0, altmod=0x773bb0, p_name=, buf=0xcb88b0 "mxnet", p_buflen=0x7fff5a85fc70) at Python/import.c:2515
#35 0x00000000004b45f0 in import_module_level (name=, globals=, locals=, fromlist=0x773bb0, level=) at Python/import.c:2224
#36 PyImport_ImportModuleLevel (name=, globals=, locals=, fromlist=0x773bb0, level=) at Python/import.c:2288
#37 0x000000000049693f in builtin___import__ (self=, args=, kwds=) at Python/bltinmodule.c:49
#38 0x000000000041abc3 in PyObject_Call (func=0x7fc590533050, arg=, kw=) at Objects/abstract.c:2529
#39 0x0000000000496e23 in PyEval_CallObjectWithKeywords (func=0x7fc590533050, arg=0x7fc59041b998, kw=) at Python/ceval.c:3902
#40 0x000000000049b326 in PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2346
#41 0x000000000049f1ee in PyEval_EvalCodeEx (co=0x7fc5903e5db0, globals=, locals=, args=, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3265
#42 0x000000000049f302 in PyEval_EvalCode (co=, globals=, locals=) at Python/ceval.c:673
#43 0x00000000004bea55 in run_mod (fp=, filename=0x51b824 "", flags=0x7fff5a860170) at Python/pythonrun.c:1377
#44 PyRun_InteractiveOneFlags (fp=, filename=0x51b824 "", flags=0x7fff5a860170) at Python/pythonrun.c:864
#45 0x00000000004bec6e in PyRun_InteractiveLoopFlags (fp=0x39e498e6c0, filename=0x51b824 "", flags=0x7fff5a860170) at Python/pythonrun.c:784
#46 0x00000000004bf3ac in PyRun_AnyFileExFlags (fp=0x39e498e6c0, filename=0x51b824 "", closeit=0, flags=0x7fff5a860170) at Python/pythonrun.c:753
#47 0x0000000000416474 in Py_Main (argc=, argv=) at Modules/main.c:640
#48 0x00000039e461ed5d in __libc_start_main () from /lib64/libc.so.6
#49 0x00000000004153e9 in _start ()

@caron-lee
Copy link
Author

$ python2.7
Python 2.7.8 (default, Nov 14 2015, 21:59:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import cv2

import opencv alone is ok.

@caron-lee
Copy link
Author

$ python2.7
Python 2.7.8 (default, Nov 14 2015, 21:59:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import cv2
import mxnet

import opencv first is ok. The order matters.

@piiswrong
Copy link
Contributor

Both order works for me. Could you update to newest mxnet and rebuild?

@caron-lee
Copy link
Author

I fixed the problem. I changed compile option of OpenCV from BUILD_SHARED_LIBS=OFF to BUILD_SHARED_LIBS=ON. that's all.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants