pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Walsender getting klilled, ERROR: out of memory in server logs
2+ messages / 2 participants
[nested] [flat]

* Walsender getting klilled, ERROR: out of memory in server logs
@ 2024-03-26 04:24  Subhrajit Mutsuddi <subhrajitmutsuddi@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Subhrajit Mutsuddi @ 2024-03-26 04:24 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Hi All,

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.


[11587] 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.

Thank you,

Regards,
Subhrajit

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Walsender getting klilled, ERROR: out of memory in server logs
@ 2024-03-26 10:42  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Subhrajit Mutsuddi <subhrajitmutsuddi@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2024-03-26 10:42 UTC (permalink / raw)
  To: Subhrajit Mutsuddi <subhrajitmutsuddi@gmail.com>; pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-03-26 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 04:24 Walsender getting klilled, ERROR: out of memory in server logs Subhrajit Mutsuddi <subhrajitmutsuddi@gmail.com>
2024-03-26 10:42 ` Laurenz Albe <laurenz.albe@cybertec.at>

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