pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix handling of backend crashes during standby promotion
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix handling of backend crashes during standby promotion
@ 2026-11-18 04:31  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-18 04:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of backend crashes during standby promotion

If a backend crashed as a standby finishes promotion, the server could
resume normal operation without resetting shared memory and performing
crash recovery. With restart_after_crash disabled, it could keep running
instead of shutting down as required.

This happened when the postmaster detected the backend crash and sent
SIGQUIT to the startup process, but that process had already exited or
was too far along in its normal exit sequence to respond to the signal.
The postmaster then treated its zero exit status as successful startup,
clearing FatalError and entering PM_RUN despite the backend crash.

Fix this by honoring STARTUP_SIGNALED even when the startup process
exits with status zero. This lets the postmaster finish handling
the crash and either restart or shut down, according to restart_after_crash.

A failure of 041_checkpoint_at_promote.pl on buildfarm member tamandua
exposed this race in the server's handling of backend crashes. Although
the test was introduced in v17, the bug affects all supported versions.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/1c733765-62af-48b3-b0d7-1e744c8b8522@gmail.com
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/83cefb7b738c32a66a91537aa502d99891a63b11

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of backend crashes during standby promotion
@ 2026-11-18 04:32  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-18 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of backend crashes during standby promotion

If a backend crashed as a standby finishes promotion, the server could
resume normal operation without resetting shared memory and performing
crash recovery. With restart_after_crash disabled, it could keep running
instead of shutting down as required.

This happened when the postmaster detected the backend crash and sent
SIGQUIT to the startup process, but that process had already exited or
was too far along in its normal exit sequence to respond to the signal.
The postmaster then treated its zero exit status as successful startup,
clearing FatalError and entering PM_RUN despite the backend crash.

Fix this by honoring STARTUP_SIGNALED even when the startup process
exits with status zero. This lets the postmaster finish handling
the crash and either restart or shut down, according to restart_after_crash.

A failure of 041_checkpoint_at_promote.pl on buildfarm member tamandua
exposed this race in the server's handling of backend crashes. Although
the test was introduced in v17, the bug affects all supported versions.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/1c733765-62af-48b3-b0d7-1e744c8b8522@gmail.com
Backpatch-through: 15

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/63df88f3ab9c185d8a382f4cec6132123e45a85c

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of backend crashes during standby promotion
@ 2026-11-18 04:32  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-18 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of backend crashes during standby promotion

If a backend crashed as a standby finishes promotion, the server could
resume normal operation without resetting shared memory and performing
crash recovery. With restart_after_crash disabled, it could keep running
instead of shutting down as required.

This happened when the postmaster detected the backend crash and sent
SIGQUIT to the startup process, but that process had already exited or
was too far along in its normal exit sequence to respond to the signal.
The postmaster then treated its zero exit status as successful startup,
clearing FatalError and entering PM_RUN despite the backend crash.

Fix this by honoring STARTUP_SIGNALED even when the startup process
exits with status zero. This lets the postmaster finish handling
the crash and either restart or shut down, according to restart_after_crash.

A failure of 041_checkpoint_at_promote.pl on buildfarm member tamandua
exposed this race in the server's handling of backend crashes. Although
the test was introduced in v17, the bug affects all supported versions.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/1c733765-62af-48b3-b0d7-1e744c8b8522@gmail.com
Backpatch-through: 15

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/504bd2e8daf03ccb959e9cbe44f5ca1afd8feb77

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of backend crashes during standby promotion
@ 2026-11-18 04:32  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-18 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of backend crashes during standby promotion

If a backend crashed as a standby finishes promotion, the server could
resume normal operation without resetting shared memory and performing
crash recovery. With restart_after_crash disabled, it could keep running
instead of shutting down as required.

This happened when the postmaster detected the backend crash and sent
SIGQUIT to the startup process, but that process had already exited or
was too far along in its normal exit sequence to respond to the signal.
The postmaster then treated its zero exit status as successful startup,
clearing FatalError and entering PM_RUN despite the backend crash.

Fix this by honoring STARTUP_SIGNALED even when the startup process
exits with status zero. This lets the postmaster finish handling
the crash and either restart or shut down, according to restart_after_crash.

A failure of 041_checkpoint_at_promote.pl on buildfarm member tamandua
exposed this race in the server's handling of backend crashes. Although
the test was introduced in v17, the bug affects all supported versions.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/1c733765-62af-48b3-b0d7-1e744c8b8522@gmail.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2bce773e2e847a039d2d5728e19e6d067854655e

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of backend crashes during standby promotion
@ 2026-11-18 04:32  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-18 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of backend crashes during standby promotion

If a backend crashed as a standby finishes promotion, the server could
resume normal operation without resetting shared memory and performing
crash recovery. With restart_after_crash disabled, it could keep running
instead of shutting down as required.

This happened when the postmaster detected the backend crash and sent
SIGQUIT to the startup process, but that process had already exited or
was too far along in its normal exit sequence to respond to the signal.
The postmaster then treated its zero exit status as successful startup,
clearing FatalError and entering PM_RUN despite the backend crash.

Fix this by honoring STARTUP_SIGNALED even when the startup process
exits with status zero. This lets the postmaster finish handling
the crash and either restart or shut down, according to restart_after_crash.

A failure of 041_checkpoint_at_promote.pl on buildfarm member tamandua
exposed this race in the server's handling of backend crashes. Although
the test was introduced in v17, the bug affects all supported versions.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/1c733765-62af-48b3-b0d7-1e744c8b8522@gmail.com
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c9c98c5f8c620c1b8af23cbac61e57a26854a384

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of backend crashes during standby promotion
@ 2026-11-18 04:32  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-11-18 04:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of backend crashes during standby promotion

If a backend crashed as a standby finishes promotion, the server could
resume normal operation without resetting shared memory and performing
crash recovery. With restart_after_crash disabled, it could keep running
instead of shutting down as required.

This happened when the postmaster detected the backend crash and sent
SIGQUIT to the startup process, but that process had already exited or
was too far along in its normal exit sequence to respond to the signal.
The postmaster then treated its zero exit status as successful startup,
clearing FatalError and entering PM_RUN despite the backend crash.

Fix this by honoring STARTUP_SIGNALED even when the startup process
exits with status zero. This lets the postmaster finish handling
the crash and either restart or shut down, according to restart_after_crash.

A failure of 041_checkpoint_at_promote.pl on buildfarm member tamandua
exposed this race in the server's handling of backend crashes. Although
the test was introduced in v17, the bug affects all supported versions.

Backpatch to all supported versions.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/1c733765-62af-48b3-b0d7-1e744c8b8522@gmail.com
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e21e8164db2b057d438c8e06a07175ea90a93e45

Modified Files
--------------
src/backend/postmaster/postmaster.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-11-18 04:32 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 04:31 pgsql: Fix handling of backend crashes during standby promotion Fujii Masao <fujii@postgresql.org>
2026-11-18 04:32 pgsql: Fix handling of backend crashes during standby promotion Fujii Masao <fujii@postgresql.org>
2026-11-18 04:32 pgsql: Fix handling of backend crashes during standby promotion Fujii Masao <fujii@postgresql.org>
2026-11-18 04:32 pgsql: Fix handling of backend crashes during standby promotion Fujii Masao <fujii@postgresql.org>
2026-11-18 04:32 pgsql: Fix handling of backend crashes during standby promotion Fujii Masao <fujii@postgresql.org>
2026-11-18 04:32 pgsql: Fix handling of backend crashes during standby promotion Fujii Masao <fujii@postgresql.org>

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