Re: [E] Re: BUG #18938: Logical replication failure in 16.9: "invalid memory alloc request size 1372786672"

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: John Hutchins <John(dot)Hutchins(at)wicourts(dot)gov>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: [E] Re: BUG #18938: Logical replication failure in 16.9: "invalid memory alloc request size 1372786672"
Date: 2025-06-17 17:42:41
Message-ID: CAD21AoAdnGOC=c1dxyzKCO_-dHs4gLBF9YRUnd3mmD2Qzc_XJQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, May 28, 2025 at 8:32 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, May 29, 2025 at 12:43 AM John Hutchins
> <John(dot)Hutchins(at)wicourts(dot)gov> wrote:
> >
> > Hi,
> > Thanks very much for your reply.
> >
> > > The configuration details would help the investigation.
> >
> > Here are all configs which may be relevant:
> >
> > wal_level = logical
> > max_replication_slots = 20
> > max_logical_replication_workers = 14
> > max_wal_senders = 20
> > wal_keep_size = 4096
> > max_wal_size = 4GB
> > min_wal_size = 1GB
> > wal_sender_timeout = 300s
> > archive_mode = on
> > archive_command = 'true'
> > archive_timeout = 3600
> > max_worker_processes = 18
> > max_connections = 1000
> > shared_buffers = 10GB
> > maintenance_work_mem = 2GB
> > work_mem = 26214kB
> > effective_cache_size = 30GB
> > effective_io_concurrency = 200
> >
> > > IIUC this issue could happen especially if there are many concurrent
> > > transactions that perform DDLs. Does this match the workload on your
> > > server?
> >
> > I'm not sure if our workload would contain "many concurrent transactions that perform DDLs." Our workload includes DDLs to create temporary tables and also "ALTER TABLE ENABLE/DISABLE TRIGGER" statements that are single-threaded, but may run concurrently with other DML operations. So, in our workloads, there is a possibility of overlap between DDL (trigger management and temporary table creation) and DML from other sessions.
> >
>
> It can happen in this workload due to the reason explained in email
> [1]. We are talking about the right fix for the problem.

I pushed the fix for this issue[1].

Regards,

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=d87d07b7ad3b782cb74566cd771ecdb2823adf6a

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2025-06-17 17:45:15 Re: Logical replication 'ERROR: invalid memory alloc request size 1831213792' after upgrading to 15.13
Previous Message Masahiko Sawada 2025-06-17 17:41:51 Re: BUG #18942: walsender memory allocation failure adding snapshot and invalidations to logical replica w/PG 16.9