pgsql: Send SIGKILL to children if they don't die quickly in immediate - Mailing list pgsql-committers

From Alvaro Herrera
Subject pgsql: Send SIGKILL to children if they don't die quickly in immediate
Date
Msg-id E1UsgZ1-0004IS-I7@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Send SIGKILL to children if they don't die quickly in immediate shutdown

On immediate shutdown, or during a restart-after-crash sequence,
postmaster used to send SIGQUIT (and then abandon ship if shutdown); but
this is not a good strategy if backends don't die because of that
signal.  (This might happen, for example, if a backend gets tangled
trying to malloc() due to gettext(), as in an example illustrated by
MauMau.)  This causes problems when later trying to restart the server,
because some processes are still attached to the shared memory segment.

Instead of just abandoning such backends to their fates, we now have
postmaster hang around for a little while longer, send a SIGKILL after
some reasonable waiting period, and then exit.  This makes immediate
shutdown more reliable.

There is disagreement on whether it's best for postmaster to exit after
sending SIGKILL, or to stick around until all children have reported
death.  If this controversy is resolved differently than what this patch
implements, it's an easy change to make.

Bug reported by MauMau in message 20DAEA8949EC4E2289C6E8E58560DEC0@maumau

MauMau and Álvaro Herrera

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/82233ce7ea42d6ba519aaec63008aff49da6c7af

Modified Files
--------------
doc/src/sgml/runtime.sgml           |   10 +--
src/backend/postmaster/postmaster.c |  156 ++++++++++++++++++++++++++---------
src/port/kill.c                     |   20 +++++
3 files changed, 142 insertions(+), 44 deletions(-)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: pg_upgrade: change -u to -U, for consistency
Next
From: Bruce Momjian
Date:
Subject: pgsql: pg_upgrade: trim down --help and doc option descriptions