[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 22:35:24 CET 2006


Albert Chin wrote:
> On Wed, Jan 11, 2006 at 08:27:17PM +0100, M.-A. Lemburg wrote:
>> Albert Chin wrote:
>>> On Wed, Jan 11, 2006 at 10:20:19AM -0600, Albert Chin wrote:
>>>> On Wed, Jan 11, 2006 at 05:00:25PM +0100, M.-A. Lemburg wrote:
>>>>> Are you compiling this on a 64-bit machine ?
>>>> They are all 64-bit CPUs but we are building 32-bit objects.
>>>>
>>>>> FWIW: When trying the test.py script on an AMD64 machine it
>>>>> runs through fine.
>>>> Yeah, we tried on RHEL 3/AMD64 and 4/AMD64 with success.
>>>>
>>>>> It's been ages since I last looked at the code, so it's hard
>>>>> to tell what the problem could be.
>>>> What I don't understand is why this doesn't work:
>>>>   *mkey1 = 0;
>>>>   *(mkey1 + 1) = 0;
>>>>   *(mkey1 + 2) = 0;
>>>>   *(mkey1 + 3) = 1;
>>>>   val = *mkey2;
>>>>   ^^^^^^^^^^^^^ SIGBUS
>>> I think it's a memory-alignment issue. Maybe unsigned longs on the
>>> problematic platforms need to be aligned to an even address, or
>>> something like that. If so, how to fix?
>> The above does hint at that yes.
>>
>> Where exactly in test.py do you get the bus error ?
> 
> #0  0xfee7a410 in bInsertKey (h=0x179088, key=0x188c14, rec=1)
>     at mx/BeeBase/mxBeeBase/btr.c:1037
> 1037                rec(mkey) = rec;
> 
> Passing this through the preprocessor:
>   *(bRecAddr *)((char *)(mkey) + h->keySize) = rec;
> where bRecAddr is an 'unsigned long'.

Thanks, but I meant the line in test.py.

Still, could you check what the value of mkey is at the
time of the bus error ?

If this is not aligned properly for the ABI of the platform,
it might be causing the problem.

The btr.* code was not written by myself and there's a lot
of pointer voodoo going on in there, so this will be hard
to fix if it's indeed an alignment problem.

>> It's possible that on your platforms, a keysize of 10 (which
>> is used in test.py) is not allowed. Perhaps you could try 16
>> instead.
> 
> Same error at the same place. I tried 32 but got:
>   Building integer index without duplicates... done.
>   Checking integer index without duplicates... done.
>   Building string index without duplicates...
>   Traceback (most recent call last):
>     File "test.py", line 35, in ?
>       idx = BeeStringIndex(testfile, keysize=32, dupkeys=0, filemode=2)
>   ValueError: illegal sector size (too small or not 0 mod 4)

The message is a bit misleading. There's another case
where you get this error: if you choose a keysize that's
too large for the sector size.

-- 
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