pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix memory leak in pgoutput for the WAL sender
Date: Thu, 21 Nov 2024 06:14:42 +0000
Message-ID: <E1tE0Sg-002pnG-Lf@gemulon.postgresql.org> (raw)

Fix memory leak in pgoutput for the WAL sender

RelationSyncCache, the hash table in charge of tracking the relation
schemas sent through pgoutput, was forgetting to free the TupleDesc
associated to the two slots used to store the new and old tuples,
causing some memory to be leaked each time a relation is invalidated
when the slots of an existing relation entry are cleaned up.

This is rather hard to notice as the bloat is pretty minimal, but a
long-running WAL sender would be in trouble over time depending on the
workload.  sysbench has proved to be pretty good at showing the problem,
coupled with some memory monitoring of the WAL sender.

Issue introduced in 52e4f0cd472d, that has added row filters for tables
logically replicated.

Author: Boyu Yang
Reviewed-by: Michael Paquier, Hou Zhijie
Discussion: https://postgr.es/m/DM3PR84MB3442E14B340E553313B5C816E3252@DM3PR84MB3442.NAMPRD84.PROD.OUTLOOK.COM
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/afe9b0d9fee1b4b02593ee4563653198771558cf

Modified Files
--------------
src/backend/replication/pgoutput/pgoutput.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)



view thread (4+ messages)  latest in thread

Message-ID: <E1tE0Sg-002pnG-Lf@gemulon.postgresql.org>
Permalink:  ../E1tE0Sg-002pnG-Lf@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tE0Sg-002pnG-Lf@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix memory leak in pgoutput for the WAL sender
  In-Reply-To: <E1tE0Sg-002pnG-Lf@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox