pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix postmaster failing to exit when startup crashes during crash 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix postmaster failing to exit when startup crashes during crash @ 2026-08-20 06:17 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2026-08-20 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postmaster failing to exit when startup crashes during crash restart Commit 9b43e6793b0f removed the PM_STARTUP shortcut that exited the postmaster directly when the startup process died, routing the case through HandleChildCrash() so that children processes running during PM_STARTUP are cleaned up rather than orphaned. However, HandleChildCrash() does nothing if FatalError is already set, and that is exactly the case while reinitializing after a crash: a relaunched startup process that dies before WAL redo starts would leave the state machine stuck at PM_STARTUP, preventing the postmaster to shut down. This issue is fixed by restoring the pre-9b43e6793b0f shortcut behavior: if FatalError is set when the startup process crashes, signal the remaining children and move to PM_NO_CHILDREN, so as the postmaster can properly exit with nothing orphaned. This is only reachable in v18 and newer versions, the early return of HandleChildCrash() on FatalError being introduced in f0b7ab725139. This issue has been reported on Windows, for a postmaster with its console gone. A trick to make InitPostmasterChild() fail aggressively was equally able to stuck a postmaster. Reported-by: Kuan-Ting Kuo <m0935388420@gmail.com> Author: Zexin Li <lizi.openmind@gmail.com> Discussion: https://postgr.es/m/19623-f9bd331940be1273@postgresql.org Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/ead8f696b7cd013c0825ee98761a9cea28d73715 Modified Files -------------- src/backend/postmaster/postmaster.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix postmaster failing to exit when startup crashes during crash @ 2026-08-20 06:17 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2026-08-20 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postmaster failing to exit when startup crashes during crash restart Commit 9b43e6793b0f removed the PM_STARTUP shortcut that exited the postmaster directly when the startup process died, routing the case through HandleChildCrash() so that children processes running during PM_STARTUP are cleaned up rather than orphaned. However, HandleChildCrash() does nothing if FatalError is already set, and that is exactly the case while reinitializing after a crash: a relaunched startup process that dies before WAL redo starts would leave the state machine stuck at PM_STARTUP, preventing the postmaster to shut down. This issue is fixed by restoring the pre-9b43e6793b0f shortcut behavior: if FatalError is set when the startup process crashes, signal the remaining children and move to PM_NO_CHILDREN, so as the postmaster can properly exit with nothing orphaned. This is only reachable in v18 and newer versions, the early return of HandleChildCrash() on FatalError being introduced in f0b7ab725139. This issue has been reported on Windows, for a postmaster with its console gone. A trick to make InitPostmasterChild() fail aggressively was equally able to stuck a postmaster. Reported-by: Kuan-Ting Kuo <m0935388420@gmail.com> Author: Zexin Li <lizi.openmind@gmail.com> Discussion: https://postgr.es/m/19623-f9bd331940be1273@postgresql.org Backpatch-through: 18 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3861984342d85898a674fa0c7c93019317bfcff7 Modified Files -------------- src/backend/postmaster/postmaster.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix postmaster failing to exit when startup crashes during crash @ 2026-08-20 06:17 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2026-08-20 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix postmaster failing to exit when startup crashes during crash restart Commit 9b43e6793b0f removed the PM_STARTUP shortcut that exited the postmaster directly when the startup process died, routing the case through HandleChildCrash() so that children processes running during PM_STARTUP are cleaned up rather than orphaned. However, HandleChildCrash() does nothing if FatalError is already set, and that is exactly the case while reinitializing after a crash: a relaunched startup process that dies before WAL redo starts would leave the state machine stuck at PM_STARTUP, preventing the postmaster to shut down. This issue is fixed by restoring the pre-9b43e6793b0f shortcut behavior: if FatalError is set when the startup process crashes, signal the remaining children and move to PM_NO_CHILDREN, so as the postmaster can properly exit with nothing orphaned. This is only reachable in v18 and newer versions, the early return of HandleChildCrash() on FatalError being introduced in f0b7ab725139. This issue has been reported on Windows, for a postmaster with its console gone. A trick to make InitPostmasterChild() fail aggressively was equally able to stuck a postmaster. Reported-by: Kuan-Ting Kuo <m0935388420@gmail.com> Author: Zexin Li <lizi.openmind@gmail.com> Discussion: https://postgr.es/m/19623-f9bd331940be1273@postgresql.org Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6a1759a02aed282ab1af51207301974fa51bc33f Modified Files -------------- src/backend/postmaster/postmaster.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-08-20 06:17 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-20 06:17 pgsql: Fix postmaster failing to exit when startup crashes during crash Michael Paquier <michael@paquier.xyz> 2026-08-20 06:17 pgsql: Fix postmaster failing to exit when startup crashes during crash Michael Paquier <michael@paquier.xyz> 2026-08-20 06:17 pgsql: Fix postmaster failing to exit when startup crashes during crash Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox