Thread: make PROFILE=-pg segment fault

make PROFILE=-pg segment fault

From
Qingqing Zhou
Date:
I do "make PROFILE=-pg" on top level, seems everything is ok. When
postmaster starts up, gmon.out is generated. But when I do use psql to
connect to postmaster, a repeatable segment fault happens no matter what
command you do in psql:

sh-2.05a$ psql test
Welcome to psql 8.1RC1, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

test=# create table m(i int);
LOG:  unexpected EOF on client connection
Segmentation fault (core dumped)
sh-2.05a$ ls cor*
core.15004  core.23932
sh-2.05a$ gdb psql -c core.23932
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 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 "i386-redhat-linux"...
Core was generated by `psql test'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /h/164/zhouqq/pginstall/lib/libpq.so.4...done.
Loaded symbols for /h/164/zhouqq/pginstall/lib/libpq.so.4
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0  0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x4001a8b6 in PQfreeCancel (cancel=0xbfffd1b8) at fe-connect.c:2111
#2  0x0804d5fa in AcceptResult (result=0x808ea08, query=0x808e660 "create
table m(i int);") at common.c:656
#3  0x0804dd80 in SendQuery (query=0x808e660 "create table m(i int);") at
common.c:1054
#4  0x0804f6b5 in MainLoop (source=0x4212d980) at mainloop.c:233
#5  0x08051264 in main (argc=2, argv=0xbfffd304) at startup.c:369
#6  0x42017589 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) f 1
#1  0x4001a8b6 in PQfreeCancel (cancel=0xbfffd1b8) at fe-connect.c:2111
2111    {
(gdb) p *cancel
$1 = {raddr = {addr = {ss_family = 1, __ss_align = 774860909, __ss_padding
= "s.PGSQL.5432", '\0' <repeats 107 times>}, salen = 110},
  be_pid = 23933, be_key = 1686421108}
(gdb) q

No strange usage of "PROFILE" in makefiles:
/h/164/zhouqq/pgsql#find . -name "*akefile*" -exec egrep -Hn "PROFILE" {}
\;
./src/Makefile.global.in:404:ifdef PROFILE
./src/Makefile.global.in:405:   CFLAGS += $(PROFILE)
./src/Makefile.global.in:406:   LDFLAGS += $(PROFILE)
./src/Makefile.global:404:ifdef PROFILE
./src/Makefile.global:405:   CFLAGS += $(PROFILE)
./src/Makefile.global:406:   LDFLAGS += $(PROFILE)

I tried "make CC=cc PFOFILE=-pg", still segment fault.

I would love to debug it, but since release time is approaching, I'd
better share this possible bug ...

Regards,
Qingqing

Re: make PROFILE=-pg segment fault

From
Tom Lane
Date:
Qingqing Zhou <zhouqq@cs.toronto.edu> writes:
> I do "make PROFILE=-pg" on top level, seems everything is ok. When
> postmaster starts up, gmon.out is generated. But when I do use psql to
> connect to postmaster, a repeatable segment fault happens no matter what
> command you do in psql:

Works fine for me in Fedora Core 4.  Something broken about your
platform, is my guess ...

            regards, tom lane

Re: make PROFILE=-pg segment fault

From
"Qingqing Zhou"
Date:
"Tom Lane" <tgl@sss.pgh.pa.us> wrote
>
> Works fine for me in Fedora Core 4.  Something broken about your
> platform, is my guess ...
>
You may want to talk to our system admin :-) ... but it doesn't look like
caused by some strange environment ...

/h/164/zhouqq/pginstall/bin#uname -a
Linux eon.cs 2.4.20-30.7.legacysmp #1 SMP Fri Feb 20 10:12:55 PST 2004 i686
unknown
/h/164/zhouqq/pginstall/bin#pg_config --configure
'--enable-cassert' '--enable-debug' '--without-readline'
'--prefix=/h/164/zhouqq/pginstall'

On a separate matter, top level "make PROFILE=-pg" does not work on SunOS,
because of -fPIC conflicts with -pg. Backend level is ok. Shall we do
something or let it be?

Regards,
Qingqing

Re: make PROFILE=-pg segment fault

From
Tom Lane
Date:
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> On a separate matter, top level "make PROFILE=-pg" does not work on SunOS,
> because of -fPIC conflicts with -pg. Backend level is ok. Shall we do
> something or let it be?

This has always been true on some platforms; nothing we can do about it.
My habit on HPUX has been to build the whole tree, then "make clean" in
src/backend and "make PROFILE=-pg" to build just a profilable backend.

            regards, tom lane