Mailing List Archive



Back to the month index Back to the list index

Peter Shepherd (ps@jb.man.ac.uk)
Tue, 03 Sep 1996 12:22:40 +0100


Message-Id: <546.199609031122@lingmell.jb.man.ac.uk>
Subject: [mSQL] Selecting REAL field problems : HP-UX and SGI IRIX
Date: Tue, 03 Sep 1996 12:22:40 +0100
From: Peter Shepherd <ps@jb.man.ac.uk>

First of all, on August 27th, Kim Rudeen <rudeen@caesun16.msd.ray.com> wrote :

>I am using MSQL on HP-UX-A.09.05-9000_715.
>
>Is this by any chance a problem with accessing REAL values?

That was the original message that rang a bell here. We had
a problem selecting real values from databases using mSQL daemons compiled
using the HP-UX C compiler; trying to select a real causes the daemon to
crash. The problem's affected both mSQL versions 1.0.14 and 1.0.16.

If you look at the file $MSQL_ROOT/src/msql_proc.c, on line 326 in the 1.0.16
version of the file, there's statement to the effect of
        new->val.realVal = (double) * (double *) val;
The daemon crashes while executing that statement.

(xdb post-mortem stack dump produces :

   0 0 _kill@libc + 0x00000008 (hp-ux export stub)
   1 1 raise@libc + 0x00000024 (0x40045d48, 0x7b033820, 0x7b033724, 0x1)
   2 2 abort@libc + 0x0000011c (0, 0x7ffe6000, 0x40bac00, 0x240820)
   3 sigTrap (sig = 10) [msqld.c: 112]
   4 fillValue (val = 0x7b034324, type = 3, length = 0) [msql_proc.c: 326]
   5 extractValues (row = 0x80cca001, fields = 0x400565a8, flist = 0x7b033e80)
   [msqldb.c: 3114]
   6 doSelect (cacheEntry = 0x4000efc0, tables = 0x40056458, fields =
0x400565a8, conds = 00000000, dest = 1, tmpTable = 00000000) [msqldb.c:
5628]
   7 msqlSelect (tables = 0x40056458, fields = 0x400565a8, conds = 00000000,
order = 00000000, DB = 0x40056350) [msqldb.c: 5931]
   8 msqlProcessQuery () [msql_proc.c: 810]
   9 yyparse () [msql_yacc.y: 117]
  10 msqlParseQuery (inBuf = 0x40056360, sock = 6) [msql_proc.c: 899]
  11 main (argc = 1, argv = 0x7b03371c) [msqld.c: 642]
)

Kim, is that the problem you had ? Here I originally worked round it by
playing with the compiler optimisation flags, so by changing CFLAGS and
CC_ONLY in the file $MSQL_ROOT/targets/HP-UX-WHATEVER/conf/site.mm.in to

CC_ONLY= +O3
CFLAGS= -I$(TOP)/ $(EXTRA_CFLAGS)

gave me a working daemon. An optimisation level of 4 also works, but levels
below 3 don't.

Then on September 2nd, Jon Madison <jm@goldendome.com> wrote :

> i don't know if this is a bug w/ msql (+ IRIX) or i'm doing something wrong.

.... And went on to describe what appears to be the same problem, only this
time on an SGI machine.

I'd put this one down to a compiler bug until I read Jon's message, which
seemed to exonerate the HP compiler. Having bothered to consult the system
documentation this time, the problem appears to be one of data alignment
(SIGBUS being the system's usual response to a misaligned data access). So I
went back to conf/site.mm.in and tried

CC_ONLY= +u2
CFLAGS= -g -I$(TOP)/ $(EXTRA_CFLAGS)

and got a working daemon. The +u2 forces 2-bytes data alignment, as opposed to
the HP-PA's default 8-byte alignment for doubles;- the result is a loss of
efficiency, so finding an optimisation level that works for you is a better
bet unless you need to run the daemon through a debugger.

So, Jon, in response to your mail, I'd suggest you play with your compiler
optimisation and alignment flags and see what that does for you.

Alternatively, you can avoid all this aggro (on the HP's at least) by using
gcc.

Anyone got any further thoughts on this ?

Cheers,

Peter.

                                      -
 Peter Shepherd, email : ps@jb.man.ac.uk
 University of Manchester, tel : [+44|0] 1477 571321
 Jodrell Bank, fax : [+44|0] 1477 571618
 Cheshire SK11 9DL, UK.
                                      -

--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!