[egenix-users] SIGBUS from mx/BeeBase/mxBeeBase/btr.c on HP-UX, Alpha, IRIX, Solaris

M.-A. Lemburg mal at egenix.com
Wed Jan 11 17:00:25 CET 2006


Albert Chin wrote:
> On Wed, Jan 11, 2006 at 03:41:38PM +0100, M.-A. Lemburg wrote:
>> Albert Chin wrote:
>>> I've built egenix-mx-base 2.0.6 on HP-UX 11.23/PA-RISC, 11.23/IA64,
>>> Tru64 UNIX 4.0D, 5.1, IRIX 6.5, and Solaris. All give a SIGBUS error
>>> when running the mx/BeeBase/mxBeeBase/test.py script. GDB gives the
>>> following on Solaris:
>>>
>>>   $ gdb python core 
>>>   ...
>>>   #0  0xfee7a104 in bInsertKey (h=0x23f648, key=0x1b2db4, rec=1)
>>>       at mx/BeeBase/mxBeeBase/btr.c:1036
>>>   1036                rec(mkey) = rec;
>>>   gdb> bt
>>>   #0  0xfee7a104 in bInsertKey (h=0x23f648, key=0x1b2db4, rec=1)
>>>       at mx/BeeBase/mxBeeBase/btr.c:1036
>>>   #1  0xfee73104 in mxBeeIndex_SetKey (self=0x1bbcd0, obj=0x1b2da0, 
>>>       recaddr=0x1cbd90) at mx/BeeBase/mxBeeBase/mxBeeBase.c:497
>>>   #2  0xfee752c0 in mxBeeIndex_AssignSubscript (self=0x1bbcd0,
>>>   obj=0x1b2da0, 
>>>       recaddr=0x1cbd90) at mx/BeeBase/mxBeeBase/mxBeeBase.c:1158
>>>   #3  0x000220b0 in PyObject_SetItem ()
>>>   #4  0x000b9ba0 in eval_frame ()
>>>   #5  0x000bece8 in PyEval_EvalCodeEx ()
>>>   #6  0x000b6b1c in PyEval_EvalCode ()
>>>   #7  0x000f6d4c in run_node ()
>>>   #8  0x000f6cc8 in run_err_node ()
>>>   #9  0x000f6c68 in PyRun_FileExFlags ()
>>>   #10 0x000f50ac in PyRun_SimpleFileExFlags ()
>>>   #11 0x000f44e8 in PyRun_AnyFileExFlags ()
>>>   #12 0x0001cd40 in Py_Main ()
>>>   #13 0x0001be28 in main ()
>>>
>>> Any ideas?
>> Could you try the same with our latest snapshot ?!
>>
>> http://www.egenix.com/files/python/egenix-mx-base-2.1.0-2005-05-01.zip
> 
> Same problem.
> 
>> Which compiler did you use to compile the package ?
> 
> GCC 3.4.3.
> 
>> Do you get the same segfaults when compiling the package
>> without optimization ?
> 
> Yes. The above was built with:
>   -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -g -mcpu=v8
> 
> I started debugging the code and made the following patch to the
> latest snapshot:
> --- btr.c.orig	Wed Jan 30 13:34:24 2002
> +++ btr.c	Wed Jan 11 09:20:43 2006
> @@ -1034,6 +1034,23 @@
>  
>              /* insert new key */
>              memcpy(key(mkey), key, h->keySize);
> +            {
> +                char *mkey1;
> +                bRecAddr *mkey2;
> +                bRecAddr val;
> +
> +                mkey1 = (char *)(mkey) + h->keySize;
> +                mkey2 = (bRecAddr *)((char *)(mkey) + h->keySize);
> +printf("mkey1: %lx\n", mkey1);
> +printf("mkey2: %lx\n", mkey2);
> +                *mkey1 = 0;
> +                *(mkey1 + 1) = 0;
> +                *(mkey1 + 2) = 0;
> +                *(mkey1 + 3) = 1;
> +                val = *mkey2;
> +printf("*mkey2: %lu\n", *mkey2);
> +printf("mkey1: %lx\n", mkey1);
> +            }
>              rec(mkey) = rec;
>              childGE(mkey) = 0;
>              ct(buf)++;
> 
> With this patch the segfault occurs at:
> #0  0xfee7a4f0 in bInsertKey (h=0x1be978, key=0x188ad4, rec=1)
>     at mx/BeeBase/mxBeeBase/btr.c:1050
> 1050                    val = *mkey2;
> 
> Does this help?

Are you compiling this on a 64-bit machine ?

FWIW: When trying the test.py script on an AMD64 machine it
runs through fine.

It's been ages since I last looked at the code, so it's hard
to tell what the problem could be.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 11 2006)
>>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list