On Sun, Aug 26, 2018 at 06:00:23PM +0200, Alexander Kukushkin wrote:
> it is possible to start bgworker with bgw_start_time =
> BgWorkerStart_PostmasterStart, which will be started immediately after
> postmaster.
Right.
> But if you try to do a fast shutdown while postmaster still in the
> pmState == PM_STARTUP, bgworker will never get SIGTERM and postmaster
> will wait forever.
> At the same time, if you do immediate or smart shutdown, it works fine.
>
> The problem is in the pmdie function. Proposed fix attached.
That seems like a good catch and a correct fix to me. The handling of
SIGINT is inconsistent with SIGTERM in pmdie(). I would just add a
comment to mention that at this stage only the startup process is
running, and that it has been signaled already. I'll commit that
tomorrow.
--
Michael