Обсуждение: BUG #5131: The pgsql will lost

Поиск
Список
Период
Сортировка

BUG #5131: The pgsql will lost

От
"aihongwei"
Дата:
The following bug has been logged online:

Bug reference:      5131
Logged by:          aihongwei
Email address:      ufo008ahw@163.com
PostgreSQL version: 8.0.0
Operating system:   linux x86_64
Description:        The pgsql will lost
Details:

In x86_64 platform,
I input command "ulimit -s 2048" to limit the stack size.Then I startup the
server,and when i do some recursion operation, the pgsql will lost in some
time.
It seems that The stack_max_depth does work.

example:
CREATE FUNCTION infinite_recurse() returns int as
'select infinite_recurse()' language sql;
select infinite_recurse();

Re: BUG #5131: The pgsql will lost

От
Robert Haas
Дата:
On Wed, Oct 21, 2009 at 11:23 PM, aihongwei <ufo008ahw@163.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =A0 =A0 =A05131
> Logged by: =A0 =A0 =A0 =A0 =A0aihongwei
> Email address: =A0 =A0 =A0ufo008ahw@163.com
> PostgreSQL version: 8.0.0
> Operating system: =A0 linux x86_64
> Description: =A0 =A0 =A0 =A0The pgsql will lost
> Details:
>
> In x86_64 platform,
> I input command "ulimit -s 2048" to limit the stack size.Then I startup t=
he
> server,and when i do some recursion operation, the pgsql will lost in some
> time.
> It seems that The stack_max_depth does work.
>
> example:
> CREATE FUNCTION infinite_recurse() returns int as
> 'select infinite_recurse()' language sql;
> select infinite_recurse();

*scratches head*

Well, you haven't really told us what happens when you do this.  Does
it hang up forever?  How long did you wait?  Does it crash?

The default value for max_stack_depth (NOT stack_max_depth) seems to
be 2MB, so setting the system limit to the same value seems like a bad
idea.

http://www.postgresql.org/docs/current/interactive/runtime-config-resource.=
html#GUC-MAX-STACK-DEPTH

...Robert

Re: BUG #5131: The pgsql will lost

От
Tom Lane
Дата:
"aihongwei" <ufo008ahw@163.com> writes:
> In x86_64 platform,
> I input command "ulimit -s 2048" to limit the stack size.Then I startup the
> server,and when i do some recursion operation, the pgsql will lost in some
> time.
> It seems that The stack_max_depth does work.

If you read the description of that setting, you will notice that it
recommends leaving a safety margin of at least one megabyte between the
kernel ulimit setting and the max_stack_depth value.  You have left a
safety margin of zero.  A crash is unsurprising.

More recent versions of Postgres are able to check whether
max_stack_depth has a safe value relative to ulimit -s, but 8.0 just
believes whatever you tell it.

BTW, are you *really* using 8.0.0?  If so please update.  The current
bugfix release in that series is 8.0.22.

            regards, tom lane