Re: [BUGS] BUG #3902: Segmentation faults using GSSAPI authentication

2008-01-27 Thread Peter Koczan
On Jan 25, 2008 4:31 PM, Tom Lane <[EMAIL PROTECTED]> wrote:
> Can you get us a stack trace from that crash?

Here's the trace of the server process post-crash.

[EMAIL PROTECTED] ~]# gdb -p 24078
(gdb) bt
#0  0x006ac402 in __kernel_vsyscall ()
#1  0x0060801d in ___newselect_nocancel () from /lib/libc.so.6
#2  0x0820db22 in ServerLoop ()
#3  0x0820d631 in PostmasterMain ()
#4  0x081b2ee7 in main ()

Looking into it more, it looks like the server is restarting every
time it encounters this. I was wrong thinking that it stayed crashed,
I guess I was just looking at a stale connection.

However, I did find a way to trigger this behavior, and it still only
happens with GSSAPI auth.

Basically, run a statement with a syntax error while logged in under
GSSAPI (I think anything that generates an ERROR level message will
work).

Here's the transcript of a GSSAPI connection:
postgres=> select current_user;
 current_user
--
 nobody
(1 row)

postgres=> select * from pg_database 1;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> select * from pg_database 1;
You are currently not connected to a database.
!>

And of an md5-based connection (for user nobody, note that native krb5
connections exhibit this same behavior):
postgres=> select * from pg_database 1;
ERROR:  syntax error at or near "1"
LINE 1: select * from pg_database 1;
  ^
postgres=> select current_user;
 current_user
--
 nobody
(1 row)

postgres=> select * from pg_database 1;
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process
exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
postgres=>

And the syslog entries show this:
Jan 26 19:37:38 mitchell postgres[24586]: [12-1] LOG:  connection
received: host=ator.cs.wisc.edu port=59442
Jan 26 19:37:38 mitchell postgres[24586]: [13-1] LOG:  connection
authorized: user=nobody database=postgres
Jan 26 19:37:47 mitchell postgres[24587]: [12-1] LOG:  connection
received: host=ator.cs.wisc.edu port=59443
Jan 26 19:37:47 mitchell postgres[24587]: [13-1] LOG:  connection
authorized: user=koczan database=postgres
Jan 26 19:38:04 mitchell postgres[24586]: [14-1] ERROR:  syntax error
at or near "1" at character 27
Jan 26 19:38:04 mitchell postgres[24586]: [14-2] STATEMENT:  select *
from pg_database 1;
Jan 26 19:38:11 mitchell postgres[24078]: [12-1] LOG:  server process
(PID 24587) was terminated by signal 11: Segmentation fault
Jan 26 19:38:11 mitchell postgres[24078]: [13-1] LOG:  terminating any
other active server processes
Jan 26 19:38:11 mitchell postgres[24586]: [15-1] WARNING:  terminating
connection because of crash of another server process
Jan 26 19:38:11 mitchell postgres[24586]: [15-2] DETAIL:  The
postmaster has commanded this server process to roll back the current
transaction and exit, because another server
Jan 26 19:38:11 mitchell postgres[24586]: [15-3]  process exited
abnormally and possibly corrupted shared memory.
Jan 26 19:38:11 mitchell postgres[24586]: [15-4] HINT:  In a moment
you should be able to reconnect to the database and repeat your
command.
Jan 26 19:38:11 mitchell postgres[24078]: [14-1] LOG:  all server
processes terminated; reinitializing
Jan 26 19:38:11 mitchell postgres[24607]: [15-1] LOG:  database system
was interrupted; last known up at 2008-01-26 19:25:52 CST
Jan 26 19:38:11 mitchell postgres[24607]: [16-1] LOG:  database system
was not properly shut down; automatic recovery in progress
Jan 26 19:38:11 mitchell postgres[24608]: [15-1] LOG:  connection
received: host=ator.cs.wisc.edu port=59446
Jan 26 19:38:11 mitchell postgres[24607]: [17-1] LOG:  record with
zero length at 0/87A5DC
Jan 26 19:38:11 mitchell postgres[24607]: [18-1] LOG:  redo is not required
Jan 26 19:38:11 mitchell postgres[24607]: [19-1] LOG:  checkpoint
starting: shutdown immediate
Jan 26 19:38:11 mitchell postgres[24607]: [20-1] LOG:  checkpoint
complete: wrote 0 buffers (0.0%); 0 transaction log file(s) added, 0
removed, 0 recycled; write=0.002 s,
Jan 26 19:38:11 mitchell postgres[24607]: [20-2]  sync=0.000 s, total=0.009 s
Jan 26 19:38:11 mitchell postgres[24611]: [15-1] LOG:  autovacuum
launcher started
Jan 26 19:38:11 mitchell postgres[24078]: [15-1] LOG:  database system
is ready to accept connections
Jan 26 19:38:11 mitchell postgres[24608]: [16-1] FATAL:  the database
system is in recovery mode
Jan 26 19:38:11 mitche

[BUGS] BUG #3905: configure cannot find ossp UUID libs and/or includes

2008-01-27 Thread David Wheeler

The following bug has been logged online:

Bug reference:  3905
Logged by:  David Wheeler
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.3RC2
Operating system:   Mac OS X 10.5
Description:configure cannot find ossp UUID libs and/or includes
Details: 

I've installed OSSP UUID 1.6.0 in /usr/local, but configure cannot seem to
find it when I use --with-ossp-uuid:

trigger# ./configure --with-libedit-preferred --with-bonjour --with-perl
PERL=$PERL --with-openssl --with-pam --with-krb5 --with-libxml --with-ldap
--with-ossp-uuid --with-libs=/usr/local/lib
--with-includes=/usr/local/include 
checking build system type... i386-apple-darwin9.1.0
checking host system type... i386-apple-darwin9.1.0
checking which template to use... darwin
checking whether to build with 64-bit integer date/time support... no
checking whether NLS is wanted... no
checking for default port number... 5432
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking if gcc -no-cpp-precomp supports -Wdeclaration-after-statement...
yes
checking if gcc -no-cpp-precomp supports -Wendif-labels... yes
checking if gcc -no-cpp-precomp supports -fno-strict-aliasing... yes
configure: using CFLAGS=-O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -no-cpp-precomp -E
checking allow thread-safe client libraries... no
checking whether to build with Tcl... no
checking whether to build Perl modules... yes
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with Kerberos 5 support... yes
checking whether to build with PAM support... yes
checking whether to build with LDAP support... yes
checking whether to build with Bonjour support... yes
checking whether to build with OpenSSL support... yes
checking for xml2-config... xml2-config
checking for egrep... grep -E
configure: using CPPFLAGS= -I/usr/local/include/libxml2 
-I/usr/local/include
configure: using LDFLAGS= -L/usr/local/lib  -L/usr/local/lib
checking for ld used by GCC... /usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld
checking if the linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) is GNU
ld... no
checking for ranlib... ranlib
checking for strip... strip
checking whether it is possible to strip libraries... no
checking for tar... /usr/bin/tar
checking whether ln -s works... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking for bison... bison -y
configure: using bison (GNU Bison) 2.3
checking for flex... /usr/bin/flex
configure: using flex 2.5.33
checking for perl... /usr/bin/perl5.8.8
checking for Perl archlibexp...
/System/Library/Perl/5.8.8/darwin-thread-multi-2level
checking for Perl privlibexp... /System/Library/Perl/5.8.8
checking for Perl useshrplib... true
checking for flags to link embedded Perl...  -arch i386 -arch ppc
-L/usr/local/lib
/System/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DynaLoader/DynaLo
ader.a -L/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE -lperl
-ldl -lm -lutil -lc
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlopen... none required
checking for library containing socket... none required
checking for library containing shl_load... no
checking for library containing getopt_long... none required
checking for library containing crypt... none required
checking for library containing fdatasync... no
checking for library containing shmget... none required
checking for -ledit... yes (-ledit)
checking for inflate in -lz... yes
checking for library containing com_err... -lkrb5
checking for library containing krb5_sendauth... none required
checking for CRYPTO_new_ex_data in -lcrypto... yes
checking for SSL_library_init in -lssl... yes
checking for pam_start in -lpam... yes
checking for xmlSaveToBuffer in -lxml2... yes
checking for uuid_export in -lossp-uuid... no
checking for uuid_export in -luuid... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking crypt.h usability... no
checking crypt.h presence... no
checking for crypt.h... no
checking dld.h usability... no
checking dld.h presence... no
checking for dld.h... no
checking fp_class.h usability... no

Re: [BUGS] BUG #3902: Segmentation faults using GSSAPI authentication

2008-01-27 Thread Tom Lane
"Peter Koczan" <[EMAIL PROTECTED]> writes:
> Trying to connect via GSSAPI (with Kerberos 5 as the underlying mechanism)
> after the server has been under a very slight load results in an unusable
> but still running server.

I couldn't reproduce this at all on Fedora 8.  I speculate that you've
not told us enough about the configuration you're using.  Given that the
crash doesn't happen until after "connection authorized" is logged, it
seems likely that the problem is not purely GSSAPI's fault but is an
interaction with some other option that I happen not to be using.
Please show your configure options and all non-default postgresql.conf
settings.

> The client connection shows this:
> $ /s/postgresql-8.3-RC2/bin/psql -h mitchell -p 5434
> psql: server closed the connection unexpectedly

BTW, I couldn't get GSSAPI to work at all without a fully-specified -h
option; it kept trying to use the wrong Kerberos principal names.
I wonder whether that is related --- how did you persuade it to do the
above?  Special sauce in krb5.conf maybe?

regards, tom lane

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [BUGS] BUG #3905: configure cannot find ossp UUID libs and/or includes

2008-01-27 Thread Tom Lane
"David Wheeler" <[EMAIL PROTECTED]> writes:
> I've installed OSSP UUID 1.6.0 in /usr/local, but configure cannot seem to
> find it when I use --with-ossp-uuid:

Oh, it finds it all right.  It's just complaining (not incorrectly) that
uuid.h fails when included after .  AFAICT this is just
cosmetic, since we don't use it that way.  If you go ahead and build
then everything should be fine.

I don't know if there's any nice way to make configure avoid
including  while testing uuid.h.  Personally I think
libuuid's attempt to usurp typenames that may be defined by the
system headers is hopelessly broken, and that they'd be better off
doing the #define's the other way around, ie, make the underlying
real names of *their* typedefs different.  It is just not acceptable
that their header doesn't work if  is included first.

regards, tom lane

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq