I am currently facing a problem while testing a Boost Python Module. It's a basic wrapper of a C++ class, I can use it in Python without any problems (instance, access to its attributes, etc) but when I quit the Python environment, I got a "Segmentation fault". Here's what gdb tells about the error :
Program received signal SIGSEGV, Segmentation fault.
malloc_consolidate (av=av@entry=0x7ffff7bb5760 <main_arena>) at malloc.c:4151
4151 malloc.c: No such file or directory.
I am using Boost 1.55.0, with python 3.4.
Do you guys have any idea about this type of issue ?
EDIT :
Here is the backtrace from gdb :
#0 malloc_consolidate (av=av@entry=0x7ffff7bb5760 <main_arena>) at malloc.c:4151
#1 0x00007ffff787656d in _int_free (av=0x7ffff7bb5760 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:4057
#2 0x00007ffff0bfc1b5 in Poco::MemoryPool::~MemoryPool() () from /usr/local/share/EikeoTools/libs/poco/lib/libPocoFoundation.so.16
#3 0x00007ffff7833259 in __run_exit_handlers (status=0, listp=0x7ffff7bb56c8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#4 0x00007ffff78332a5 in __GI_exit (status=<optimized out>) at exit.c:104
#5 0x00007ffff7818ecc in __libc_start_main (main=0x47dae0 <main>, argc=3, argv=0x7fffffffe458, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe448) at libc-start.c:321
#6 0x0000000000576225 in _start ()
I can't show the code, but according to the backtrace, there is a segfault because of a poco module.(See #2). The thing is that I don't even use this library on the current project, it is just a part of a framework I need to use in my project. So, maybe it's a link problem when compiling the project ?
EDIT 2 :
Here's what Valgrind gives me when I try to import my library :
File "***********************/Test.py", line 4, in <module>
==12275== Invalid read of size 4
==12275== at 0x55BF21: PyObject_Free (in /usr/bin/python3.4)
==12275== by 0x52EF09: _PyUnicodeWriter_PrepareInternal (in /usr/bin/python3.4)
==12275== by 0x52F00E: ??? (in /usr/bin/python3.4)
==12275== by 0x54FBF1: PyUnicode_DecodeUTF8Stateful (in /usr/bin/python3.4)
==12275== by 0x4AB3B9: ??? (in /usr/bin/python3.4)
==12275== by 0x518544: PyEval_EvalFrameEx (in /usr/bin/python3.4)
==12275== by 0x4879BE: ??? (in /usr/bin/python3.4)
==12275== by 0x4C05AC: ??? (in /usr/bin/python3.4)
==12275== by 0x4C4DC5: PyObject_CallMethodObjArgs (in /usr/bin/python3.4)
==12275== by 0x4CB345: _PyIncrementalNewlineDecoder_decode (in /usr/bin/python3.4)
==12275== by 0x597A4B: ??? (in /usr/bin/python3.4)
==12275== by 0x4A89CE: ??? (in /usr/bin/python3.4)
==12275== Address 0x663d020 is 8,032 bytes inside a block of size 8,225 free'd
==12275== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12275== by 0x558CE1: _PyBytes_Resize (in /usr/bin/python3.4)
==12275== by 0x57D651: ??? (in /usr/bin/python3.4)
==12275== by 0x4C4DC5: PyObject_CallMethodObjArgs (in /usr/bin/python3.4)
==12275== by 0x5979EA: ??? (in /usr/bin/python3.4)
==12275== by 0x4A89CE: ??? (in /usr/bin/python3.4)
==12275== by 0x493C8F: ??? (in /usr/bin/python3.4)
==12275== by 0x4EBD09: PyObject_Call (in /usr/bin/python3.4)
==12275== by 0x552694: _Py_DisplaySourceLine (in /usr/bin/python3.4)
==12275== by 0x475586: PyTraceBack_Print (in /usr/bin/python3.4)
==12275== by 0x448414: ??? (in /usr/bin/python3.4)
==12275== by 0x43A859: PyErr_Display (in /usr/bin/python3.4)