agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix orphaned processes when startup process fails during PM_STAR 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix orphaned processes when startup process fails during PM_STAR @ 2026-04-21 00:40 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 5+ messages in thread From: Michael Paquier @ 2026-04-21 00:40 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 7ff23c6d277d, 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 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/23cebf672e197d98d4fb6ffca2318edae4eadcc5 Modified Files -------------- src/backend/postmaster/postmaster.c | 46 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix orphaned processes when startup process fails during PM_STAR @ 2026-04-21 00:40 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 5+ messages in thread From: Michael Paquier @ 2026-04-21 00:40 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 7ff23c6d277d, 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 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2d347f2cd71364d94cb118310492cb4dc022e05f Modified Files -------------- src/backend/postmaster/postmaster.c | 46 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix orphaned processes when startup process fails during PM_STAR @ 2026-04-21 00:40 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 5+ messages in thread From: Michael Paquier @ 2026-04-21 00:40 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 7ff23c6d277d, 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 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e381843cfaf47f0055a786c4fa4ca7125be6f65e Modified Files -------------- src/backend/postmaster/postmaster.c | 46 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix orphaned processes when startup process fails during PM_STAR @ 2026-04-21 00:40 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 5+ messages in thread From: Michael Paquier @ 2026-04-21 00:40 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 7ff23c6d277d, 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/9b43e6793b0f9dcd2c3935af020cf96cd7b05ec2 Modified Files -------------- src/backend/postmaster/postmaster.c | 48 ++++++++++++------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix orphaned processes when startup process fails during PM_STAR @ 2026-04-21 00:40 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 5+ messages in thread From: Michael Paquier @ 2026-04-21 00:40 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 7ff23c6d277d, 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 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/affdb2dd5c67e1e4135ab19a71114359e0fd0eb9 Modified Files -------------- src/backend/postmaster/postmaster.c | 48 ++++++++++++------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-04-21 00:40 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-21 00:40 pgsql: Fix orphaned processes when startup process fails during PM_STAR Michael Paquier <michael@paquier.xyz> 2026-04-21 00:40 pgsql: Fix orphaned processes when startup process fails during PM_STAR Michael Paquier <michael@paquier.xyz> 2026-04-21 00:40 pgsql: Fix orphaned processes when startup process fails during PM_STAR Michael Paquier <michael@paquier.xyz> 2026-04-21 00:40 pgsql: Fix orphaned processes when startup process fails during PM_STAR Michael Paquier <michael@paquier.xyz> 2026-04-21 00:40 pgsql: Fix orphaned processes when startup process fails during PM_STAR Michael Paquier <michael@paquier.xyz>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox