Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uPJ9l-004dcy-VZ for pgsql-general@arkaria.postgresql.org; Wed, 11 Jun 2025 10:58:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uPJ9k-002CMW-00 for pgsql-general@arkaria.postgresql.org; Wed, 11 Jun 2025 10:58:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uPJ9j-002CMO-LX for pgsql-general@lists.postgresql.org; Wed, 11 Jun 2025 10:58:08 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uPJ9i-001Q0E-1O for pgsql-general@lists.postgresql.org; Wed, 11 Jun 2025 10:58:07 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-ade33027bcfso680633766b.1 for ; Wed, 11 Jun 2025 03:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749639484; x=1750244284; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Ch+dn/xr9/iN9U+X6hL5O5xSd8yjG2L7udNgEo2WeFc=; b=BT4WCEoJe51stu3ADM3ygLPA4tOC6CYjMeAUjh3WSFKYVioogzC/OamgctwwcIEeZ6 GaOUyKK2mJyYPogZz0zLr3gm6e2lgHIOj/mj1oXoEbYhW/TxRy4VITldecOpKdjk8hXM lc8FHhufr0lwKn/hpX2BJQH/laESQfF6I5/aqag53SiRVtYmzgLKTw0lOpB1m0i7al36 /fof2CpXEXMjAgW7E2tNXeiJYQvYAJxvnS4Zq5YIDSxjLCFe+EFxyiyV6yt7lchk7MAH +4OmYtsXqMuxnTKkx24648DId1JgngUNN6Qor/kpVTW2qdcri61gU153LfL/PBeuwGt9 iP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749639484; x=1750244284; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ch+dn/xr9/iN9U+X6hL5O5xSd8yjG2L7udNgEo2WeFc=; b=pVs0DWVn2KLGZFXBWtR2sd0murjLpsp36wn6BvWMs9BLI3CvnzWPbki0lZP5BLMRSz kbitdo9Ceu9ksJ893QXVf3bQO24cc98Twwvrl6AAS1KP4ZawUCPbrfZGVJu5eWCiUvHI Z5obSu3E1leQM1SEG+64C4/6Nr2dySu+XkPcwooRfuLUImLUREzx1cgdaxUg/tLKLvf5 Y59Dg1D+ELGYP566ijlRJ8rZj8FyFDUZjIpMKXQrjf+5paNsc/SM7zZ9Ll3pWqzW+UCz FClIOJRV/AKEXvlqr2crfDb/1x0vWKC8YcFmg0TTXf7+DwSziUbNtP18039YS2j614AD V71w== X-Gm-Message-State: AOJu0Yxn/8yPe81TolE/aldcJm5UYnKKCvhRW5jqjw5cjbka6K4Qo4zD VHkkt2iriNHl9BhAIJbQgCySxYwa/WYgRCLMebgLmKIiZVVNNWxxQalZ5lHF/E4agQQbYQCt2Sk /pq+ymrbl6kOcUIUeK1ttWu5knIa+8FhL2kz1 X-Gm-Gg: ASbGnculj9QeKuEEoB1667pdPwinkNrtTmMaatL4zqAuiEdjHegDWKcpF8SApywqD8G ThRlWiAqNwTh3fka/+AaNCP3uL6rev0wNh5W1V5nJAD691a1hDVRrXxgqazWUS4af/s7roz5P/I JpkjhtXxUbhEg5zR60GfcHSmugEq3nv8BNqfqcKiZ2X04/dlx9vRN5KpvZ X-Google-Smtp-Source: AGHT+IE7niUCB70ztDZcLFwZmPEanU7IQe2U/cTSc4qZoFFsMC4GBtdcYuXZxunhOypDd4xyW3FuEKalb6upgumFV/k= X-Received: by 2002:a17:907:3c85:b0:ade:348f:384b with SMTP id a640c23a62f3a-ade89489449mr246248866b.20.1749639483155; Wed, 11 Jun 2025 03:58:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Max Madden Date: Wed, 11 Jun 2025 11:57:51 +0100 X-Gm-Features: AX0GCFsFJgNacwlWVwtfThXnaBe0B5fCG7HnE9sNOVyMnXEyZXmsiPZcX0Q6oM0 Message-ID: Subject: Re: Logical Replication Memory Allocation Error - "invalid memory alloc request size" To: "Hayato Kuroda (Fujitsu)" Cc: "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000e0eb67063749af42" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e0eb67063749af42 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFAM 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 consistentl= y > fails with memory allocation errors like: > > > > ``` > > 2025-06-10 14:14:56.800 UTC [299] ERROR: could not receive data from WA= L > 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%2= B7RVEvFiRoDJbU2vkJESwg%40mail.gmail.com > > Best regards, > Hayato Kuroda > FUJITSU LIMITED > > --000000000000e0eb67063749af42 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Hayato,=C2=A0

Thank= you for your reply.

We have rewritten as many of = our transactions as possible to avoid using temporary tables, and so far, t= hat seems to have resolved the problem.=C2=A0

Than= k you for your help.=C2=A0

Many thanks,
= =C2=A0
Max

On Wed, Jun 11, 2025 at 3:3= 1=E2=80=AFAM Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com> wrote:
Dear Max,

Thanks for the report.

> The initial snapshot and data copy complete successfully for all table= s. However, anywhere from 5
> minutes to 2 hours after the initial sync, the subscription consistent= ly fails with memory allocation errors like:
>
> ```
> 2025-06-10 14:14:56.800 UTC [299] ERROR: could not receive data from W= AL stream: ERROR: invalid memory alloc request size 1238451248
> 2025-06-10 14:14:56.805 UTC [1] LOG: background worker "logical r= eplication worker" (PID 299) exited with exit code 1
> ```

I think this is a known postgres bug which has been also reported at [1]. W= e are discussing
how we fix. Typically this can happen when there are lots of concurrent tra= nsactions
and they have DDLs. IIUC there are no good workaround for now - any paramet= ers 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 c= an be solved, but...
seems difficult because you are in the managed env.

[1]: https://www.postgresql.org/message-id/CALDaNm0TaTPuza7Fa%2= BDRMzL%2BmqK3%2B7RVEvFiRoDJbU2vkJESwg%40mail.gmail.com

Best regards,
Hayato Kuroda
FUJITSU LIMITED

--000000000000e0eb67063749af42--