Thread

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

    Álvaro Herrera <alvherre@kurilemu.de> — 2026-05-17T20:46:08Z

    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)