Fix doc: explanation of how postgres works when OOM killer is invoked

From: Takeshi Ideriha <iderihatakeshi(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fix doc: explanation of how postgres works when OOM killer is invoked
Date: 2026-10-08 03:27:03
Message-ID: ce269321-a7f4-48f4-a9ca-a4a4983b9fd6@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi postgres-hackers

While reviewing a doc patch[1] , I noticed that current explanation
about how postgres behaves when an OOM killer is invoked is not quite
correct.

Postgres doc [2] says:
> This indicates that the <filename>postgres</filename> process
> has been terminated due to memory pressure.
> Although existing database connections will continue to function
> normally, no new connections will be accepted. To recover,
> <productname>PostgreSQL</productname> will need to be restarted.

But I believe all postgres processes will be terminated in this case.
When a backend process is terminated by an OOM killer, the whole
postgres will be restarted or stop depending on restart_after_crash
setting. In a special case where postmaster is killed, each backend
proccesses will also eventually be terminated. The backend process will
be stopped when it notices postmaster is terminated. In this case, the
postgres will just stop and a user needs to restart it. I tested above
two cases and checked the relevant codes.

The statement was very old and committed at 02cd2b96acdb in 2003. I
assume it was correct at the time but I believe it's not as of now
though I haven't checked.

Could you check attached patch?
The original document mentions to postmaster explicitly. So, in my patch
I explain how postmaster and other processes work when OOM killer is
invoked.

[1]
https://www.postgresql.org/message-id/flat/CABH8dKwkp1_TzR7nxfvSpRSLD1b33xw7N_VLMLy3MiaEjAEPNw%40mail.gmail.com

[2]
https://www.postgresql.org/docs/devel/kernel-resources.html#LINUX-MEMORY-OVERCOMMIT

Thank you,
Takeshi Ideriha

Attachment Content-Type Size
v1-0001-Fix-explain-how-postgres-behaves-when-an-OOM-kill.patch text/plain 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-10-08 03:31:49 Re: REPACK (CONCURRENTLY) can't complete after ~105M concurrent updates/deletes
Previous Message shveta malik 2026-10-08 03:25:50 Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation