Re: Deadlock detector fails to activate on a hot standby replica

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: JoongHyuk Shin <sjh910805(at)gmail(dot)com>, Vitaly Davydov <vitprof(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Subject: Re: Deadlock detector fails to activate on a hot standby replica
Date: 2026-09-01 12:52:11
Message-ID: CABPTF7Wn-oW7jGZe1H1OBC-jwz2j3i9-4iG9=VGbkLtUY8NdBA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Sep 1, 2026 at 3:05 PM JoongHyuk Shin <sjh910805(at)gmail(dot)com> wrote:
>
> I've read v8, though I haven't tested it.
> The recheck in RegisterPinCountWaiter() closes the window I described.
> I also think 0002 is worth keeping.

Sorry for the late reply here.

* The caller must already be registered as the shared buffer's
+ * BM_PIN_COUNT_WAITER.

This line of comment for PinCountWaiterCheckReadyForCleanup in v8
seems not accurate to me. RegisterPinCountWaiter() explicitly permits
the shared bit BM_PIN_COUNT_WAITER to be absent. The invariante seems
to be:

Assert(PinCountWaitBuf == bufHdr); This process owns the logical
cleanup wait for this buffer.

Updated this, and extended the commit message like we discussed
earlier though it might not get used at the end. The timeout para in
that message is basically a summary of the first email in this thread.
I am not that familiar with it and too tired to proof-read it. Can you
do me a favor?

Beside these, I have no further comments on the patches. They seem to
be in good shape for a bug fix. Just wondering whether we need a test
for it.

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

Attachment Content-Type Size
v9-0002-Use-RegisterPinCountWaiter-in-LockBufferForCleanu.patch application/octet-stream 2.3 KB
v9-0001-Fix-premature-wakeups-in-hot-standby-buffer-pin-c.patch application/octet-stream 10.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-09-01 13:05:44 Re: [PATCH] Speed up pg_waldump TAP test and fix some GitHub CI Windows flakiness
Previous Message Dagfinn Ilmari Mannsåker 2026-09-01 12:35:29 Re: pgcrypto: remove useless px_memset() and BF_ASM