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.


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.


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

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to