Skip site navigation (1) Skip section navigation (2)

pgsql: Don't launch new child processes after we've been told to shutd

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Don't launch new child processes after we've been told to shutd
Date: 2012-11-21 20:19:44
Message-ID: E1TbGls-0007NM-1Y@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Don't launch new child processes after we've been told to shut down.

Once we've received a shutdown signal (SIGINT or SIGTERM), we should not
launch any more child processes, even if we get signals requesting such.
The normal code path for spawning backends has always understood that,
but the postmaster's infrastructure for hot standby and autovacuum didn't
get the memo.  As reported by Hari Babu in bug #7643, this could lead to
failure to shut down at all in some cases, such as when SIGINT is received
just before the startup process sends PMSIGNAL_RECOVERY_STARTED: we'd
launch a bgwriter and checkpointer, and then those processes would have no
idea that they ought to quit.  Similarly, launching a new autovacuum worker
would result in waiting till it finished before shutting down.

Also, switch the order of the code blocks in reaper() that detect startup
process crash versus shutdown termination.  Once we've sent it a signal,
we should not consider that exit(1) is surprising.  This is just a cosmetic
fix since shutdown occurs correctly anyway, but better not to log a phony
complaint about startup process crash.

Back-patch to 9.0.  Some parts of this might be applicable before that,
but given the lack of prior complaints I'm not going to worry too much
about older branches.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/866f2dd78414c63a5fcd22ae3a36916e4da164b6

Modified Files
--------------
src/backend/postmaster/postmaster.c |   37 ++++++++++++++++++----------------
1 files changed, 20 insertions(+), 17 deletions(-)

pgsql-committers by date

Next:From: Heikki LinnakangasDate: 2012-11-22 16:20:41
Subject: pgsql: Avoid bogus "out-of-sequence timeline ID" errors instandby-mode
Previous:From: Tom LaneDate: 2012-11-21 20:19:43
Subject: pgsql: Don't launch new child processes after we've been told to shutd

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group