pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: klaus.mailinglists@pernau.at
Cc: pgsql-general@postgresql.org
Subject: Re: PANIC: could not flush dirty data: Cannot allocate memory
Date: Mon, 14 Nov 2022 16:29:58 -0500
Message-ID: <957805.1668461398@sss.pgh.pa.us> (raw)
In-Reply-To: <ec01f7af535c0c38711a317cba2aa310@pernau.at>
References: <ec01f7af535c0c38711a317cba2aa310@pernau.at>

klaus.mailinglists@pernau.at writes:
> On several servers we see the error message: PANIC:  could not flush 
> dirty data: Cannot allocate memory

What that's telling you is that fsync (or some equivalent OS call)
returned ENOMEM, which would seem to be a kernel-level deficiency.
Perhaps you could dodge it by using a different wal_sync_method setting,
but complaining to your kernel vendor seems like the main thing
to be doing.

The reason we treat it as a PANIC condition is

 * Failure to fsync any data file is cause for immediate panic, unless
 * data_sync_retry is enabled.  Data may have been written to the operating
 * system and removed from our buffer pool already, and if we are running on
 * an operating system that forgets dirty data on write-back failure, there
 * may be only one copy of the data remaining: in the WAL.  A later attempt to
 * fsync again might falsely report success.  Therefore we must not allow any
 * further checkpoints to be attempted.  data_sync_retry can in theory be
 * enabled on systems known not to drop dirty buffered data on write-back
 * failure (with the likely outcome that checkpoints will continue to fail
 * until the underlying problem is fixed).

As noted here, turning on data_sync_retry would reduce the PANIC to
a WARNING.  But I wouldn't recommend that without some assurances
from your kernel vendor about what happens in the kernel after such a
failure.  The panic restart should (in theory) ensure data consistency
is preserved; without it we can't offer any guarantees.

			regards, tom lane





view thread (12+ messages)  latest in thread

Message-ID: <957805.1668461398@sss.pgh.pa.us>
Permalink:  ../957805.1668461398@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/957805.1668461398@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, klaus.mailinglists@pernau.at
  Subject: Re: PANIC: could not flush dirty data: Cannot allocate memory
  In-Reply-To: <957805.1668461398@sss.pgh.pa.us>
  References: <ec01f7af535c0c38711a317cba2aa310@pernau.at> <957805.1668461398@sss.pgh.pa.us>

* 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