pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@kurilemu.de>
To: Baji Shaik <baji.pgdev@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] Fix REPACK decoding worker not cleaned up on FATAL exit
Date: Sun, 17 May 2026 22:46:08 +0200
Message-ID: <agooJmwRT-Xhxf5N@alvherre.pgsql> (raw)
In-Reply-To: <CA+fm-RNoPxL2N7db_A0anMXV_aDu6jWj4PNOPtMtBUAPDPvSXQ@mail.gmail.com>

On 2026-May-12, Baji Shaik wrote:

> Root cause:
> 
> pg_terminate_backend() causes ereport(FATAL) via ProcDiePending.
> FATAL exits bypass PG_FINALLY blocks, so stop_repack_decoding_worker()
> is never called. The decoding worker is left running.
> 
> Fix:
> 
> Register an on_proc_exit callback when the decoding worker starts.

I think a better fix for this is to use PG_ENSURE_ERROR_CLEANUP().  That
way we avoid leaving callbacks in place, which would not be great if the
same backend does a lot of REPACKs: after a dozen or so, it dies with

FATAL:  out of before_shmem_exit slots

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"La rebeldía es la virtud original del hombre" (Arthur Schopenhauer)





view thread (8+ messages)  latest in thread

Message-ID: <agooJmwRT-Xhxf5N@alvherre.pgsql>
Permalink:  ../agooJmwRT-Xhxf5N@alvherre.pgsql/
Also on:    postgresql.org/message-id/agooJmwRT-Xhxf5N@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@kurilemu.de, baji.pgdev@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH] Fix REPACK decoding worker not cleaned up on FATAL exit
  In-Reply-To: <agooJmwRT-Xhxf5N@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox