public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Paquier <[email protected]>
To: DaeMyung Kang <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Fix memory leak of reply_message in walreceiver
Date: Mon, 27 Apr 2026 09:46:02 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Mon, Apr 27, 2026 at 01:59:09AM +0900, DaeMyung Kang wrote:
> initStringInfo() unconditionally allocates a fresh ~1KB buffer with
> palloc() and overwrites the existing data pointer without freeing the
> previous one. So every time the walreceiver re-enters the streaming
> path -- e.g., after a timeline switch, end-of-WAL, or any other
> condition that drives the outer for(;;) loop to iterate -- the prior
> buffer is leaked. The leak is bounded per streaming restart but
> accumulates over the lifetime of a long-running standby that
> restarts streaming often.
This is a problem similar to [1], and I'd agree about cleaning that up
properly.
> This appears to date back to commit add6c3179a4 ("Make the streaming
> replication protocol messages architecture-independent.", 2012), so
> the fix is likely a candidate for back-patching to all supported
> branches.
This is minor, so I don't really see a point in back-patching. Same
reason as the other thread.
I'll go merge that together.
[1]: https://www.postgresql.org/message-id/[email protected]
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, 2-signature.asc)
download
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: [PATCH] Fix memory leak of reply_message in walreceiver
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox