pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Limit checkpointer requests queue size
Date: Sun, 27 Jul 2025 12:33:03 +0000
Message-ID: <E1ug0Yp-000ysn-22@gemulon.postgresql.org> (raw)

Limit checkpointer requests queue size

If the number of sync requests is big enough, the palloc() call in
AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory,
resulting in failure.  This can lead to an infinite loop in the checkpointer
process, as it repeatedly fails to absorb the pending requests.

This commit limits the checkpointer requests queue size to 10M items. In
addition to preventing the palloc() failure, this change helps to avoid long
queue processing time.

Also, this commit is for backpathing only.  The master branch receives
a more invasive yet comprehensive fix for this problem.

Discussion: https://postgr.es/m/db4534f83a22a29ab5ee2566ad86ca92%40postgrespro.ru
Backpatch-through: 13

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/postmaster/checkpointer.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1ug0Yp-000ysn-22@gemulon.postgresql.org>
Permalink:  ../E1ug0Yp-000ysn-22@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ug0Yp-000ysn-22@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: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Limit checkpointer requests queue size
  In-Reply-To: <E1ug0Yp-000ysn-22@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