Re: REPACK hits assertion failure on postmaster death exit

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Manu <manuelreyesbravo(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Subject: Re: REPACK hits assertion failure on postmaster death exit
Date: 2026-10-08 13:29:00
Message-ID: aseWDuhd3744fqPw@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Oct-08, Manu wrote:

> Hi Kirill,
>
> > diff also contains some code churn that makes assert failure vanish,
> > but I don't yet decide if fixing that way is OK. Looks like this just
> > masks errors.
>
> I reproduced it on master (5c74e122ef2) and REL_19_STABLE, and your
> doubt looks right: part of the fix masks the problem.

I'm not sure that changing the FATAL to LOG is right in either REPACK or
parallel.c. But as far as the test is concerned, it appears that
patching parallel.c and pgstat.c is enough to make the crash disappear.
pgstat.c in particular looks quite optimistic about what it's allowed to
do during catastrophic shutdown.

I'm not sure that repack.c needs any changes at all. If it does, then I
would rather do something like

diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c
index a584e138ada..fc063384681 100644
--- a/src/backend/commands/repack.c
+++ b/src/backend/commands/repack.c
@@ -4022,9 +4022,12 @@ stop_repack_decoding_worker(void)
RESUME_INTERRUPTS();

if (status == BGWH_POSTMASTER_DIED)
+ {
+ decoding_worker = NULL;
ereport(FATAL,
errcode(ERRCODE_ADMIN_SHUTDOWN),
errmsg("postmaster exited during REPACK command"));
+ }
}

than reduce the FATAL to LOG. I don't know if a similar reaction in
parallel.c would be appropriate.

I think the real problem is the shutdown of pgaio or pgstats.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-10-08 13:35:43 Re: hashjoins vs. Bloom filters (yet again)
Previous Message Andrey Borodin 2026-10-08 13:14:16 Re: Set 1s WaitLatch timeout if standby limit has expired in ResolveRecoveryConflictWithBufferPin