postgresql/src
Michael Paquier 23cebf672e Fix orphaned processes when startup process fails during PM_STARTUP
When the startup process exists with a FATAL error during PM_STARTUP,
the postmaster called ExitPostmaster() directly, assuming that no other
processes are running at this stage.  Since 7ff23c6d27, this
assumption is not true, as the checkpointer, the background writer, the
IO workers and bgworkers kicking in early would be around.

This commit removes the startup-specific shortcut happening in
process_pm_child_exit() for a failing startup process during PM_STARTUP,
falling down to the existing exit() flow to signal all the started
children with SIGQUIT, so as we have no risk of creating orphaned
processes.

This required an extra change in HandleFatalError() for v18 and newer
versions, as an assertion could be triggered for PM_STARTUP.  It is now
incorrect.  In v17 and older versions, HandleChildCrash() needs to be
changed to handle PM_STARTUP so as children can be waited on.

While on it, fix a comment at the top of postmaster.c.  It was claiming
that the checkpointer and the background writer were started after
PM_RECOVERY.  That is not the case.

Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/CAJTYsWVoD3V9yhhqSae1_wqcnTdpFY-hDT7dPm5005ZFsL_bpA@mail.gmail.com
Backpatch-through: 15
2026-04-21 09:40:07 +09:00
..
backend Fix orphaned processes when startup process fails during PM_STARTUP 2026-04-21 09:40:07 +09:00
bin Fix multiple bugs in astreamer pipeline code. 2026-03-29 09:12:40 -04:00
common Fix comments for Korean encodings in encnames.c 2026-04-16 18:22:45 +12:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include jit: No backport::SectionMemoryManager for LLVM 22. 2026-04-03 15:02:45 +13:00
interfaces Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl EUC_CN, EUC_JP, EUC_KR, EUC_TW: Skip U+00A0 tests instead of failing. 2026-02-25 18:13:35 -08:00
port Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:28:55 -04:00
test Add tests for low-level PGLZ [de]compression routines 2026-04-15 05:09:13 +09:00
timezone Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
tools Enhance make_ctags and make_etags. 2026-04-10 07:55:16 +09:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00