Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ouh1r-0005S1-Ib for pgsql-general@arkaria.postgresql.org; Mon, 14 Nov 2022 21:30:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ouh1q-0007Dv-Fv for pgsql-general@arkaria.postgresql.org; Mon, 14 Nov 2022 21:30:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ouh1q-0007Dh-5F for pgsql-general@lists.postgresql.org; Mon, 14 Nov 2022 21:30:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ouh1o-0001zP-2A for pgsql-general@postgresql.org; Mon, 14 Nov 2022 21:30:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2AELTwrV957806; Mon, 14 Nov 2022 16:29:59 -0500 From: Tom Lane To: klaus.mailinglists@pernau.at cc: pgsql-general@postgresql.org Subject: Re: PANIC: could not flush dirty data: Cannot allocate memory In-reply-to: References: Comments: In-reply-to klaus.mailinglists@pernau.at message dated "Mon, 14 Nov 2022 22:04:09 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <957804.1668461398.1@sss.pgh.pa.us> Date: Mon, 14 Nov 2022 16:29:58 -0500 Message-ID: <957805.1668461398@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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