[capi-sig] Python segfaulting on exit

M.-A. Lemburg mal at egenix.com
Fri Feb 6 13:00:46 CET 2009

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.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Feb 06 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the capi-sig mailing list