Re: VM corruption on standby

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Kirill Reshke <reshkekirill@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Melanie Plageman <melanieplageman@gmail.com>
Date: 2025-09-03T08:28:45Z
Lists: pgsql-hackers
On Wed, Sep 3, 2025 at 9:47 AM Andrey Borodin <x4mmm@yandex-team.ru> wrote:
>
> > On 3 Sep 2025, at 11:37, Alexander Korotkov <aekorotkov@gmail.com> wrote:
> >
> > Could you, please, recheck?
>
> That patch also adds CondVar sleep in critical section. That patch is how we understood that such sleep is dangerous.
>
> Actual patch to deteact a problem is much simpler:
> ```
> diff --git a/src/backend/storage/ipc/waiteventset.c
> b/src/backend/storage/ipc/waiteventset.c
> index 7c0e66900f9..e89e1d115cb 100644
> --- a/src/backend/storage/ipc/waiteventset.c
> +++ b/src/backend/storage/ipc/waiteventset.c
> @@ -1044,6 +1044,7 @@ WaitEventSetWait(WaitEventSet *set, long timeout,
>        long            cur_timeout = -1;
>
>        Assert(nevents > 0);
> +       Assert(CritSectionCount == 0);
>
>        /*
>         * Initialize timeout if requested.  We must record the current time so
> ```
>
> Though it will fail in multixact test.

I thought that patch allows to reproduce the problem of bc22dc0e0d.
Sorry for the noise.

------
Regards,
Alexander Korotkov
Supabase



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Revert "Get rid of WALBufMappingLock"

  2. Get rid of WALBufMappingLock

  3. Split WaitEventSet functions to separate source file

  4. Add WL_EXIT_ON_PM_DEATH pseudo-event.