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

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: 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-25 07:47:05
Message-ID: CAHGQGwF=yZdHvy=U6wVOm0rH=m+sJEKyCYnuKAvyODinFAAPOg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 12, 2026 at 8:35 PM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
> Thanks for the patch! v1 looks correct for WalSenderWaitForWal.

Thanks for the review! I've pushed the patch.

> It seems that WaitForStandbyConfirmation (17+) has the same race: a
> standby can confirm between NeedToWaitForStandbys() and joining
> wal_confirm_rcv_cv. Later replies would not wake it until restart_lsn
> advances, which could stall synchronous commits too.
>
> The attached reproducer adds a 3s delay before joining the waitlist,
> and resumes the standby during that delay. With wal_sender_timeout = 0
> and pg_recvlogical -s 0, the sender stalls for about 10s, its idle
> timeout, even if the standby has caught up.
>
> If this is an issue, do we need to apply the recheck like
> StandbySlotsHaveCaughtup() before registration as well?

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.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2026-11-25 08:30:06 Re: BUG #19897: Recovery fails after "LOG: consistent recovery state reached"
Previous Message Michael Paquier 2026-11-25 06:01:23 Re: BUG #19890: pg_receivewal advances past a truncated LZ4 WAL segment