[egenix-users] seg fault on import mx.DateTime Python2.3.3 egenix-base-2.0.5

M.-A. Lemburg mal at egenix.com
Wed Feb 11 18:45:19 CET 2004


Jacob Smullyan wrote:
> Hello --
> 
> To provide some more (circumstantial) evidence that there is a real
> bug associated with MXDATETIME_FREELIST:
> 
> For some time I've been trying to figure out why skunkweb dumps core
> on Python 2.3.x on Linux x86 (about one in a thousand requests in
> typical use). The core files showed an attempt to free an invalid
> pointer, but I could find the smoking gun that tied it to any
> particular module.  (Alas, I don't know enough to debug this very
> well.)  By process of elimination, however, I think I've found that
> the culprit was mx.DateTime (in either 2.0.5 or 2.1.0 incarnations);
> after rewriting skunkweb so it could run without it, the segfault went
> away.  Furthermore, the tests I am running right now suggest that
> undefing MXDATETIME_FREELIST seems to solve the problem.  I'll perform
> more testing and report back if this is a red herring, but at this
> point that would be statistically unlikely.
> 
> Incidentally, I've tested with different compilers (gcc 2.95.3,
> 3.2.3), different 2.3 releases, different configure and CFLAGS, etc.,
> and the bug is reproducible across the board.  

Hmm, I've just tried egenix-mx-base 2.0.5, Python 2.3.3, all
compiled with gcc 3.3 -O3 and don't see any problems (apart from
a few deprecation warnings in the test script).

The fact that compiling the package with -O0 suggests that
something is wrong with the way the optimizer works on your
machines which is unfortunately not uncommon with gcc these days.

> I can provide core files, backtraces, etc., upon request.
> 
> Cheers,
> 
> Jacob Smullyan
> 
> On Fri, Feb 06, 2004 at 04:16:58PM -0800, Ross Brattain wrote:
> 
>>"M.-A. Lemburg" <mal at egenix.com> writes:
>>
>>
>>>Are you using a Python version that's compiled with debug
>>>mode enabled (or have you used such a Python version to
>>>compile mxDateTime) ?
>>>
>>
>>No, just vanilla ./configure.
>>
>>I rebuilt Python 2.2.3 / egenix-base-2.0.4 and had the same problem.
>>
>>Because of this line from the backtrace:
>>#0  mxDateTime_FromDateAndTime (year=1, month=1, day=1, hour=1, minute=1, second=0) at mx/DateTime/mxDateTime/mxDateTime.c:333
>>
>>mxDateTime.c:333 :
>>
>>#ifdef MXDATETIME_FREELIST
>>    if (mxDateTime_FreeList) {
>>	datetime = mxDateTime_FreeList;
>>	mxDateTime_FreeList = *(mxDateTimeObject **)mxDateTime_FreeList;
>>	datetime->ob_type = &mxDateTime_Type;
>>->	_Py_NewReference(datetime);
>>    }
>>    else
>>#endif 
>>	 {
>>	datetime = PyObject_NEW(mxDateTimeObject,&mxDateTime_Type);
>>	if (datetime == NULL)
>>	    return NULL;
>>    }
>>
>>I undefed MXDATETIME_FREELIST and rebuilt and everything seems fine.
>>
>>--- egenix-mx-base-2.0.5/mx/DateTime/mxDateTime/mxDateTime.c    2001-12-10 02:15:49.000000000 -0800
>>+++ egenix-mx-base-2.0.5-mod/mx/DateTime/mxDateTime/mxDateTime.c        2004-02-05 22:54:07.000000000 -0800
>>@@ -76,7 +76,7 @@
>> #define STRFTIME_OUTPUT_SIZE   1024
>> 
>> /* Define these to have the module use free lists (saves malloc calls) */
>>-#define MXDATETIME_FREELIST
>>+#undef MXDATETIME_FREELIST
>> #define MXDATETIMEDELTA_FREELIST
>> 
>> /* Define this to enable the copy-protocol (__copy__, __deepcopy__) */
>>
>>
>>This is not the root cause because, as mentioned, a rebuild of 
>>Python 2.2.3 / egenix-base-2.0.4 on this machine exhibited the same
>>problem.
>>
>>My working production environment (different machine) is:
>>Python 2.2.3 (#1, Jun  5 2003, 13:06:29) 
>>[GCC 3.2.3 20030415 (Debian prerelease)] on linux2
>>
>>and egenix-base-2.0.4
>>
>>I rebuilt Python-2.2.3 / egenix-base-2.0.4 on production and it still
>>works.
>>
>>So is it a gcc problem?
>>
>>-Ross B.
>>
>>_______________________________________________________________________
>>eGenix.com User Mailing List                     http://www.egenix.com/
>>http://lists.egenix.com/mailman/listinfo/egenix-users
>>
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> http://lists.egenix.com/mailman/listinfo/egenix-users

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 11 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2004-01-23: Released mxODBC.Zope.DA 1.0.8        http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the egenix-users mailing list