Re: Error: "could not fork new process for connection: Cannot allocate memory" - Mailing list pgsql-admin

From Tom Lane
Subject Re: Error: "could not fork new process for connection: Cannot allocate memory"
Date
Msg-id 492638.1608564438@sss.pgh.pa.us
Whole thread Raw
In response to Re: Error: "could not fork new process for connection: Cannot allocate memory"  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Error: "could not fork new process for connection: Cannot allocate memory"  (frank picabia <fpicabia@gmail.com>)
List pgsql-admin
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Mon, 2020-12-21 at 09:17 -0400, frank picabia wrote:
>> First of all, we did not run out of memory within the OS.  This system is monitored by cacti and
>> Real Used memory never exceeded 30 GB on a server having 64 GB ram plus some swap.

> You probably have to increase the operating system limit for open files
> for the "postgres" user (ulimit -n).

Isn't ulimit -n a per-process, not per-user, limit?  Perhaps ulimit -u
(max user processes) would be worth checking, though.

However, I don't think I believe the assertion that the system wasn't
under overall memory pressure.  What we see in the quoted log fragment
is two separate postmaster fork-failure reports interspersed with a
memory context map, which has to have been coming out of some other
process because postmaster.c does not dump its contexts when reporting
a fork failure.  But there's no reason for a PG process to dump a
context map unless it suffered an ENOMEM allocation failure.
(It'd be interesting to look for the "out of memory" error that presumably
follows the context map, to see if it offers any more info.)

So what we have is fork() being unhappy concurrently with ENOMEM
problems in at least one other process.  That smells like overall
memory pressure to me, cacti or no cacti.

If you've got cgroups enabled, or if the whole thing is running
inside a VM, there might be kernel-enforced memory limits somewhere.

            regards, tom lane



pgsql-admin by date:

Previous
From: frank picabia
Date:
Subject: Re: Error: "could not fork new process for connection: Cannot allocate memory"
Next
From: Fernando Hevia
Date:
Subject: Re: Error: "could not fork new process for connection: Cannot allocate memory"