Thread: Re: [BUGS] My investigations of the postmaster Bus error

Re: [BUGS] My investigations of the postmaster Bus error

From
Alvaro Herrera
Date:
Hey Martin,

I've been playing with the MIPS machine a little and still haven't found
any _obvious_ cause for the problem.  However I suspect that it may be
related to unaligned memory access, which _I think_ results in a SIGBUS
on MIPS.  I haven't found any documentation on MIPS that would confirm
this however.  I'm not sure exactly how would this by worked around; it
occurs to me that we'd have to change config_real to look like

struct config_real
{
    enum {
        struct config_generic gen;
        double dummy;
    } field1;

    /* these fields must be set correctly in initial value: */
    /* (all but reset_val are constants) */
    double     *variable;
    ...
}

though I'm not sure and I haven't tested it.  (Of course a working patch
needs to change a few more places.)  I'll do some more experiments and
I'll let you know.


mpitt@reset:/tmp/pgsql8.0.4$ gdb bin/postgres
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "mips-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) set args -boot
(gdb) run
Starting program: /tmp/pgsql8.0.4/bin/postgres -boot

Program received signal SIGBUS, Bus error.
0x00818c38 in InitializeGUCOptions () at guc.c:2360
2360                                            *conf->variable = conf->reset_val;
(gdb) bt
#0  0x00818c38 in InitializeGUCOptions () at guc.c:2360
#1  0x004a8fc0 in BootstrapMain (argc=2, argv=0x10053998) at bootstrap.c:244
#2  0x005f4dc4 in main (argc=2, argv=0x10053998) at main.c:296
(gdb) print *conf
$1 = {gen = {name = 0x8c4484 "geqo_selection_bias", context = PGC_USERSET, group = QUERY_TUNING_GEQO,
    short_desc = 0x8c4498 "GEQO: selective pressure within the population.", long_desc = 0x0, flags = 0, vartype =
PGC_REAL, 
    status = 0, reset_source = PGC_S_DEFAULT, tentative_source = PGC_S_DEFAULT, source = PGC_S_DEFAULT, stack = 0x0},
  variable = 0x100136d2, reset_val = 2, min = 1.5, max = 2, assign_hook = 0, show_hook = 0, tentative_val = 0}

--
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
"La grandeza es una experiencia transitoria.  Nunca es consistente.
Depende en gran parte de la imaginación humana creadora de mitos"
(Irulan)

Re: [BUGS] My investigations of the postmaster Bus error

From
Tom Lane
Date:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> I've been playing with the MIPS machine a little and still haven't found
> any _obvious_ cause for the problem.  However I suspect that it may be
> related to unaligned memory access, which _I think_ results in a SIGBUS
> on MIPS.  I haven't found any documentation on MIPS that would confirm
> this however.  I'm not sure exactly how would this by worked around; it
> occurs to me that we'd have to change config_real to look like

I don't think so --- to believe that the GUC data structures aren't
adequately aligned, you'd have to explain why PG doesn't crash on other
architectures that require 8-byte alignment of doubles, eg HPPA.

            regards, tom lane