BUG #4835: psql server crashes when using non-existing functions

Lists: pgsql-bugs
From: "David Sommerseth" <dazo(at)users(dot)sourceforge(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4835: psql server crashes when using non-existing functions
Date: 2009-06-03 09:10:20
Message-ID: 200906030910.n539AKDU078694@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4835
Logged by: David Sommerseth
Email address: dazo(at)users(dot)sourceforge(dot)net
PostgreSQL version: 8.3.7
Operating system: Linux (Gentoo Hardened 2008 / x86 - 32bit)
Description: psql server crashes when using non-existing functions
Details:

(This might be a duplicate of a mail I tried to send directly to the mailing
list, sorry if it gets dupped. I didn't find my report in the archives.
This new entry, via the web form, got more information as well)

I discovered this issue when upgrading from 8.3.5 to 8.3.7

Client side:
$ psql
Password:
Welcome to psql 8.3.7, 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

david=# select pg_test_function_which_do_not_exists();
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.
!>

From server log:
Jun 2 15:07:40 john postgres[31161]: [27-1] david/david [[local]][0] ERROR:
42883: function pg_test_function_which_do_not_exists() does not exist at
character 8
Jun 2 15:07:40 john postgres[31161]: [27-2] david/david [[local]][0] HINT:
No function matches the given name and argument types. You might need to add
explicit type
Jun 2 15:07:40 john postgres[31161]: [27-3] casts.
Jun 2 15:07:40 john postgres[31161]: [27-4] david/david [[local]][0]
LOCATION: ParseFuncOrColumn, parse_func.c:227
Jun 2 15:07:40 john postgres[31161]: [27-5] david/david [[local]][0]
STATEMENT: select pg_test_function_which_do_not_exists();
Jun 2 15:07:40 john postgres[30160]: [27-1] / [][0] LOG: 00000: server
process (PID 31161) was terminated by signal 11: Segmentation fault
Jun 2 15:07:40 john postgres[30160]: [27-2] / [][0] LOCATION: LogChildExit,
postmaster.c:2529
Jun 2 15:07:40 john postgres[30160]: [28-1] / [][0] LOG: 00000:
terminating any other active server processes
Jun 2 15:07:40 john postgres[30160]: [28-2] / [][0] LOCATION:
HandleChildCrash, postmaster.c:2374
Jun 2 15:07:40 john postgres[30160]: [29-1] / [][0] LOG: 00000: all server
processes terminated; reinitializing
Jun 2 15:07:40 john postgres[30160]: [29-2] / [][0] LOCATION:
PostmasterStateMachine, postmaster.c:2690
Jun 2 15:07:40 john postgres[31163]: [30-1] david/david [[local]][0] FATAL:
57P03: the database system is in recovery mode
Jun 2 15:07:40 john postgres[31162]: [30-1] / [][0] LOG: 00000: database
system was interrupted; last known up at 2009-06-02 15:04:57 CEST
Jun 2 15:07:40 john postgres[31162]: [30-2] / [][0] LOCATION: StartupXLOG,
xlog.c:4836
Jun 2 15:07:40 john postgres[31162]: [31-1] / [][0] LOG: 00000: database
system was not properly shut down; automatic recovery in progress
Jun 2 15:07:40 john postgres[31162]: [31-2] / [][0] LOCATION: StartupXLOG,
xlog.c:5003
Jun 2 15:07:40 john postgres[31163]: [30-2] david/david [[local]][0]
LOCATION: ProcessStartupPacket, postmaster.c:1648
Jun 2 15:07:40 john postgres[31162]: [32-1] / [][0] LOG: 00000: redo
starts at 1/7BA68F7C
Jun 2 15:07:40 john postgres[31162]: [32-2] / [][0] LOCATION: StartupXLOG,
xlog.c:5065
Jun 2 15:07:40 john postgres[31162]: [33-1] / [][0] LOG: 00000: record
with zero length at 1/7BA77B74
Jun 2 15:07:40 john postgres[31162]: [33-2] / [][0] LOCATION: ReadRecord,
xlog.c:3126
Jun 2 15:07:40 john postgres[31162]: [34-1] / [][0] LOG: 00000: redo done
at 1/7BA77B48
Jun 2 15:07:40 john postgres[31162]: [34-2] / [][0] LOCATION: StartupXLOG,
xlog.c:5135
Jun 2 15:07:40 john postgres[31162]: [35-1] / [][0] LOG: 00000: last
completed transaction was at log time 2009-06-02 15:07:16.986517+02
Jun 2 15:07:40 john postgres[31162]: [35-2] / [][0] LOCATION: StartupXLOG,
xlog.c:5139
Jun 2 15:07:40 john postgres[31166]: [30-1] / [][0] LOG: 00000: autovacuum
launcher started
Jun 2 15:07:40 john postgres[31166]: [30-2] / [][0] LOCATION:
AutoVacLauncherMain, autovacuum.c:520
Jun 2 15:07:40 john postgres[30160]: [30-1] / [][0] LOG: 00000: database
system is ready to accept connections
Jun 2 15:07:40 john postgres[30160]: [30-2] / [][0] LOCATION: reaper,
postmaster.c:2156

I degraded to 8.3.5 again, and this behaviour disappeared.

The behaviour is sometimes better when the non-existing function do not
start with 'pg_', as it seems to recover better. But not always.

This bug is produced reliably on a Gentoo installation (hardened/x86) on
i686 (32bit).

kind regards,

David Sommerseth


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: David Sommerseth <dazo(at)users(dot)sourceforge(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4835: psql server crashes when using non-existing functions
Date: 2009-06-03 13:37:19
Message-ID: 4A267C8F.9060603@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

David Sommerseth wrote:
> The following bug has been logged online:
>
> Bug reference: 4835
> Logged by: David Sommerseth
> Email address: dazo(at)users(dot)sourceforge(dot)net
> PostgreSQL version: 8.3.7
> Operating system: Linux (Gentoo Hardened 2008 / x86 - 32bit)
> Description: psql server crashes when using non-existing functions
> Details:
>
> (This might be a duplicate of a mail I tried to send directly to the mailing
> list, sorry if it gets dupped. I didn't find my report in the archives.
> This new entry, via the web form, got more information as well)
>
> I discovered this issue when upgrading from 8.3.5 to 8.3.7
>
> ...
>
> I degraded to 8.3.5 again, and this behaviour disappeared.
>
> The behaviour is sometimes better when the non-existing function do not
> start with 'pg_', as it seems to recover better. But not always.

Can you get a core dump, and post the gdb backtrace?

ulimit -c unlimited
pg_ctl start
< do the test to cause segfault>
gdb $PGDATA/core
bt

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Sommerseth" <dazo(at)users(dot)sourceforge(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4835: psql server crashes when using non-existing functions
Date: 2009-06-03 15:37:26
Message-ID: 5420.1244043446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"David Sommerseth" <dazo(at)users(dot)sourceforge(dot)net> writes:
> david=# select pg_test_function_which_do_not_exists();
> server closed the connection unexpectedly

Wow. That works as expected for me, and for everyone who's run the
regression tests successfully; and we've not heard any similar
complaints from anyone.

> This bug is produced reliably on a Gentoo installation (hardened/x86) on
> i686 (32bit).

I hate to cast aspersions, but Gentoo does not have a reputation for
being a remarkably stable platform. I'm betting on a compiler bug.
Have you changed compiler version between 8.3.5 and 8.3.7? Also,
are you following the usual Gentoo practice of compiling everything
locally, or did you get your Postgres executables from somewhere else
(and if so where)?

regards, tom lane