Skip to content

Commit 89f562a

Browse files
committed
Stop bgworkers during fast shutdown with postmaster in startup phase
When a postmaster gets into its phase PM_STARTUP, it would start background workers using BgWorkerStart_PostmasterStart mode immediately, which would cause problems for a fast shutdown as the postmaster forgets to send SIGTERM to already-started background workers. With smart and immediate shutdowns, this correctly happened, and fast shutdown is the only mode missing the shot. Author: Alexander Kukushkin Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/CAFh8B=mvnD8+DZUfzpi50DoaDfZRDfd7S=gwj5vU9GYn8UvHkA@mail.gmail.com Backpatch-through: 9.5
1 parent e2841d3 commit 89f562a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ pmdie(SIGNAL_ARGS)
27342734
signal_child(BgWriterPID, SIGTERM);
27352735
if (WalReceiverPID != 0)
27362736
signal_child(WalReceiverPID, SIGTERM);
2737-
if (pmState == PM_RECOVERY)
2737+
if (pmState == PM_STARTUP || pmState == PM_RECOVERY)
27382738
{
27392739
SignalSomeChildren(SIGTERM, BACKEND_TYPE_BGWORKER);
27402740

0 commit comments

Comments
 (0)