Re: Lost walsender wakeup stalls synchronous commits until the standby's next reply (16+)

From: Rajesh Kumar Thandapani <rajeshkumarth(at)google(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Alex Speller <alex(at)alexspeller(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Lost walsender wakeup stalls synchronous commits until the standby's next reply (16+)
Date: 2026-11-26 04:20:55
Message-ID: CAJoZ81vRBEcgmR0n98AFdEWa0DuG_+unWo-x8RJWv_hvdRwd_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Nov 25, 2026 at 4:47 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> Thanks for reporting this issue!
>
> Yeah, Codex also identified it when I used it to review the patch for
> logical replication. I was thinking to look into it after fixing the logical
> replication issue. Now that I've pushed that fix, I'll work on this one next.

Hi Fujii-san,

I had been looking into this standby confirmation wakeup race too, so I
rebased my patch on top of bc85373ff13 in case it saves you some time.

The attached patch passes RecentFlushPtr (rather than loc) as target_lsn
to WalSndWait() when wait_event is WAIT_EVENT_WAIT_FOR_STANDBY_CONFIRMATION,
matching what NeedToWaitForStandbys() tests, and rechecks
StandbySlotsHaveCaughtup(target_lsn, LOG_NEVER) after joining
wal_confirm_rcv_cv. Passing LOG_NEVER avoids duplicating any warnings
already emitted by NeedToWaitForStandbys().

I also attached a backbranch variant for v17 and v18 that passes 0 as
elevel since LOG_NEVER was added in v19. Verified against Xuneng's
reproducer (the walsender now delivers the commit immediately instead of
stalling in WaitForStandbyConfirmation), confirmed no duplicate inactive-slot
warnings are logged, and ran 040_standby_failover_slots_sync.pl and
test_decoding cleanly.

Regards,
Rajesh Kumar Thandapani

Attachment Content-Type Size
v1-0001-Fix-lost-wakeups-for-standby-confirmation-in-logi.patch application/x-patch 3.6 KB
nocfbot-v1-0001-Fix-lost-wakeups-for-standby-confirmation-v17-v18.patch application/x-patch 3.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John Naylor 2026-11-26 05:13:32 Re: SP-GiST quad_point_ops KNN scan can omit a closer point
Previous Message David Rowley 2026-11-26 04:18:43 Re: BUG #19950: pg_terminate_backend rejects a positive bigint timeout as negative