From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>, Greg Stark <stark(at)mit(dot)edu> |
Subject: | Re: PSA: Systemd will kill PostgreSQL |
Date: | 2016-08-16 16:44:43 |
Message-ID: | c1b3bc20-03ea-63b8-a079-7332d523ad2b@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 8/16/16 11:24 AM, Tom Lane wrote:
> Not sure I believe that --- the cases that have been reported to us
> involved postgres processes that were still alive but had had their
> SysV semaphore sets deleted out from under them. Likely the SysV
> shmem segments too, but that wouldn't cause any observable effects
> for the running cluster. (It *would* risk breaking the interlock
> against starting a new postmaster, I fear.)
>
> It might be that both behaviors exist now but more people know about
> how to turn off the killing-processes one.
They are two separate things.
Both are controlled by settings in logind.conf.
RemoveIPC=
controls whether System V IPC objects are removed when a user logs out.
System users are exempt.
This was turned on by default in systemd version 212 (2014-03-25).
RHEL7 ships 219. Debian stable ships 215.
Apparently, the systemd package in RHEL7 is built with it defaulting to
off. The package in Debian defaults to on, but I can't actually
reproduce the issue.
A brief look through the code and some reading between the lines of the
documentation shows that it only cleans up shared memory segments that
are no longer attached to, but there is no such check for semaphores.
So there are some issues here to be worked out.
KillUserProcesses=
controls whether all processes of a user should be killed when the user
logs out. This was turned on by default in systemd version 230
(2016-05-21). This is not yet shipped widely (Fedora Branched/25,
Debian testing, stable-backports).
There are various ways to adjust that, including the KillOnlyUsers=,
KillExcludeUsers=, loginctl enable-linger, systemd-run. These are all
explained on the logind.conf man page. (Being a "system user" has no
influence here.)
This will clearly result in some wide-spread annoyance among users and
some wide-spread rejoicing among system administrators, but other than
that I don't see a potential harm specific to PostgreSQL here.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-08-16 16:50:12 | Re: Server crash due to SIGBUS(Bus Error) when trying to access the memory created using dsm_create(). |
Previous Message | Robert Haas | 2016-08-16 16:33:40 | Re: [GENERAL] C++ port of Postgres |