Thread: Out of memory

Out of memory

From
Ivan Boscaino
Date:
Hi,
I'm not sure if you know this problem.

Create an empty function with 26 parameters:

create function test (INTEGER,TEXT,TEXT,TEXT,CHAR(16),CHAR(11),
BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN,
BOOLEAN,BOOLEAN,BOOLEAN,CHAR(2),TEXT,TEXT,TEXT,TEXT,
CHAR(5),TEXT,TEXT,TEXT,TEXT,TEXT )
returns integer as '
declare
begin
  return 0;
end;' language 'plpgsql';


Call it mistyping the boolean parameters:

select test
(1,'a','a','a','a','a',1,1,1,1,1,1,1,1,1,'a','a','a','a','a','a','a','a','a','a','a');

Then the system crashes.

In /var/log/messages I found:

[...]
Jul  8 11:21:58 host1 kernel: Out of Memory: Killed process 20586
(postmaster).
[...]

OS: RH7.3 and RH7.2
PG: 7.3.2 and 7.3.3

Re: Out of memory

From
Stephan Szabo
Date:
On Tue, 8 Jul 2003, Ivan Boscaino wrote:

> Hi,
> I'm not sure if you know this problem.
>
> Create an empty function with 26 parameters:
>
> create function test (INTEGER,TEXT,TEXT,TEXT,CHAR(16),CHAR(11),
> BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN,BOOLEAN,
> BOOLEAN,BOOLEAN,BOOLEAN,CHAR(2),TEXT,TEXT,TEXT,TEXT,
> CHAR(5),TEXT,TEXT,TEXT,TEXT,TEXT )
> returns integer as '
> declare
> begin
>   return 0;
> end;' language 'plpgsql';
>
>
> Call it mistyping the boolean parameters:
>
> select test
> (1,'a','a','a','a','a',1,1,1,1,1,1,1,1,1,'a','a','a','a','a','a','a','a','a','a','a');
>
> Then the system crashes.

I believe this is fixed in 7.4 (or at least your example does not crash in
7.4)

Re: Out of memory

From
Joe Conway
Date:
Stephan Szabo wrote:
> I believe this is fixed in 7.4 (or at least your example does not crash in
> 7.4)
>

Yeah, this came up a few weeks ago and Tom fixed it in 7.4devel and
REL7_3_STABLE. See (sorry, I doubt this will probably wrap):

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/parser/parse_func.c.diff?r1=1.139.2.1&r2=1.139.2.2&f=c

Joe

Re: Out of memory

From
Tom Lane
Date:
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> I believe this is fixed in 7.4 (or at least your example does not crash in
> 7.4)

Yeah, this was just noticed and fixed a few weeks ago.  I'm not aware
that there is any "crash" involved though, the query just fails in
existing releases.

            regards, tom lane