pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Aleš Zelený <zeleny.ales@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Logical replication - ERROR:  could not send data to WAL stream: cannot allocate memory for input buffer
Date: Mon, 8 Jun 2020 15:41:31 +0900
Message-ID: <20200608064131.GD2589@paquier.xyz> (raw)
In-Reply-To: <CAODqTUYjnuctV-bCh=WO6a7s4qyjoQd=6DbsnO7Av62UC4ovJQ@mail.gmail.com>
References: <CAODqTUYjnuctV-bCh=WO6a7s4qyjoQd=6DbsnO7Av62UC4ovJQ@mail.gmail.com>

On Fri, Jun 05, 2020 at 10:57:46PM +0200, Aleš Zelený wrote:
> we are using logical replication for more than 2 years and today I've found
> new not yet know error message from wal receiver. The replication was in
> catchup mode (on publisher side some new tables were created and added to
> publication, on subscriber side they were missing).

This comes from pqCheckInBufferSpace() in libpq when realloc() fails,
most probably because this host ran out of memory.

> Repeated several times, finally it proceeded and switch into streaming
> state. The OS has 64GB RAM, OS + database instance are using usually 20GB
> rest is used as OS buffers. I've checked monitoring (sampled every 10
> seconds) and no memory usage peak was visible, so unless it was a very
> short memory usage peak, I'd not expect the system running out of memory.
>
> Is there something I can do to diagnose and avoid this issue?

Does the memory usage increase slowly over time?  Perhaps it was not a
peak and the memory usage was not steady?  One thing that could always
be tried if you are able to get a rather reproducible case would be to
use valgrind and check if it is able to detect any leaks.  And I am
afraid that it is hard to act on this report without more information.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (3+ messages)  latest in thread

Message-ID: <20200608064131.GD2589@paquier.xyz>
Permalink:  ../20200608064131.GD2589@paquier.xyz/
Also on:    postgresql.org/message-id/20200608064131.GD2589@paquier.xyz

 · 

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-general@postgresql.org
  Cc: michael@paquier.xyz, zeleny.ales@gmail.com
  Subject: Re: Logical replication - ERROR:  could not send data to WAL stream: cannot allocate memory for input buffer
  In-Reply-To: <20200608064131.GD2589@paquier.xyz>
  References: <CAODqTUYjnuctV-bCh=WO6a7s4qyjoQd=6DbsnO7Av62UC4ovJQ@mail.gmail.com> <20200608064131.GD2589@paquier.xyz>

* 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