pgsql: Fix race condition in XLogLogicalInfo and ProcSignal initializat

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix race condition in XLogLogicalInfo and ProcSignal initializat
Date: 2026-05-07 17:10:19
Message-ID: E1wL2Et-000jw8-2P@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix race condition in XLogLogicalInfo and ProcSignal initialization.

Previously, InitializeProcessXLogLogicalInfo() was called before
ProcSignalInit(). This created a window where a process could miss a
signal barrier if it was issued between these two calls. As a result,
the process could fail to update its local XLogLogicalInfo cache,
leading to an inconsistent logical decoding state.

This commit fixes this by moving InitializeProcessXLogLogicalInfo()
after ProcSignalInit(). This ensures that the process is registered to
participate in signal barriers before its state is initialized,
preventing it from missing any state changes propagated during the
startup sequence.

Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAD21AoBzdeSyLSSPM5E6ysN1r8qzp8u_BRmnLvuAp_S8QxS_fQ@mail.gmail.com
Discussion: https://postgr.es/m/CAD21AoBj+zKvgw_Q8gjr4YbKccW_uMe3OFQ5+KT246FHUuNXSQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/postmaster/auxprocess.c | 8 ++++++++
src/backend/utils/init/postinit.c | 13 ++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2026-05-07 22:02:24 pgsql: doc PG 19 relnotes: add missing commits and details
Previous Message John Naylor 2026-05-07 12:13:07 pgsql: Message corrections for partition split/merge commands