Re: Unlimited memory consumption with long-lived connection

Duncan Sands <duncan.sands@deepbluecap.com>

From: Duncan Sands <duncan.sands@deepbluecap.com>
To: Justin Pryzby <pryzby@telsasoft.com>, Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Date: 2023-02-22T17:10:25Z
Lists: pgsql-bugs
Hi Justin,

>>> PS: The testcase was reduced from a script that kept a connection open for a
>>> long time in order to LISTEN, and would execute a query using the same
>>> connection every time there was a notification on the channel.  It consumed ever
>>> more memory to the point of crashing the postgresql server.  Changing the script
>>> to perform the query using a new short-lived connection was an effective workaround.
> 
> It sounds like the same as the issue here:
> https://wiki.postgresql.org/wiki/PostgreSQL_13_Open_Items

I agree that it is likely the same issue.

> There are patches proposed here, which fixed the issue for me.
> But I've always been suspicious that there may be a 2nd, undiagnosed
> issue lurking behind this one...
> https://www.postgresql.org/message-id/20210417021602.7dilihkdc7oblrf7%40alap3.anarazel.de

Thanks.  Since those patches are just a workaround, and I already worked around 
it, I don't plan to give them a whirl.  On the other hand, if Andres ever gets 
round to implementing approach (1) from 
https://www.postgresql.org/message-id/20210417021602.7dilihkdc7oblrf7@alap3.anarazel.de 
then I'd be happy to give it a whirl.  I'm rusty now but I used to be quite 
expert in LLVM, so I might even be able to do some patch review.

Best wishes, Duncan.