Re: BUG #19108: Stack overflow duting query parse - Mailing list pgsql-bugs

From Andrey Zhidenkov
Subject Re: BUG #19108: Stack overflow duting query parse
Date
Msg-id CAN=gQ4DQKP+Hb+a57SKE9_g2_Utumfccacc9pnw9Okpr6RwVrQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19108: Stack overflow duting query parse  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: BUG #19108: Stack overflow duting query parse
List pgsql-bugs
> 15.7 is quite outdated, please upgrade to the latest minor version.

Thanks. I already upgraded the database cluster to 15.14 and switched primary to one of the new nodes.

> Can you create a self-contained SQL script to reproduce this, and post it on this thread with reply-all, please?

Unfortunately, I cannot reproduce the issue even on an existing 15.7 node (one that hasn't upgraded) (don't know if it matters, but now it's a hot standby node) but there are core dumps and debug info packages installed so I can provide more data from core dump.

P.S. We also added RAM to all cluster nodes since there were "out of memory" errors as well.

On Mon, Nov 10, 2025 at 3:38 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 10/11/2025 13:13, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      19108
> Logged by:          Andrey Zhidenkov
> Email address:      pensnarik@gmail.com
> PostgreSQL version: 15.7
> Operating system:   Oracle Linux 8.4

15.7 is quite outdated, please upgrade to the latest minor version.

That said, I don't see any changes between 15.7 and 15.13 in the
relevant code, so it probably won't make a difference. You're missing
out on a bunch of other important fixes though.

> Description:
>
> Hello everyone.
>
> I had a stack overflow on my PostgreSQL production installation during query
> parsing:
>
> 2025-11-05 19:04:58.749 +07 [477608] LOG:  server process (PID 633135) was
> terminated by signal 11: Segmentation fault
>
> execution stack (from coredump):
>
> (lines from 0 to 1021 are nested calls of assign_collations_walker ->
> expression_tree_walker.part)
> #1022 0x00000000006077d4 in assign_collations_walker ()
> #1023 0x00000000007099d3 in expression_tree_walker.part ()
> #1024 0x00000000006077d4 in assign_collations_walker ()
> #1025 0x00000000007099d3 in expression_tree_walker.part ()
> #1026 0x00000000006077d4 in assign_collations_walker ()
> #1027 0x00000000007099d3 in expression_tree_walker.part ()
> #1028 0x00000000006077d4 in assign_collations_walker ()
> #1029 0x00000000007099d3 in expression_tree_walker.part ()
> #1030 0x00000000006077d4 in assign_collations_walker ()
> #1031 0x00000000007099d3 in expression_tree_walker.part ()
> #1032 0x00000000006077d4 in assign_collations_walker ()
> #1033 0x00000000007099d3 in expression_tree_walker.part ()
> #1034 0x00000000006077d4 in assign_collations_walker ()
> #1035 0x00000000007099d3 in expression_tree_walker.part ()
> --Type <RET> for more, q to quit, c to continue without paging--
> #1036 0x00000000006077d4 in assign_collations_walker ()
> #1037 0x00000000007099d3 in expression_tree_walker.part ()
> #1038 0x00000000006077d4 in assign_collations_walker ()
> #1039 0x00000000007099d3 in expression_tree_walker.part ()
> #1040 0x00000000006077d4 in assign_collations_walker ()
> #1041 0x00000000006073bb in assign_collations_walker ()
> #1042 0x0000000000607cfd in assign_query_collations_walker ()
> #1043 0x000000000070a008 in query_tree_walker ()
> #1044 0x00000000005e4e86 in transformStmt ()
> #1045 0x00000000005e6ea1 in parse_analyze_varparams ()
> #1046 0x000000000080d67f in pg_analyze_and_rewrite_varparams ()
> #1047 0x000000000080e6f1 in PostgresMain ()
> #1048 0x000000000078eec0 in ServerLoop ()
> #1049 0x000000000078fe74 in PostmasterMain ()
> #1050 0x0000000000504d6d in main ()

Weird, there is a stack-depth check in expression_tree_walker() which
should turn this into a graceful error.

Can you create a self-contained SQL script to reproduce this, and post
it on this thread with reply-all, please?

- Heikki



--
С уважением, Андрей Жиденков.

pgsql-bugs by date:

Previous
From: "Matheus Alcantara"
Date:
Subject: Re: clog segment truncation
Next
From: "Matheus Alcantara"
Date:
Subject: Re: clog segment truncation