pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Subhrajit Mutsuddi <subhrajitmutsuddi@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: Walsender getting klilled, ERROR: out of memory in server logs
Date: Tue, 26 Mar 2024 11:42:42 +0100
Message-ID: <d6f7e0a17f098f8cd7368a5eec719b981bb63e0e.camel@cybertec.at> (raw)
In-Reply-To: <CAJ+tW40JiG1Vi3nGE2c35RuWV8TY43-GHMmzAV2mP0FQ1h2UAw@mail.gmail.com>
References: <CAJ+tW40JiG1Vi3nGE2c35RuWV8TY43-GHMmzAV2mP0FQ1h2UAw@mail.gmail.com>

On Tue, 2024-03-26 at 09:54 +0530, Subhrajit Mutsuddi wrote:
> I have a table test(id int, lobcol bytea), the REPLICA IDENTITY setting of the
> table is set to FULL. We are using the test_decoding plugin for logical decoding.
> We inserted a record with lobcol size of 256 MB. While updating that record with
> another lobcol value of 256 MB, we found in the server logs that the corresponding
> walsender process keeps getting killed and it shows 'out of memory' and this
> particular message repeats. 
> 
> [11349] ERROR:  out of memory
> DETAIL:  Cannot enlarge string buffer containing 1073741822 bytes by 1 more bytes.
> 
> Can you please help me understand the cause of this issue ? If there are any
> relevant documentation links or any possible workaround please share it.

1B is the maximum amount of memory for an allocation in PostgreSQL.

With REPLICA IDENTITY FULL, the UPDATE has to contain both the old and the
new value for the "bytea".  In text mode, a "bytea" is more than twice its
binary size, because it is encoded as a hexadecimal string.

You might have more luck if you create the subscription with the "binary"
option.

But it is mildly insane to use REPLICA IDENTITY FULL with such a table.
Create a primary key and use that as replica identity.

Yours,
Laurenz Albe





view thread (2+ messages)

Message-ID: <d6f7e0a17f098f8cd7368a5eec719b981bb63e0e.camel@cybertec.at>
Permalink:  ../d6f7e0a17f098f8cd7368a5eec719b981bb63e0e.camel@cybertec.at/
Also on:    postgresql.org/message-id/d6f7e0a17f098f8cd7368a5eec719b981bb63e0e.camel@cybertec.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: laurenz.albe@cybertec.at, subhrajitmutsuddi@gmail.com
  Subject: Re: Walsender getting klilled, ERROR: out of memory in server logs
  In-Reply-To: <d6f7e0a17f098f8cd7368a5eec719b981bb63e0e.camel@cybertec.at>
  References: <CAJ+tW40JiG1Vi3nGE2c35RuWV8TY43-GHMmzAV2mP0FQ1h2UAw@mail.gmail.com> <d6f7e0a17f098f8cd7368a5eec719b981bb63e0e.camel@cybertec.at>

* 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