[egenix-users] Python 2.7.4 generates SIGSEGV when cleaning up mx.URL

M.-A. Lemburg mal at egenix.com
Tue Apr 9 15:32:06 CEST 2013


On 09.04.2013 13:51, Peter Loje wrote:
> On two separate systems (i686 running Debian GNU/Linux 6.0.7 and x86_64
> running Ubuntu 12.04.2 LTS) I'm getting segmentation fault when Python
> 2.7.4 exits after having loaded mx.URL.

Thanks for the report. I can confirm the bug on Python 2.7.4, but
not on Python 2.7.3. Looks like some detail changed between the
two revisions that either causes the segfault or lets a bug in
egenix-mx-base surface for the first time.

We're currently checking all our packages for Python 2.7.4 compatibility.
So far, the Python 2.7 patch level releases have been a rather
bumpy ride. Each patch level release has caused some level of
breakage, either in the packages, the build process or both :-(

> I have compiled Python and mx.URL from sources. The latter using:
> $ md5sum egenix-mx-base-3.2.5.tar.gz
> 2f982afa5ac70691965e9990df138186  egenix-mx-base-3.2.5.tar.gz
> 
> In the file egenix-mx-base-3.2.5/mx/URL/mxURL/mxURL.c the segmentation
> fault is generated in line 2789:
> 
> 2776 void mxURLModule_Cleanup(void)
> ....
> 2789     Py_XDECREF(mxURL_MIMEDict);
> 
> GDB backtrace provided below.
> 
> BTW I wonder why the module reports version 3.2.4?
> $ find egenix-mx-base-3.2.5 -type f | xargs egrep 'MX.*_VERSION "'
> egenix-mx-base-3.2.5/mx/BeeBase/mxBeeBase/mxBeeBase.c:#define
> MXBEEBASE_VERSION "3.2.4"
> egenix-mx-base-3.2.5/mx/DateTime/mxDateTime/mxDateTime.c:#define
> MXDATETIME_VERSION "3.2.4"
> egenix-mx-base-3.2.5/mx/Proxy/mxProxy/mxProxy.c:#define MXPROXY_VERSION
> "3.2.4"
> egenix-mx-base-3.2.5/mx/Queue/mxQueue/mxQueue.c:#define MXQUEUE_VERSION
> "3.2.4"
> egenix-mx-base-3.2.5/mx/Stack/mxStack/mxStack.c:#define MXSTACK_VERSION
> "3.2.4"
> egenix-mx-base-3.2.5/mx/TextTools/mxTextTools/mxTextTools.c:#define
> MXTEXTTOOLS_VERSION "3.2.4"
> egenix-mx-base-3.2.5/mx/Tools/mxTools/mxTools.c:#define MXTOOLS_VERSION
> "3.2.4"
> egenix-mx-base-3.2.5/mx/UID/mxUID/mxUID.c:#define MXUID_VERSION "3.2.4"
> egenix-mx-base-3.2.5/mx/URL/mxURL/mxURL.c:#define MXURL_VERSION "3.2.4"
> 
> Did you forget to bump up the patch version from 4 to 5 when releasing
> mx-base-3.2.5?

Yes :-)

> Best regards
> Peter Loje
> 
> 
> $ gdb /usr/local/bin/python2.7
> GNU gdb (GDB) 7.0.1-debian
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i486-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /usr/local/bin/python2.7...done.
> (gdb) r
> Starting program: /usr/local/bin/python2.7
> [Thread debugging using libthread_db enabled]
> Python 2.7.4 (default, Apr  8 2013, 15:51:19)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import mx.URL
>>>> mx.URL.__version__
> '3.2.4'
>>>> import sys
>>>> sys.exit()
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x08091201 in dict_dealloc (mp=0xb7b2813c) at Objects/dictobject.c:1005
> 1005        Py_TRASHCAN_SAFE_BEGIN(mp)
> (gdb) bt
> #0  0x08091201 in dict_dealloc (mp=0xb7b2813c) at Objects/dictobject.c:1005
> #1  0xb7875928 in mxURLModule_Cleanup () at mx/URL/mxURL/mxURL.c:2789
> #2  0x0810553f in call_ll_exitfuncs () at Python/pythonrun.c:1763
> #3  Py_Finalize () at Python/pythonrun.c:554
> #4  0x08104bac in Py_Exit () at Python/pythonrun.c:1772
> #5  handle_system_exit () at Python/pythonrun.c:1146
> #6  0x0810517d in PyErr_PrintEx (set_sys_last_vars=<value optimized out>)
> at Python/pythonrun.c:1156
> #7  0x081058dd in PyRun_InteractiveOneFlags (fp=0xb7f8b420,
> filename=0x815f9c0 "<stdin>", flags=0xbffffc4c) at Python/pythonrun.c:855
> #8  0x08105a68 in PyRun_InteractiveLoopFlags (fp=0xb7f8b420,
> filename=0x815f9c0 "<stdin>", flags=0xbffffc4c) at Python/pythonrun.c:772
> #9  0x081062f2 in PyRun_AnyFileExFlags (fp=0xb7f8b420, filename=0x815f9c0
> "<stdin>", closeit=0, flags=0xbffffc4c) at Python/pythonrun.c:741
> #10 0x0805bb59 in Py_Main (argc=1, argv=0xbffffd34) at Modules/main.c:640
> #11 0x0805abeb in main (argc=1, argv=0xbffffd34) at ./Modules/python.c:23
> (gdb)

Looks like this has to do with the dictionary cleanup in the
interpreter's finalization phase. It's possible that cleaning up
dictionaries with exit functions is no longer safe with Python 2.7.4.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Apr 09 2013)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2013-04-09: Released mxODBC.Connect 2.0.3 ...     http://egenix.com/go42
2013-04-02: Released mxODBC Zope DA 2.1.1 ...     http://egenix.com/go41
2013-04-10: Python Meeting Duesseldorf ...                      tomorrow

   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
               http://www.egenix.com/company/contact/



More information about the egenix-users mailing list