Re: [PATCH] Fix REPACK decoding worker not cleaned up on FATAL exit

From: Alvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix REPACK decoding worker not cleaned up on FATAL exit
Date: 2026-05-17 20:46:08
Message-ID: agooJmwRT-Xhxf5N@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan Gonzalez V. 2026-05-17 21:27:15 Re: Add pg_get_publication_ddl function
Previous Message Jelte Fennema-Nio 2026-05-17 20:15:55 Re: meson: Make test output much more useful on failure (both in CI and locally)