postgresql/src/backend/postmaster
Tom Lane 27b2c6a1ef 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.
2012-11-21 15:19:30 -05:00
..
autovacuum.c Remove unnecessary "head" arguments from some dlist/slist functions. 2012-10-18 19:04:20 -04:00
bgwriter.c Close un-owned SMgrRelations at transaction end. 2012-10-17 12:38:21 -04:00
checkpointer.c Close un-owned SMgrRelations at transaction end. 2012-10-17 12:38:21 -04:00
fork_process.c Support Linux's oom_score_adj API as well as the older oom_adj API. 2012-06-13 15:35:52 -04:00
Makefile Refactor xlog.c to create src/backend/postmaster/startup.c 2011-11-02 14:25:01 +00:00
pgarch.c Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
pgstat.c Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
postmaster.c Don't launch new child processes after we've been told to shut down. 2012-11-21 15:19:30 -05:00
startup.c Introduce timeout handling framework 2012-07-16 22:55:33 -04:00
syslogger.c Fix syslogger to not fail when log_rotation_age exceeds 2^31 milliseconds. 2012-11-18 16:16:39 -05:00
walwriter.c Close un-owned SMgrRelations at transaction end. 2012-10-17 12:38:21 -04:00