Re: Logical Replication Memory Allocation Error - "invalid memory alloc request size"
Max Madden <maxmmadden@gmail.com>
From: Max Madden <maxmmadden@gmail.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2025-06-11T10:57:51Z
Lists: pgsql-general
Hi Hayato, Thank you for your reply. We have rewritten as many of our transactions as possible to avoid using temporary tables, and so far, that seems to have resolved the problem. Thank you for your help. Many thanks, Max On Wed, Jun 11, 2025 at 3:31 AM Hayato Kuroda (Fujitsu) < kuroda.hayato@fujitsu.com> wrote: > Dear Max, > > Thanks for the report. > > > The initial snapshot and data copy complete successfully for all tables. > However, anywhere from 5 > > minutes to 2 hours after the initial sync, the subscription consistently > fails with memory allocation errors like: > > > > ``` > > 2025-06-10 14:14:56.800 UTC [299] ERROR: could not receive data from WAL > stream: ERROR: invalid memory alloc request size 1238451248 > > 2025-06-10 14:14:56.805 UTC [1] LOG: background worker "logical > replication worker" (PID 299) exited with exit code 1 > > ``` > > I think this is a known postgres bug which has been also reported at [1]. > We are discussing > how we fix. Typically this can happen when there are lots of concurrent > transactions > and they have DDLs. IIUC there are no good workaround for now - any > parameters can't > avoid the failure. Only you can reduce them. > > I'm happy if you apply the patch posted at [1] and confirms the issue can > be solved, but... > seems difficult because you are in the managed env. > > [1]: > https://www.postgresql.org/message-id/CALDaNm0TaTPuza7Fa%2BDRMzL%2BmqK3%2B7RVEvFiRoDJbU2vkJESwg%40mail.gmail.com > > Best regards, > Hayato Kuroda > FUJITSU LIMITED > >
Commits
-
Fix re-distributing previously distributed invalidation messages during logical decoding.
- d87d07b7ad3b 18.0 landed
- 45c357e0e85d 17.6 landed
- b2ae077205e1 16.10 landed
- fc0fb77c550f 15.14 landed
- 983b3636259b 14.19 landed
- 1230be12f086 13.22 landed