M.-A. Lemburg wrote:
On 2009-02-06 12:18, Aaron Staley wrote:
Recently (I suspect after I upgraded to Ubuntu Intrepid), python has been segfaulting whenever it exits AND my Cpp extension has been importing.
The exact error (from valgrind is):
==11326== Process terminating with default action of signal 11 (SIGSEGV) ==11326== Access not within mapped region at address 0x40 ==11326== at 0x5BAF974: (within /lib/libselinux.so.1) ==11326== by 0x5BA8B8D: (within /lib/libselinux.so.1) ==11326== by 0x5BA11D7: (within /lib/libselinux.so.1) ==11326== by 0x5BB134F: (within /lib/libselinux.so.1) ==11326== by 0x400E152: (within /lib/ld-2.8.90.so) ==11326== by 0x40B6D68: exit (in /lib/tls/i686/cmov/libc-2.8.90.so) ==11326== by 0x80ED204: handle_system_exit (pythonrun.c:1620) ==11326== by 0x80ED3FC: PyErr_PrintEx (pythonrun.c:1064) ==11326== by 0x80ED661: PyErr_Print (pythonrun.c:978) ==11326== by 0x80EDC87: PyRun_InteractiveOneFlags (pythonrun.c:795) ==11326== by 0x80EDDB7: PyRun_InteractiveLoopFlags (pythonrun.c:723) ==11326== by 0x80EE515: PyRun_AnyFileExFlags (pythonrun.c:692)
Has anyone seen this before? This is not a showstopper for me, but it is a bit annoying.
This typically happens in case of a refcount bug in your extension. Python finalizes all modules before exiting and during the course of this, clears all module dictionaries.
It's also possible that the cleanup process triggers an exception which cannot be handled properly anymore during exit due to a half-gone Python interpreter system.
Thanks for the tips.
I actually forgot to mention that just importing the extension will trigger the crashing behavior when I exit; I do not even need to call module functions. Correct me if I'm wrong, but it doesn't seem that a module import should be affecting any reference counts.
I should note that my module is linking to shared libraries (namely opencv) when linked; has this been known to have issues?