Re: Stack overflow issue

From: Egor Chindyaskin <kyzevan23(at)mail(dot)ru>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Sascha Kuhl <yogidabanli(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Stack overflow issue
Date: 2023-12-21 08:45:47
Message-ID: 343ff14f-3060-4f88-9cc6-efdb390185df@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24/11/2023 21:14, Heikki Linnakangas wrote:
> What do you think?
Hello! Thank you for researching the problem! I'm more of a tester than
a developer, so I was able to check the patches from that side.
I've configured the server with CFLAGS=" -O0" and cassert enabled and
checked the following queries:

#CommitTransactionCommand
(n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT
s$i;"; done; printf "ERROR; COMMIT;") | psql >/dev/null

#ShowTransactionStateRec
(n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT
s$i;"; done; printf "SET log_min_messages = 'DEBUG5'; SAVEPOINT sp;") |
psql >/dev/null

#MemoryContextCheck
(n=1000000; printf "begin;"; for ((i=1;i<=$n;i++)); do printf "savepoint
s$i;"; done; printf "release s1;" ) | psql >/dev/null

#MemoryContextStatsInternal
(n=1000000; printf "BEGIN;"; for ((i=1;i<=$n;i++)); do printf "SAVEPOINT
s$i;"; done; printf "SELECT
pg_log_backend_memory_contexts(pg_backend_pid())") | psql >/dev/null

On my system, every of that queries led to a server crash at a number of
savepoints in the range from 174,400 to 174,700.
With your patches applied, the savepoint counter goes well beyond these
values, I settled on an amount of approximately 300,000 savepoints.
Your patches look good to me.

Best regards,
Egor Chindyaskin
Postgres Professional: http://postgrespro.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-12-21 09:12:46 Re: Remove MSVC scripts from the tree
Previous Message Andrei Lepikhov 2023-12-21 08:41:35 Re: Postgres picks suboptimal index after building of an extended statistics