| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Fix race condition in XLogLogicalInfo and ProcSignal initialization. |
| Date: | 2026-04-28 21:15:58 |
| Message-ID: | CAD21AoBzdeSyLSSPM5E6ysN1r8qzp8u_BRmnLvuAp_S8QxS_fQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi all,
I found a race condition issue between XLogLogicalInfo and ProcSignal
initialization while reviewing another issue[1]. I'm starting a
separate thread for the subject as it's not related to the issue
reported on that thread.
The issue is that child processes could miss the
PROCSIGNAL_BARRIER_UPDATE_XLOG_LOGICAL_INFO signal during the
initialization and end up in an inconsistent state because
InitializeProcessXLogLogicalInfo() is called (in BaseInit()) before
ProcSignalInit(). If the startup emits the signal to a process who is
between two steps, the process would not reflect the latest
XLogLogicalInfo state. I think we should move
InitializeProcessXLogLogicalInfo() after ProcSignalInit() like we do
so for InitLocalDataChecksumState().
I've attached the patch to fix this issue. Feedback is very welcome.
Regards,
[1] https://www.postgresql.org/message-id/CAD21AoBj%2BzKvgw_Q8gjr4YbKccW_uMe3OFQ5%2BKT246FHUuNXSQ%40mail.gmail.com
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-race-condition-in-XLogLogicalInfo-and-ProcSignal.patch | text/x-patch | 4.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gurmokh | 2026-04-28 21:21:35 | Re: New vacuum config to avoid anti wraparound vacuums |
| Previous Message | Alexander Korotkov | 2026-04-28 21:01:32 | Re: Implement waiting for wal lsn replay: reloaded |