Re: Fwd: Bug#390730: postgresql-8.1: segfaults on huge litteral IN clauses

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-bugs(at)postgresql(dot)org, 390730(at)bugs(dot)debian(dot)org
Cc: Benoît Dejean <benoit(at)placenet(dot)org>
Subject: Re: Fwd: Bug#390730: postgresql-8.1: segfaults on huge litteral IN clauses
Date: 2006-10-07 16:23:37
Message-ID: 19080.1160238217@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Martin Pitt <mpitt(at)debian(dot)org> writes:
> I recently got the Debian bug report below, a server crash with huge
> IN clauses.

What this sounds like to me is someone increasing max_stack_depth
without understanding what he's doing. You must make sure that
max_stack_depth is less than the "ulimit -s" setting the postmaster
is running under ... and not just a little bit less, you want a megabyte
or so of daylight in there. Per the documentation:

max_stack_depth (integer)

Specifies the maximum safe depth of the server's execution
stack. The ideal setting for this parameter is the actual stack
size limit enforced by the kernel (as set by ulimit -s or local
equivalent), less a safety margin of a megabyte or so. The safety
margin is needed because the stack depth is not checked in every
routine in the server, but only in key potentially-recursive
routines such as expression evaluation. Setting the parameter
higher than the actual kernel limit will mean that a runaway
recursive function can crash an individual backend process. The
default setting is 2048 KB (two megabytes), which is
conservatively small and unlikely to risk crashes. However, it may
be too small to allow execution of complex functions.

So if the OP wants to use huge IN clauses, he has to both increase
max_stack_depth and adjust the ulimit that the postmaster runs under.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Benoît Dejean 2006-10-07 17:54:12 Re: Fwd: Bug#390730: postgresql-8.1: segfaults on huge
Previous Message Martin Pitt 2006-10-07 15:47:44 Fwd: Bug#390730: postgresql-8.1: segfaults on huge litteral IN clauses