Port Bug Report: Backend dies when run at high debug level

Lists: Postg와이즈 토토SQL
From: Unprivileged user <nobody>
To: pgsql-ports(at)postgresql(dot)org
Subject: Port Bug Report: Backend dies when run at high debug level
Date: 1999-05-28 16:11:36
Message-ID: 199905281611.MAA95585@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg와이즈 토토SQL


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Michael Reed
Your email address : reed(at)itd(dot)nrl(dot)navy(dot)mil

Category : runtime: back-end
Severity : serious

Summary: Backend dies when run at high debug level

System Configuration
--------------------
Operating System : Solaris 2.6

PostgreSQL version : 6.4.2

Compiler used : gcc 2.8.1

Hardware:
---------
SunOS sun0 5.6 Generic_105181-12 sun4u sparc SUNW,Ultra-4
Sun Ultra 450 (2x300Mhz, 512MB). Also verified on Sun Ultra 2 (2x167Mhz, 256MB)

Versions of other tools:
------------------------
gmake 3.75, bison 1.25, flex 2.5.4

--------------------------------------------------------------------------

Problem Description:
--------------------
Backend server dies unexpectedly when running at high debug level.
Problem not seen with no debug level specified.

--------------------------------------------------------------------------

Test Case:
----------
Run server at debug '10' on any solaris 2.6 platform (verified on
multiple machine types).

--------------------------------------------------------------------------

Solution:
---------
Traced it to a SEGV in postgresql-6.4.2/src/backend/nodes/outfuncs.c
in the function _outResdom (line 671). The node->resname pointer was
NULL leading to an explosion of the sprintf statement (kinda hard to
do a sprintf of a string with a null pointer as the argument :-) Quick
hack to fix is:

sprintf(buf, "\"%s\"", node->resname ? node->resname : ""); /* fix for
SELECT col AS

instead of:

sprintf(buf, "\"%s\"", node->resname); /* fix for SELECT col AS

Why/how we are actually getting a NULL pointer in that field I didn't
track down (since this hack fixed the problem).

Tried to email this report to the mailing list, but it bounced.

--------------------------------------------------------------------------


From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Reed <reed(at)itd(dot)nrl(dot)navy(dot)mil>
Cc: pgsql-ports(at)postgreSQL(dot)org
Subject: Re: [PORTS] Port Bug Report: Backend dies when run at high debug level
Date: 1999-05-28 16:35:18
Message-ID: 199905281635.MAA25850@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

I would like to know if you can recreate this on our 6.5 snapshot on
ftp.postgresql.org. We have redesigned the whole outfuncs interface on
6.5.

The new code is:

appendStringInfo(str, " :resname \"%s\" :reskey %d :reskeyop %u",
stringStringInfo(node->resname),
node->reskey,
node->reskeyop);

and stringStringInfo is:

#define stringStringInfo(s) (((s) == NULL) ? "<>" : (s))

so it looks like this has already been fixed.

>
> ============================================================================
> POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
>
> Your name : Michael Reed
> Your email address : reed(at)itd(dot)nrl(dot)navy(dot)mil
>
> Category : runtime: back-end
> Severity : serious
>
> Summary: Backend dies when run at high debug level
>
> System Configuration
> --------------------
> Operating System : Solaris 2.6
>
> PostgreSQL version : 6.4.2
>
> Compiler used : gcc 2.8.1
>
> Hardware:
> ---------
> SunOS sun0 5.6 Generic_105181-12 sun4u sparc SUNW,Ultra-4
> Sun Ultra 450 (2x300Mhz, 512MB). Also verified on Sun Ultra 2 (2x167Mhz, 256MB)
>
>
> Versions of other tools:
> ------------------------
> gmake 3.75, bison 1.25, flex 2.5.4
>
> --------------------------------------------------------------------------
>
> Problem Description:
> --------------------
> Backend server dies unexpectedly when running at high debug level.
> Problem not seen with no debug level specified.
>
>
> --------------------------------------------------------------------------
>
> Test Case:
> ----------
> Run server at debug '10' on any solaris 2.6 platform (verified on
> multiple machine types).
>
>
> --------------------------------------------------------------------------
>
> Solution:
> ---------
> Traced it to a SEGV in postgresql-6.4.2/src/backend/nodes/outfuncs.c
> in the function _outResdom (line 671). The node->resname pointer was
> NULL leading to an explosion of the sprintf statement (kinda hard to
> do a sprintf of a string with a null pointer as the argument :-) Quick
> hack to fix is:
>
> sprintf(buf, "\"%s\"", node->resname ? node->resname : ""); /* fix for
> SELECT col AS
>
> instead of:
>
> sprintf(buf, "\"%s\"", node->resname); /* fix for SELECT col AS
>
> Why/how we are actually getting a NULL pointer in that field I didn't
> track down (since this hack fixed the problem).
>
> Tried to email this report to the mailing list, but it bounced.
>
> --------------------------------------------------------------------------
>
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026