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: Alex Speller <alex(at)alexspeller(dot)com>
Cc: 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-12 01:42:33
Message-ID: CAHGQGwEHJp6j_d=N0xwApEF9Gb6bmaRPO0c+KnruR82yxF8yhw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Nov 3, 2026 at 1:05 AM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> > WalSndWaitForWal() (logical) reads the flush pointer before WalSndWait() in the same way.
>
> Yes, so logical replication seems to have a similar issue.
> I'll investigate that separately.

Probably I was able to reproduce the same issue in logical replication
by adding a sleep just before WalSndWaitForWal() calls WalSndWait().

WalSndWaitForWal() checks the flush or replay position before
WalSndWait() joins the waitlist. If the required WAL becomes available
between these steps, the notification can be lost, leaving the sender
asleep even though enough WAL is available to continue decoding.

I've attached a patch that rechecks the position after joining the waitlist
and skips the wait if enough WAL is available.

Regards,

--
Fujii Masao

Attachment Content-Type Size
nocfbot-v1-0001-Fix-lost-wakeups-in-logical-WAL-senders-v16.patch application/octet-stream 4.9 KB
nocfbot-v1-0001-Fix-lost-wakeups-in-logical-WAL-senders-v17-v18.patch application/octet-stream 4.9 KB
v1-0001-Fix-lost-wakeups-in-logical-WAL-senders.patch application/octet-stream 5.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message João Rito 2026-11-12 02:41:12 Re: VACUUM/ANALYZE double-count the backend's own pending table stats
Previous Message Michael Paquier 2026-11-12 01:34:36 Re: BUG #19842: pg_restore_extended_stats() rejects a faithful pg_dump of ANALYZE-produced range expression statisti